Command:
(1) File system related
Directory Management
File Management
File View
File editing
(2) System Management related
Directory-related commands:
Current directory or working directory
Home directory: Home
Root:/root
Normal User:/home/username
~: User's home directory
Cd:
CD or CD ~: Back to the current user's home directory
CD ~username: Switch to the home directory of the specified user
CD-: Switch back and forth between the previous directory and the current directory
.: Root Directory
.. : Top level Directory
Related environment variables:
PWD: The current directory path is saved
OLDPWD: Last directory path
PWD: Show current directory
Ls:list
Displays a list of files under the specified path
ls [OPTION] ... [DIR] ...
-A,--all: Displays all files, including hidden files
-L: Long format
-rw-r--r--1 root root 44800 14:32 Install.log
-rw-r--r--:
Leftmost first bit: file type
-, D, L, B, C, p, s
9 bits in the back: access rights, Perm
Number: Number of times a file has been hard linked
Left Root: Owner of File
Right root: Group of files
44800: Size of File
14 14:32: Last modified time for a file
Install.log: File name
-H,--human-readable: unit conversion
-D: Displays the relevant properties of the directory itself, typically with-l
-R,--reverse: Reverse Display
-R,--recursive: recursive
mkdir [Options]/path/to/somewhere
-P: exists in no error, and can automatically create the required directories
-V: Show more information
-M MODE: Specify permissions directly when creating a directory
Tree
-D: Show only directories
-L Level: Specifies the number of levels to display
-P Pattern: Displays only the paths that are matched by the specified pattern
RmDir: Delete Empty directory
rmdir [OPTION] ... DIRECTORY ...
-V: Display process;
File Management:
Copy command: CP
CP [OPTION] ... [-T] SOURCE DEST
CP [OPTION] ... SOURCE ... DIRECTORY
CP [OPTION] ...-t DIRECTORY SOURCE ...
CP SRC DEST
SRC is a file:
If the target does not exist: Create a new dest and populate the SRC content into dest
If the directory exists:
If Dest is a file: overwrites the content in SRC to dest
We recommend that you use the-i option for the CP command
If Dest is a directory: Create a new file with the same name as the original file under Dest and populate the contents of SRC with the new file
CP SRC ... DEST
Src... : Multiple Files
Dest must exist and be directory, other situations will be error
CP SRC DEST
SRC is the directory:
Use option at this time:-R
If Dest does not exist: creates the specified directory and copies all files in the SRC directory to dest
If dest exists:
If Dest is a file: Error
If Dest is a directory: Copy all files in src directory to dest
Common options:
-I: Interactive
-R,-r: recursively replicate directories and all internal content
-A: Archive, equivalent to-DR--preserv=all
-d:--no-dereference--preserv=links
--preserv[=attr_list]
mode, ownership, timestamp, links, xattr, context, all
-P:--preserv=mode,ownership,timestamp
-V:--verbose
-F:--force
Mv:move, moving files
MV [OPTION] ... [-T] SOURCE DEST
MV [OPTION] ... SOURCE ... DIRECTORY
MV [OPTION] ...-t DIRECTORY SOURCE ...
Common options:
-I: Interactive
-F: Mandatory
Rm:remove, deleting
RM [OPTION] ... FILE ...
Common options:
-I: Interactive
-F: Force delete
-R: Recursive
Text File View Class command:
Cat, TAC
More
More [OPTIONS ...] FILE ...
-D: Show page flipping and exit tips
Less
Less [OPTIONS ...] FILE ...
Head
Head [OPTION] ... [FILE] ...
-C #: Specify get before # bytes
-N #: Specifies the first # line to get
Tail
tail [OPTION] ... [FILE] ...
-C #: Specifies the # bytes after fetching
-N #: Specifies the # line after fetch
-F: Trace displays new additions to the file
Time Stamp management tool for files:
File: metadata, data
View file Status: Stat
Three time stamps:
Access time: Atime, reading the contents of a file
Modify Time: Modified, Mtime, change file contents (data)
Change time: Changing times, ctime, meta data changes
Touch command:
Touch [OPTION] ... FILE ...
-a:only Atime
-m:only Mtime
-T STAMP:
[[Cc]yy] MMDDHHMM[.SS]
-C: If the file does not exist, it is not created
Text Processing tools: WC, cut, sort, uniq
WC command:
WC [OPTION] ... [FILE] ...
-l:lines
-w:words
-c:characters
Cut command:
Cut [OPTION] ... [FILE] ...
-D DELIMITER: Indicates delimiter
-F Fileds:
#: Section # Fields
#,#[,#]: Discrete multiple fields, such as 1,3,6
#-#: Multiple consecutive fields, such as 1-6
Mixed use: 1-3,7
--output-delimiter=string
Sort command:
Sort [OPTION] ... [FILE] ...
-F: Ignore character case
-R: Reverse order
-T DELIMITER: Field delimiter
-K #: Sort the specified fields as standard
-N: Sorting by numeric size
-u:uniq, sort after go heavy
Uniq command:
Uniq [OPTION] ... [FILE] ...
-C: Shows the number of occurrences per line
-D: Show only rows that have been repeated
-U: Show only rows that have not been duplicated
Note: Repeat for continuous and identical sides
System Management Related commands:
Shutdown:
Halt, Poweroff, shutdown, init 0
Restart:
Reboot, shutdown, init 6
Associated with User login:
Who, WhoAmI, W
Shutdown or restart:
Halt, Poweroff: Turn off the machine
Reboot: Restart
-F: Force, do not call shutdown
-P: Power off
Shutdown
shutdown [OPTION] ... Time [MESSAGE]
-r:reboot
-h:halt
-c:cancel
Time:
Now: Immediately
+m: Relative time notation, how long after the start of the command submission; for example, +3
HH:MM: Absolute time indication, specify time
User login Information View command:
WHOAMI: Displays the currently logged in active user
Who: All current logon sessions for the system
W: All current logon sessions and actions made by the system
This article is from the "Ricky Technology Blog" blog, make sure to keep this source http://r1cky.blog.51cto.com/10646564/1773852
Linux basic commands