su command

LINUX-Frequently used commands

su command Switch user.
su   [-]  [user-name]
The su command is used to switch between users.
To use the su command, specify the user name you wish to switch to as an argument.
If you do not specify a user name, you will be switched to the superuser..

Frequently used options
-  Change to a specified user environment.
Example: Switch user.
$ whoami  ← Show current users
$ su korokoro  ← Change the user to korokoro with the su command

$ whoami  ← Show current users
$  exit  ← exit to return to the original user
$ whoami  ← Show current users
Example: Switch to superuser root and then back to general user.
$ whoami  ← Show current users
$ su -  ← Change to root with the su command
passwd: Enter root password
# whoami ←Show current users
# su - koro  ← Change to the general user koro with the su command
$ whoami  ← Show current users

Copied title and URL