Basic commands and document structure
Basic commands:
Whoami # View the currently logged in user
Uname-r # check the kernel version number
Cat / etc/redhat-release # View system version
Cat / proc/cpuinfo # View CPU related information
Cat / proc/meminfo # View memory related information
Ifconfig eth0 # View IP address
Ifconfig eth0 IP # set IP address (effective temporarily)
Shutdown command:
Init 0
Halt
Poweroff
Shutdown-h now
Restart class command:
Init 6
Reboot
Shutdown-r now
Postpone shutdown:
Shutdown-h + 15 "The system in 15 minutes after the explosion"
Cancel:
Shutdown-c & & Ctrl+c
Cat:
The purpose of the command is to connect files or standard input and print. This command is often used to display the contents of a file, to connect several files to display, or to read and display the contents from standard input, and it is often used in conjunction with redirection symbols.
1. Command format:
Cat [options] [files]...
2. Command function:
Cat has three main functions:
1. Show the entire file at once: cat filename
two。 Create a file from the keyboard: cat > filename can only create new files, not edit existing files.
3. Merge several files into one file: cat file1 file2 > file
3. Command parameters:
-A,-- show-all is equivalent to-vET
-b,-- number-nonblank to the non-empty outgoing line number
-e is equivalent to-vE
-E,-- show-ends displays $at the end of each line
-n,-- number numbers all lines of output, starting with 1, numbers all lines of output
-s,-- squeeze-blank has more than two blank lines in a row, so replace it with a blank line
-t is equivalent to-vT
-T,-- show-tabs displays tabbed characters as ^ I.
-u (ignored)
-v,-- show-nonprinting uses ^ and M-references, except for LFD and TAB
Mkdir:
Format: mkdir [- mp] directory
Function: create a new directory
Description of common options:
-p create multiple recursive directories directly
-m set the permissions of the file directly, regardless of the default permissions
[example]: [root@dsetl etc] # cd / tmp
[root@dsetl tmp] # mkdir lp-create directory lp
[root@dsetl tmp] # mkdir-p test1/test2/test3-- create multiple recursive directories directly
Example: create a directory with permissions of 777
Command:
Mkdir-m 777 test3
Output:
[root@localhost test] # mkdir-m 777 test3
[root@localhost test] # ll
Total 12drwxr-xr-x 2 root root 4096 10-25 17:42 test1
Drwxr-xr-x 3 root root 4096 10-25 17:44 test2
Drwxrwxrwx 2 root root 4096 10-25 17:46 test3
[root@localhost test] #
Description:
The permission of test3 is rwxrwxrwx
File directory:
Directory structure of Linux
"/"
| |
| | |
/ root / bin / boot / dev / etc / home / var / lib / usr / media / tmp.
| | |
| | |
/ root/Desktop / root/Maildir. / usr/bin / usr/src / usr/local
/ starting point of the root partition linux file system
/ bin normal command
Commands of the / sbin management class, which only administrators can use
/ home ordinary user's host directory (home directory) for example: bob user's host directory is / home/bob
/ root administrator's host directory
/ boot linux required files for startup, kernel, grub, kernel boot files
/ dev device files, hard disk, keyboard and mouse, optical drive, etc.
/ usr stores application-related files / usr/src: the decompression path of the source package / usr/local: the installation path of the source package
/ opt the storage path when installing additional software
/ etc configuration file
/ var stores variable files, log files, mail, etc.
/ proc virtual file system (computer kernel information, CPU...) does not occupy the real space of the hard disk, and the data is in memory
/ lib library file, driver
/ selinux Security mechanisms developed by the U.S. National Security Agency
/ tmp temporary file storage directory (public folder)
/ media mount point is equivalent to / mnt
/ sys system related files
The data directory that needs to be accessed by the service started by srv