What is the command line?
- A program that receives keyboard commands and passes them to the operating system for execution (a program used to enter and manage commands), collectively called the command line, also called: Shell . Almost all Linux distributions provide a Shell program called: Bash (Bourne -Again Shell, because the original Shell was an original Unix program written by Steve Bourne, Again means an enhanced version)
Bash prompt interface
Why have a home directory ?
1. Each user needs to have his or her own "exclusive" space, which also facilitates management and division of permissions.
2. The home directories of ordinary users are in the /home directory, and "your own user name" is used as the directory name. For example: there is an ordinary user chenjian, and the user's home directory is: /home/chenjian
3. The home directory of the root user is /root
FHS (Filesystem Hierarchy Standard file system hierarchy standard )
Defines the directory structure and contents of the Unix/Linux distribution (including directory name, permissions)
It is mainly used as a reference for developers and system administrators, but Linux distributions usually strictly follow FHS, such as: all configuration files are accessed in the /etc directory https://linux.die.net/man/7/hier You can see more detailed file system structure details
3 commands you need to master for command line roaming
pwd command: Print Working Directory prints the working directory, used to confirm the current specific location
ls command: List list/list/directory, used to list other files in the current directory. Common options -a(all) –l(list) –h(human)
cd command: Change Directory is used to switch directories. Directly entering the cd command will return to the user's own "home directory"
Command line shortcut keys ( students need to practice deliberately during the learning process )
Full path vs relative path
environment variables
Environment variables are variables predefined by the system that can control some behaviors of the system.
View the environment variables of the current system
Permanently modify environment variables
6. Summary: This method can simply and easily monitor the historical commands of each user on the system for later auditing or evidence collection, but you must pay attention to the size of the log and rotate the log regularly (will be discussed in later courses)
Experiment : Permanently modify the environment variable PS1
Environment variable : $HISTFILESIZE
Environment variable : $HISTTIMEFORMAT
Function: Control the format of the history command output (time format)
Environment variable: $TMOUT
Function: After timeout without any operation, the user will be logged out automatically. If this function is set, it will affect: all users of console and SSH (provided that it takes effect under the global configuration file, it can also take effect on individual users, but it is not common) , usually takes effect globally)
echo $ Tab