Linux User's function of switching su command horizontal bars

Source: Internet
Author: User
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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.