Linux Common commands
Show directory and File commands
LS: Displays directories and files under the specified directory
ls [option] Directory name
Ls-a: List all files in the directory
ls-d: Show directory, do not display directory files
Ls-i: Display the index point of a file
Ls-k: File size in bytes
Ls–l: Listing details of a file
Ls-r: Displays the contents of the specified directory and sub-directory
Ls-t: Sort by Time
Ls-a: File size sorting
Show file Contents command
Cat [Options] File name
Cat-n: Number of lines starting from 1 for all outputs
Cat–b: Similar to-N,-B does not number blank lines
Cat–s: When there are more than two rows of blank lines, replace them with a blank line
More commands
more [options] [filename]
More–num: Number of rows displayed at one time
More +num: Starting from the first few lines
More-s: When you meet more than two lines of blank line is replaced by a row
Less Pagination Display Commands
less [options] [filename]
Less–n: Show Remove line number
Less-s: Compressing multiple empty rows into a blank line
Head Command
Head [options] File name
Head–c: How many bytes before the file is displayed
Head-n: How many lines before the file is displayed
Head-q: The file name is not displayed before displaying the contents
Head-v: Displays file names before displaying the contents of the files
Tail command
tail [options] File name
Tail-c: Displays the number of bytes after the file
Tail-n: How many lines are displayed after the file
Tail-q: File name is not displayed before displaying files
TAIL-V: Show file name before displaying files
TAIL–F: Dynamic display of n-line content at the end of a file press CTRL + C to terminate the display
mkdir command
mkdir [Options] [file name]
Mkdir–p: Ensuring the existence of directory names
rmdir [Options] [directory name]
RmDir: Delete Empty directory
Rmdir–p: When a subdirectory is deleted and then made empty, it is deleted
Touch command
touch [Options] File 1 [File 2]
Change the file's time record to be the same as Install.log
RM command
RM [Options] [file name or directory]
Rm–i: Ask for confirmation before deleting
Rm–f: Even if the source file makes read-only, it is also deleted directly, do not need to ask each
rm–f–f*: Delete all files beginning with F
CD command
CD file name: Enter the folder
Cd ~: Current User home Directory
Cd.. Return to the previous layer:
PWD command
Show current user and working directory
CP command
CP [Options] [source file or directory] [destination file or directory]
Cp–r: Recursive continuous replication for directory replication behavior
Cp–f: Forced replication
Find cmin–n: Files read in the last few minutes
Find–ctime-n: Files read in the past few days
Find-name Name: Find file names that match name
Find–size: Search by File size
find-printf: Display files on standard output devices
find-cnewer [FileName]: file that is newer than [file name]
Find–type–f: Find files of a generic type
Find-mount: Checking and specifying directories under the same file system file
Find–ls: Detailed listing of the files you are looking for
Locate *.cfg: Find all. cfg files
LOCATE-H: Display auxiliary information
WC command
wc-c [Options] [filename]: Show file size
wc–m [Options] [filename]: Number of statistical strings
wc-l [Options] [filename]: Number of rows in the statistics file
Sort–u: Show non-repeating content
Sort–r: Reverse Sort
Clear: Perform a clear screen
Cat [file name] | TR "ABC" "XYZ": Replace related letters in standard output content
Tr ' A-Z ' A-Z ' < kong.txt: capitalization of standard input lowercase letters
Tar Package compressed file
Gzip format compression
Decompression hour compression frequency
Linux Common Commands