Overview
Linux commands have a lot of
Part I:Linux Directory Management class commands
Directory Management class Commands:
mkdir, RmDir, tree, DirName, basename
(1) mkdir command:
Role: Used to create a directory in Linux.
Format: mkdir [options] Path
Parameters:
-P: Create parent Directory
-V: Show creation process
Usage Note: When creating a directory using mkdir, you need to make sure that your account has permission to write, and that the name of the directory you create does not exist or has duplicate names under the created path.
Example:
Practice:
How to create a directory: X_m, X_n, Y_m, Y_n?
(2) rmdir command:
Rmdir/path/to/somewhere
Delete empty directory;
(3) Tree command:
tree [OPTION] ... [DIR]
-D: File of only hierarchical directory type;
-L Level: shows only a few levels;
(4) dirname command:
(5) basename command:
Part II:Linux text File View commands
Text File View command:
Cat, TAC, more, less, tail, head
(1) Cat command:
(2) TAC command:
(3) More commands:
More, less
Flip screen view;
More [OPTIONS] ... FILE ...
-D: Display page with Exit prompt
Space: one screen backward;
Enter: one line backward;
B: one screen ahead;
(4) Less command:
Less [OPTION] ... FILE ...
Text Search:
/keyword
? KEYWORD
N: Next with the same direction as the command;
N: The previous one in the opposite direction of the command;
(5) Tail command:
tail [OPTION] ... FILE
Special options for Tail:
-f:follow
-N #
-#
-C #: Show pre/Post # bytes
(6) head command:
Head [OPTION] ... FILE
Part III:Linux timestamp management tools
Time Stamp management tool: Touch
Each file has three timestamps:
Atime: The last time the file was visited;
Mtime: The last time the file was "modified";
CTime: The time the file was last "changed";
File data:
Metadata
Data
Touch [OPTION] ... FILE ...
Update timestamp to current time;
-A: Update only atime
-M: Update only Mtime
-T STAMP:
[[Cc]yy] MMDDHHMM[.SS]
-C: Do not create empty files
Part IV:Linux file Management commands
File Management commands:
CP, MV, RM
(1) CP command:
CP [OPTION] ... [-T] SOURCE DEST
CP [OPTION] ... SOURCE ... DIRECTORY
CP [OPTION] ...-t DIRECTORY SOURCE ...
CP SRC DEST:
src is a file:
If Dest does not exist: Creates a new target file and copies the SRC to the target file;
if dest exists:
If Dest is a file: Use src content to overwrite the dest file;
If Dest is a directory: in the Dest directory, a new file with the same name as the original file, the SRC content is copied to the new target file with the same name;
CP SRC ... DEST:
If Dest does not exist:
is wrong;
if dest exists:
If Dest is a file: error;
If Dest is a directory:
Common options:
-R,-r: Recursive replication;
-D: Do not track symbolic links;
--preserve[=attr_list]:
mode, ownership, timestamps
Context, links, xattr, all
-A:-dr--preseve=all
-i:interactive
-f:force
-V: Display procedure
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
rm [OPTION] ... FILE ...
delete files only;
Common options:
-r:
-F:
-I.:
Part V:Linux file processing tools
File processing tools:
WC, cut, sort, uniq
Wc:word counts
WC [OPTION] ... FILE ...
-L: Shows the number of rows
-W: Displays the number of words
Cut
Cut OPTION ... [FILE] ...
-D: Indicates delimiter;-D ",-D:
-F: Indicates the field to display
#:
#-#:1-3
#,#: 1,3,7
Sort command: Sort
Sort [OPTION] ... [FILE] ...
-R: Reverse order
-F: Ignore character case
-U: Go back after sorting
-T CHAR: Indicates delimiter
-K #: Field
-N: means sort by numeric size
Uniq command:
Uniq [OPTION] ... [FILE] ...
-C: Shows the number of repetitions per line;
-D: Displays only the rows that have been repeated;
-U: Displays only rows that have not been duplicated;
This article is from "I take fleeting chaos" blog, please be sure to keep this source http://tasnrh.blog.51cto.com/4141731/1687744
20150823-linux Common Commands