Basic Linux command format:
command [parameters] [path file]
The contents of square brackets can be omitted
To view the command help means:
Man command name
Summary of COMMON commands:
1 mkdir Creating a directory Mkdir/data
2 LS display directory or file ls [/data]
3 CD switch directory hierarchy cd/data; CD-Switch to last directory, CD ~ Switch home directory
4 PWD Displays the absolute path of the current directory
5 echo Displays a line of text with > or >> redirects echo "I am a Boy"
6 Cat-n Display line numbers, connect files and print on standard output, with > or >> redirect Cat Test.txt
7 CP [-AIFPRU] [source file] [target file] Copy file
-A equals-pdr
-D If the source file is a linked file, copy the linked file itself instead of the file it refers to
-F Enforcement, if the target file already exists and cannot be opened, after removing the attempt
-I if the target file already exists, ask before overwriting
-p copy along with attributes
-R recursive replication for copying directories
-U If the destination file exists, the destination file is copied before the source file
Note: If the source file has more than one, then the destination file is at the end, and the directory
8 MV Move directory or file mv/data/root/
-I if the destination file already exists, ask whether to overwrite
-F enforcement, do not ask
-U If the destination file exists, the destination file is moved before the source file
Note: If the source file has more than one, then the destination file is at the end, and the directory
9 RM Delete File
-I asks if the user is deleted correctly, using Y or N to answer
-R Delete Directory when adding this option, delete directories and files under directory, can be deleted unless empty directory
-F Force Delete, do not ask
Note: General with rm-f filename, do not prompt to delete, do not use RM-FR file is generally used to force the deletion of the directory is not prompted, too dangerous
RmDir Delete Empty Directory
-p Recursively Delete empty directories
One-by-one find command
Find. -type F-mtime +15 in the current directory, find files 15 days old by type
Find. -name test.txt-mtime-15 find test.txt files within t15 days under current directory
Note: The find command can be paired with Xargs find. -type F-mtime +30 | Xargs rm-f #删除30天以前的普通文件
Can be paired with-exec find. -name test.txt-exec rm {} \; #删除当前目录下test. txt files
Head-n line or-line number, display the file header n rows, default 10 rows
Tail-n line or-number of rows, showing the end of file n rows, default 10 rows
grep displays content that matches a specific pattern
Grep-v boy test.txt the boy who filtered out the Test.txt file, showing the rest of the content
grep boy Test.txt Displays the contents of the Test.txt file that match the boy
-E Filters multiple "a|b" simultaneously
-I is case insensitive
mkdir Creating a Directory
-p recursion to create a directory, the general first level directory does not exist when using-p, otherwise error.
Tree view directory tree
+ Alias display settings alias
Alias rm= ' Rm-i ' at this time, using RM will take the default parameter-I, with/bin/rm or, \RM can mask aliases
Unalias Cancel Alias
Which view the path to a command
Seq prints a bunch of numbers
-S "": print horizontally, separated by a symbol in quotation marks
Seq N: Print 1 to n
Seq m n:m to N
Seq m d n:m to N, step size D (in range)
TAC: Reverse Print File
Uname Display System Information
Useradd Add user Useradd Boy
passwd Change Password passwd boy
SU Switch User
General use of Su-, switch user and Shell environment
Historical Show History
history-d Line number #查看指定行历史内容
-C Clear History
Diff Compare File content differences
WHOAMI View current command line end user
Egrep equivalent to GREP-E matches multiple
Chkconfig View settings Start-up software command
SED takes various content-N cancels the default output P=print D=delete
Touch Modify file timestamp or create file
Netstat view network status Lntup or an
Lsof-i:port View Port
Linux Basic Command Explanation (i)