Linux Command扫盲点
Table of Contents

日常快捷系

su sudo相关系

可译为switch user

切换到specific user下执行相关命令

可译为Super-User-DO, 当然不同的linux内核也有所区别, 详细可以参照/etc/sudoers的配置

先看下详细的解释:

The often-used sudo su combination works as follows: first sudo asks you for your password, and, if you're allowed to do so, invokes the next command (su) as a super-user. Because su is invoked by root, it does not require you to enter the target user's password. So, sudo su allows you to open a shell as another user (including root), if you're allowed super-user access by the /etc/sudoers file

侧重于acquires the root user's environment

Run the shell specified by the target user's password database entry as a login shell. This means that login-specific resource files such as .profile or .login will be read by the shell. If a command is specified, it is passed to the shell for execution via the shell's -c option. If no command is specified, an interactive shell is executed. sudo attempts to change to that user's home directory before running the shell. The command is run with an environment similar to the one a user would receive at log in. The Command Environment section in the sudoers(5) manual documents how the -i option affects the environment in which a command is run when the sudoers policy is in use.

主要是runs a shell with root privileges

Run the shell specified by the SHELL environment variable if it is set or the shell specified by the invoking user's password database entry. If a command is specified, it is passed to the shell for execution via the shell's -c option. If no command is specified, an interactive shell is executed.

实用终端系

Sample: nohup wget xxxxxx &, 如果重定向输出文件 nohup wget xxxxxx > output.log 2>&1 &