Linux - Shell

> Operating System - Kernel (Windows, Unix, Linux) > Linux / Unix

1 - About

Os - Shell in Linux context

Advertising

3 - Management

3.1 - Valid

The valid shell for a distribution are listed in the /etc/shells

/bin/sh
/bin/bash
/sbin/nologin
/bin/tcsh
/bin/csh
/bin/ksh

3.2 - List

Several type of unix_shell have been developed:

3.3 - Prompt

The following table shows the commonly used default UNIX® system prompt and superuser prompt for the C shell, Bourne shell, and Korn shell.

Shell Prompt
C shell machine_name%
C shell for superuser machine_name#
Bourne shell and Korn shell $
Bourne shell and Korn shell for superuser #
Advertising

3.4 - Current Shell

3.4.1 - With the environment variable $SHELL

echo $SHELL
/bin/bash

3.4.2 - With ps

ps -p $$
  PID TTY          TIME CMD
 4104 pts/1    00:00:00 bash

where:

  • $ is a special parameter that contains the PID (process identification number) of the current process which is your shell

Then running a ps on that number displays a process status listing of your shell.

3.4.3 - Zero (0)

In bash, the special parameter 0 expands to the name of the shell or shell script. This is set at shell initialization. If bash is invoked with a file of com- mands, $0 is set to the name of that file.

If bash is started with the -c option, then $0 is set to the first argument after the string to be executed, if one is present. Otherwise, it is set to the file name used to invoke bash, as given by argument zero.

# echo $0
/bin/bash
Advertising

3.5 - default shell for a user

The utility chsh (Change the login shell) is used to change it.

It will change it in the /etc/password file

3.6 - absolute path name

See the special parameter $_

4 - Documentation / Reference

os/linux/shell.txt · Last modified: 2019/05/19 12:19 by gerardnico