首页 > 代码库 > 《鸟哥的Linux私房菜》学习笔记(2)——Bash特性

《鸟哥的Linux私房菜》学习笔记(2)——Bash特性

bash及其特性:

  离用户最近的程序是shell,shell 是外壳的意思,本身也是一种可执行程序。广义上的shell包含两类GUI和CLI。

  GUI:Gnome,KDE,Xface

  CLI:sh,csh,ksh,bash,tcsh,zsh

  当有多个用户登陆的时候,会有多个进程,进程之间彼此互不相干,因为对于每个进程来说,它只认为当前主机上只有自己和内核存在。但是只有一个shell程序。linux允许一个用户账号登陆多次 。

  进程是程序的副本,进程是程序执行的实例,是有生命周期的,由内核进行管理。

  用户工作环境,多个用户尽管使用的都是shell程序,但是各个用户的工作环境设定却可以各不相同,只不过默认情况下除了管理员,都是一样的。

  shell,子shell。可以在一个shell中在启动一个子shell。下面的通过pstree命令可以看出该关系,如果退出到上一层bash,可以用exit命令。退到最上一层时候,会退出登陆。

[hao@hao ~]$ bash[hao@hao ~]$ pstreeinit-+-NetworkManager-+-dhclient     |                `-{NetworkManager}     |-abrtd     |-acpid     |-atd     |-auditd---{auditd}     |-automount---4*[{automount}]     |-bonobo-activati---{bonobo-activat}     |-certmonger     |-clock-applet     |-console-kit-dae---63*[{console-kit-da}]     |-crond     |-cupsd     |-2*[dbus-daemon---{dbus-daemon}]     |-2*[dbus-launch]     |-devkit-power-da     |-gconf-im-settin     |-gconfd-2     |-gdm-binary-+-gdm-simple-slav-+-Xorg     |            |                 |-gdm-session-wor-+-gnome-session-+-abrt-applet     |            |                 |                 |               |-bluetooth-apple     |            |                 |                 |               |-evolution-alarm     |            |                 |                 |               |-gdu-notificatio     |            |                 |                 |               |-gnome-panel     |            |                 |                 |               |-gnome-power-man     |            |                 |                 |               |-gnome-volume-co     |            |                 |                 |               |-gpk-update-icon     |            |                 |                 |               |-metacity     |            |                 |                 |               |-nautilus     |            |                 |                 |               |-nm-applet     |            |                 |                 |               |-polkit-gnome-au     |            |                 |                 |               |-python     |            |                 |                 |               |-restorecond     |            |                 |                 |               `-{gnome-session}     |            |                 |                 `-{gdm-session-wo}     |            |                 `-{gdm-simple-sla}     |            `-{gdm-binary}     |-gdm-user-switch     |-gnome-keyring-d---2*[{gnome-keyring-}]     |-gnome-screensav     |-gnome-settings----{gnome-settings}     |-gnote     |-gvfs-afc-volume---{gvfs-afc-volum}     |-gvfs-gdu-volume     |-gvfs-gphoto2-vo     |-gvfsd     |-gvfsd-burn     |-gvfsd-computer     |-gvfsd-metadata     |-gvfsd-trash     |-hald-+-hald-runner-+-hald-addon-acpi     |      |             `-hald-addon-inpu     |      `-{hald}     |-ibus-x11     |-im-settings-dae-+-ibus-daemon-+-ibus-engine-pin     |                 |             |-ibus-gconf     |                 |             |-python     |                 |             `-{ibus-daemon}     |                 `-{im-settings-da}     |-login---bash---su---bash     |-master-+-pickup     |        `-qmgr     |-4*[mingetty]     |-modem-manager     |-notification-ar     |-polkitd     |-pulseaudio-+-gconf-helper     |            `-2*[{pulseaudio}]     |-rpc.statd     |-rpcbind     |-rsyslogd---3*[{rsyslogd}]     |-rtkit-daemon---2*[{rtkit-daemon}]     |-seahorse-daemon     |-sshd---sshd---sshd---bash---bash---pstree     |-trashapplet     |-udevd---2*[udevd]     |-udisks-daemon-+-udisks-daemon     |               `-{udisks-daemon}     |-wnck-applet     `-wpa_supplicant[hao@hao ~]$ bash[hao@hao ~]$ pstree        init-+-NetworkManager-+-dhclient     |                `-{NetworkManager}     |-abrtd     |-acpid     |-atd     |-auditd---{auditd}     |-automount---4*[{automount}]     |-bonobo-activati---{bonobo-activat}     |-certmonger     |-clock-applet     |-console-kit-dae---63*[{console-kit-da}]     |-crond     |-cupsd     |-2*[dbus-daemon---{dbus-daemon}]     |-2*[dbus-launch]     |-devkit-power-da     |-gconf-im-settin     |-gconfd-2     |-gdm-binary-+-gdm-simple-slav-+-Xorg     |            |                 |-gdm-session-wor-+-gnome-session-+-abrt-applet     |            |                 |                 |               |-bluetooth-apple     |            |                 |                 |               |-evolution-alarm     |            |                 |                 |               |-gdu-notificatio     |            |                 |                 |               |-gnome-panel     |            |                 |                 |               |-gnome-power-man     |            |                 |                 |               |-gnome-volume-co     |            |                 |                 |               |-gpk-update-icon     |            |                 |                 |               |-metacity     |            |                 |                 |               |-nautilus     |            |                 |                 |               |-nm-applet     |            |                 |                 |               |-polkit-gnome-au     |            |                 |                 |               |-python     |            |                 |                 |               |-restorecond     |            |                 |                 |               `-{gnome-session}     |            |                 |                 `-{gdm-session-wo}     |            |                 `-{gdm-simple-sla}     |            `-{gdm-binary}     |-gdm-user-switch     |-gnome-keyring-d---2*[{gnome-keyring-}]     |-gnome-screensav     |-gnome-settings----{gnome-settings}     |-gnote     |-gvfs-afc-volume---{gvfs-afc-volum}     |-gvfs-gdu-volume     |-gvfs-gphoto2-vo     |-gvfsd     |-gvfsd-burn     |-gvfsd-computer     |-gvfsd-metadata     |-gvfsd-trash     |-hald-+-hald-runner-+-hald-addon-acpi     |      |             `-hald-addon-inpu     |      `-{hald}     |-ibus-x11     |-im-settings-dae-+-ibus-daemon-+-ibus-engine-pin     |                 |             |-ibus-gconf     |                 |             |-python     |                 |             `-{ibus-daemon}     |                 `-{im-settings-da}     |-login---bash---su---bash     |-master-+-pickup     |        `-qmgr     |-4*[mingetty]     |-modem-manager     |-notification-ar     |-polkitd     |-pulseaudio-+-gconf-helper     |            `-2*[{pulseaudio}]     |-rpc.statd     |-rpcbind     |-rsyslogd---3*[{rsyslogd}]     |-rtkit-daemon---2*[{rtkit-daemon}]     |-seahorse-daemon     |-sshd---sshd---sshd---bash---bash---bash---pstree     |-trashapplet     |-udevd---2*[udevd]     |-udisks-daemon-+-udisks-daemon     |               `-{udisks-daemon}     |-wnck-applet     `-wpa_supplicant

 

 

test