1. Use the sudo command

The command instructions
sudo -s Switch to user root and obtain administrator rights
sudo You can add sudo before a command to obtain administrator permission

Sudo-s:



Sudo command



Description:

  • Sudo is recommended if you only need administrator privileges for a specific operation, that is, temporarily use the manager privileges.
  • If you need to use the administrator permission sudo -s for a large number of operations, exercise caution.

2. Use the whoami command

The command instructions
whoami Viewing the Current User

Effect of the whoami command:

3. Use the exit command

The command instructions
exit Logging Out a User

Effect of the exit command:



Description:

  • If you are the login user after switching, you will return to the previous login account when you quit.
  • If it is a terminal interface, exit the current terminal.

4. Use the who command

The command instructions
who View all login users

Effect of who command:

5. Use the passwd command

The command instructions
passwd Change a user password. If no user is specified, the password of the current login user is changed by default

The following is the effect of the passwd command:

6. Use of which command

The command instructions
which Viewing command Locations

Which command:

7. Use shutdown and restart commands

The command instructions
Shutdown – h now Immediately shut down
reboot restart

Nodule 8.

  • Sudo is a temporary access to the administrator
  • The sudo -s command is used to switch to the administrator user and has the administrator rights. Exercise caution when performing this operation.
  • Exit: Exits the current user
  • Passwd Changes the current user password by default

note

If you have any questions or suggestions, please add wechat: 13960699696.