In htop, or other commands that show process status, all bash processes have in the command column
/bin/bash
but one process has in the command column
-bash
What does it mean?
In htop, or other commands that show process status, all bash processes have in the command column
/bin/bash
but one process has in the command column
-bash
What does it mean?
A minus sign before the command name is a convention that login programs use to start login shells. A login program is a program where you typically type your password and that starts a session for you, such as login
, sudo -i
, su -
, sshd, etc. A login shell is the initial shell of a text mode session.
Conventionally, when a program invokes another program, it passes the program's name as argument 0; command line arguments are numbered starting from 1. For example, when you run cp foo bar
, this executes the executable file located at /bin/cp
(on typical systems), and passes cp
as argument 0, foo
as argument 1 and bar
as argument 2. The normal convention is to use the base name of the executable as argument 0. When a login program invokes a shell, it violates this convention and puts an extra hyphen before the program name. Shells understand this alternate convention and set things up appropriately for a login shell, typically reading an initialization file such as ~/.profile
, ~/.login
, ~/.bash_profile
, etc. depending on the shell.
See also Difference between Login Shell and Non-Login Shell?
htop
, that's specific tobash
. It means it's a login shell. – jordanm Jun 30 '15 at 22:21bash
either, other shells do the same. – lcd047 Jun 30 '15 at 22:46