1. Some simple commands
① Open File Command format:
CD [Directory name]
The directory name has a few symbols that have a special meaning, "..." Represents the Previous directory, the "~" represents the home directory, and "-" represents the preceding catalog.
Therefore, you can use the command to return to the previous level directory :
Cd..
② user-switched command format:
su [-FMP] [-C command] [-s Shell] [--help] [--version] [-] [USER [ARG]]
Parameters:
-F, –fast: Do not need to read the boot file (such as CSH.CSHRC, etc.), only for CSH or tcsh two kinds of shell.
-L, –login: After this parameter is added, it is as if it were re-landed, most of the environment variables (such as home, shell, user, etc.) are based on the user, and
and the working directory will also change. If user is not specified, the default is root.
-M,-p, –preserve-environment: does not change the environment variables when performing su.
-C command: Change the user's username and execute the instruction (command) before changing back to the original user.
Help displaying the description file
–version Display version Information
User: To change the user account,
ARG: The new shell parameter is passed in.
differences between Su [user] and Su-[user] :
su [user] switches to other users, but does not switch environment variables, SU-[user] is the complete switch to the new user environment.
Such as:
[[email protected] ~]# pwd--current directory
/root
[[email protected] ~]# su Oracle--Using SU [user]
[[email protected] root]$ pwd--The current directory does not change, or the previous user directory
/root
[[email protected] root]$ su-oracle--Using Su-[user]
Password:
[[email protected] ~]$ pwd--The current directory becomes the home directory of the current user
/home/oracle
[Email protected] ~]$
So when switching users, try to use Su-[user], otherwise the environment variable may be wrong.
③
Simple commands for Linux