Coincidentally, some old colleagues recently asked these questions, so let's sum up. 1. First, use help to understand su, sudosu, and sudo2. second, use help to understand & quot; loginshell & quot; and & quot; interactiveshell & quot;. & quot; WhenBashstartsexecutesthecommandsinavar...
Coincidentally, some old colleagues recently asked these questions, so let's sum up.
1. First, use help to understand su, sudo su, and sudo
2. understand "login shell" and "interactive shell ".
"When Bash starts executes the commands in a variety of different scripts.
(1) When started as an interactive login shell: Bash reads and executes the/etc/profile (if it exists). After reading that file, it looks ~ /. Bash_profile ,~ /. Bash_login, and ~ /. Profile in that order, and reads and executes the first one (that exists and is readable). When a login shell exits: Bash reads and executes ~ /. Bash_logout (if it exists ).
(2) When started as an interactive shell (but not a login shell): Bash reads and executes ~ /. Bashrc (if it exists )."
Apparently there are differences between login shell and interactive shell in the environment settings, for details, see: http://groups.google.com/group/linux.debian.user/browse_thread/thread/2b71ecfc45789958/7bff24e3bae74b36? Lnk = raot
3. then, the su command's horizontal bar is very easy to understand. the parameter horizontal bar-is used to make the shell obtained by switching a login shell.
-,-L, -- login make the shell a login shell
From the linhx column