Linux Common commands
1.echo: Output a line of text
-N: Output but no line break
-e: The escape sequence referenced by ' \ ' takes effect
2.cd
The shell provides two variables
PWD: Current Working directory
OLDPWD: Previous working directory
You can use CD$OLDPWD to jump to the previous working directory
CD ~username, switch The working directory to the home of the specified user "USERNAME", limited to the root user
cd~, switch working directory to home directory
cd-, equivalent to cd$oldpwd
3.pwd:
-L, print the value of the $PWD variable (by default, the behavior of ' PWD ' is consistent with the '-l ' option)
-p, prints the current physical path without any symbolic links (similar to shortcuts)
4.ls: list all files in the current directory
The contents of the directory are file names, with size
-A,--all: Show All items
-A,--Almost-all: except "." and ".." All files except the
-H, displayed as a more readable format when displaying file sizes, usually with-l
-L, there are special properties for device files, no size
Main device number: Identifies the type of device, and then determines what driver needs to be loaded
Secondary device number: Used to identify different devices in the same device type
The device number uses the 8-bit binary identifier by default, so the default device number range is 0-255
-Z to display the SELinux security context label for the file
5.mkdir: Create a directory
-P, created with the parent directory when creating the directory
6.RM: Delete Files
-F: Force delete
-r,-r: Recursively delete directories and contents in a directory
7.touch: Modify the timestamp of a file and also the ability to create a file
-c,--no-create: Do not create any files
-A, only modify the file's access timestamp
-M, modify only the file's modified timestamp
-T, replacing the timestamp of the file with the specified stamp, the stamp format is [[CC]YY]MMDDHHMM[.SS]
8.stat: Show the status of a file or file system
-c,--format=format: Displays the specified state property of a file in the specified format
9.nano: Full Screen Editing tool in text mode
^: de-Char, which represents the CTRL key
10.cat: connection file and display in standard output, output to display: Standard output
-b,--number-nonblank: Numbering output for non-blank lines
-N, number output for all lines
-s,--squeeze-blank: Merge Duplicate blank lines
-e,--show-ends: At the end with $ display
Line: Whether to wrap with the ENTER key
TAC, Reverse display
Note: If the cat or TAC does not give the parameter, then all the content needs to be done through the standard input, use "^c" or "^d" to exit after completion.
11.head: the starting portion of the output file, showing the first 10 rows by default
-c,--bytes=[-]k: Displays the content of the corresponding length in bytes
-n,--lines=[-]k: Displays the content of the corresponding length in the behavior unit
can use-#方式替换-N #
12.tail: the final part of the output file, showing the last ten lines by default
-C, same head
-N, same head
-f,--follow[={name|descriptor}]: Monitor changes at the end of the file
13.more: page display of document content, filtering
Through "/" (top-down) or "?" (Top-down) lookup filtering based on subsequent string combinations, and "n" and "n" to find the next
Use "Q" to exit more mode
Use carriage return to flip a line down
Use the space key to turn down one page
14.less: Same as more, but can be used down ARROW to page
Date and time-related commands:
15.date: Operating system time, referred to as the system time; clock recording time using software simulation
-s,--set=string: Set the system time to the specified time
Two types of formats:
1) MMDDHHMM[[CC]YY][.SS]
2) "Ccyy-mm-dd HH:mm:ss" or "Ccyy/mm/dd HH:mm:ss"
+format:
%F: Represents the full date format, i.e.: YY-MM-DD
%T: Represents the complete time division seconds format, i.e.: HH:MM:SS
%Y: Represents the full year
%m: Month
%d: Date
%H: Hours
%M: Minutes
%s: Seconds
%s:1970 January 1 as the Year of Unix; from 1970-01-01 00:00:00 to the current time system time the number of seconds experienced
This timestamp is represented by a 32-bit 2 binary number
16.clock/hwclock
-s,-hctosys: Set the system time according to the hardware clock
-W,-SYSTOHC: Hardware clock is also set according to system time (not recommended)
17.cal: Show Calendar
18.CP: Copy
Cp[option] ... [T] SOURCE DEST: unit copy
Cp[option] ... SOURCE ... DIRECTORY: Multiple replication
Attention:
1) The CP command must be connected to at least two parameters
2) The last parameter, usually the target of this copy
3) If the target given at the time of copying is the directory, copy and rename the file directly to the specified directory, preserving the source file name, and if the target is a non-directory file when copying a non-directory file, the operation is copied and renamed
CP command cannot copy directory by default
-r,-r,--recuisive: Recursive copy of directory files
-D, when you save the link and the copied file is a symbolic link file, this option preserves the symbolic link file as the source file is copied, and does not copy the file that the symbolic link file points to
-P, the permission bits, ownership, and timestamp properties in the copy source file are preserved
-A, equivalent to a combination of-DPR
-F, force copy, like make it effective need to add "\" before CP
19.MV: Mobile
-F, move files and force overwrite
-N, the same name does not move
Linux Common Command collation