Results 1 to 3 of 3
It seems to me that every command that one can run is run from the shell (most commonly bash). But...where is bash started from? How does it start? Is there ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 04-23-2006 #1
- Join Date
- Jul 2005
- look out your window
An odd question came to me...how does bash start?
It seems to me that every command that one can run is run from the shell (most commonly bash).
But...where is bash started from? How does it start? Is there a way to run commands without a command prompt?
this question just came to me one day while talking to my friend about linux, i was trying to get him to look into it
any answers/links would be helpful
- 04-23-2006 #2
- Join Date
- Aug 2005
Well... A process (a program) is started from another program. ALWAYS.
The first process started is init (from Linux kernel at startup). Then, init launch many processes (it's behavior is determined by the inittab file). For non graphical workstations, init start getty process, wich will start login process. Once you got the access, login will start the default shell (often bash)... then bash will start any program thru its prompt... that's it.
For graphcal workstation, the desktop enviroment start a terminal emulator (xterm, konsole, gnome-terminal), wich will start bash, wich you can use to start programs.
... a program can started without bash? Yes. For example, graphical applications are started without any shell (however they are started by the graphical shell, like KDE or Gnome or XFCE...).When using Windows, have you ever told "Ehi... do your business?"
Linux user #396597 (http://counter.li.org)
- 04-25-2006 #3
If you take a look at the process tree with the command pstree, you'll see the process structure of the system. Init is the master process which gets pulled into play when then kernel is booting, and then all the system processes are run directly off init.
Each virtual terminal (tty) gets login (edit: actually it gets agetty run on it, or does in my case through the tty's defined in /etc/inittab, and -then- login) run on it, or in some cases you can run other things, but there's no need to go into that right now.
Login is part of the shadow package, which is usually linked against the pam authentication layer, once you've successfully logged in, bash (or your choice of shell) is then called by login and run with login as the parent process of bash. You can see that here
|-login---zsh---splitvt-+-zsh---madplay | `-zsh---irssi |-2*[login---zsh---vi] |-login---zsh
|-login---zsh---startx---xinit-+-X | `-sh---fluxbox