Linux - Use the command & # 039; su & # 039;
IT Tricks Random

Linux – Use the command & # 039; su & # 039;

#Linux #command

The “su” command (Switch User, commonly called Super User) allows you to open a session with the identifier of another user or to run a new connection shell. Here’s how to do that.

  • Connection with another user

  • Run the new connection shell

  • Back to previous shell

  • Suspend the root account shell

  • Grades

Connection with another user

su toto

After entering your password, you are logged in as a “toto” user, you are still in the same previous work repertoire and will use the settings by default of the previous user (connection shell, environment variables, different permissions).

Run the new connection shell

su - toto

The presence of the hyphen forces the launch of a new connection shell with adjustments to the environment variables and all the default settings according to the user’s preferences. It is for these reasons that you are advised when you are logged in as a super user. Using the command

su -

instead of



Back to previous shell

Enter exit or the key combination Ctrl + D to close the shell in progress and go back to the previous one.

Note : if the command line is empty, Ctrl-d will erase the current character.

Suspend the root account shell

Thanks to the command suspend you can suspend the shell and put it in the background. The command fg allows you to resume it.

[email protected]:~$ su   
debian:/home/ccm# suspend

[1]+ Stopped su
[email protected]:~$ fg


-If you type the command “exit“or”Ctrl-d“from the original (initial) connection shell, you will find yourself disconnected from the system (Unix – GNU / Linux).

-If you were logged in (in a shell) as root and you enter the command “su user“, the system will not require a password.

Photo: © Piotr Trojanowski –

Leave a Reply

Your email address will not be published. Required fields are marked *