1.mkdir Create directory
Parameters:
-P recursion
Example: Mkdir/data (Create a directory named data)
Example: Mkdir-p/data/oldboy (continuous creation of data and Oldboy directories,-P option allows you to create multi-level catalogs at once )
2. LS View list
Parameters:
-l Use long list format
-D View Directory
-H readable file
Combination mode:
Example: Ls-ld +/directory name (view directory details)
Example: Ls-lh +/directory name (view details of all files in the directory)
3, CD Change directory path
Example: cd/data (switch to the data directory)
4. PWD Print current directory
Example: PWD (show current working path)
5. Touch Create file and update file timestamp if file exists only update timestamp
Options:
-A only changes the time of access
-M only modifies the modified time
Example: Touch 123.txt (Create 123.txt file)
Example: Touch-a 123.txt (modified 123.txt access time)
Example: Touch-m 123.txt (Modify only 123.txt time)
Date c to view the current computer's time
Parameters:
-S modifies the current computer's system time
Example: Date-s "2017-10-09 22:34:02" (Modify system time)
6, vi Editor
Example: VI 123.txt (enter 123.txt file can add or modify content)
How to use:
Execute VI 123.txt into the VI editor, press the A or I key to enter the editing mode, enter the required content such as: I am studying Linux. Then press the ESC key on your keyboard to exit edit mode and enter: Wq Save and exit (note W is save, Q is exit)
7, Vim more complex editor
8. Cat View File contents
Example: Cat 123.txt (Viewing the contents of a 123.txt file)
Example: Cat >123.txt (Create a 123.txt file directly after entering the desired content after ctrl+d save exit)
Example: Cat >>/data/123.txt<<eof
> A
> V
> b
> N
> EOF (cat >>/data/123.txt means to execute the cat command to find/data/123.txt in the output of the required content to the/data/123.txt file, where does the content come from? Content from the string (the EOF string must appear in pairs) after EOF content input into 123.txt inside)
9. Echo print output can be used with > or >> to overwrite and append the contents of the file.
Example: Echo "Woshilizi" >123.txt (Directly inside the "" input into the 123.txt file)
Tip:> This method clears the previous content
>> This method appends the content to the end of the file.
Example: Echo "Oldboy1" >>123.txt 2<&1 (input the correct content into the 123.txt and put the wrong command into the 123.txt record)
10. Xargs get content from standard input create and execute commands
Parameters:
-N 2 (-n addend Group)
Example: Xargs-n 2 <123.txt (with-n multiline output, 2 for each row output 2 arrays)
This article is from the "Sunny Linux Tour" blog, please be sure to keep this source http://6520736.blog.51cto.com/6510736/1971055
Linux Command Note 1