A simple command
1, DATE : current time
2, CAL : current date (calendar format)
① CAL 2019 : 2019 full-year calendar
② CAL 1 2019 : 2019 Nian 1 Yuefen
Two, Linux file structure
1, the root directory ( "/" indicates a) root:
2, pwd : query the current folder location
. 3, CD / : Skip root directory (cd jump to directory)
4, LS : query file or files in the directory folder
① LS the -l : read detailed information about all the directory file or folder
The first letter is d is the folder, if it is - is the file.
5, the Clear : clear the screen
6, cd ../ : return to the parent directory
7, mkdir a : at the current location of a New Folder
8, rmdir a : delete a folder
9, cp a.txt b.txt : Copy a file renamed it b
10, CAT a.txt : view the file contents
. 11, the diff a.txt b.txt : Comparison a, b of the size of the two files, if no results are returned description of the same file.
12, head a.txt : view the first few lines of a file
① head a.txt -n 5 : 5 Pre View
13, tail a.txt : view the last few lines of a file
① tail -n a.txt 7 : View the last seven lines
14, WC a.txt (Word COUNT) the number of words to view the file:
55: The file has 55 lines
157: A total of 157 words
977: a 977-character
① WC -w a.txt : you can only see a total number of words
② WC the -l a.txt : you can only see a total of how many rows
③ WC -c a.txt : you can only see a total of how many characters
15, RM a.txt : delete a file
File with the rm command is completely removed, and be careful, because there is no linux trash qwq
16, mv : modify the file name; move files
① mv a.txt b.txt : the a.txt renamed b.txt
② mv a.txt t1 / : a.txt move the folder to t1
Linux is case sensitive, test and Test are two different folders oh.
17, less a.txt : the role of the file browser (press up and down to see the file, press Q to quit)
18, chmod : Modify read and write permissions
① chmod UR a.txt : get rid of the read access to the a.txt
r: read, w: write, x: executable, u: Author, g: group, o: Other
② chmod + r U a.txt : Author obtain read access to the a.txt
③ chmod-r a.txt Go : In addition to the author's other people can not read a.txt
④ chmod 444 a.txt : read-only for everyone
chmod permissions can also be operated by binary numbers:
r:4(100),w:2(010),x:1(001)
19, grep : search the contents of a text file
① grep void a.txt : a.txt whether there is a "void"
② grep OI a.txt : a.txt file contains the "oi" are displayed
20, the regular expression : can be used to search for files by content grep command
① grep l * a.txt : a.txt in "l" the letter appeared (* indicates that the letter can occur 0 times or many times, it does not appear l word will be output)
② grep LL * a.txt : a.txt in "l" the letter appears at least once
③ grep ^ V a.txt : a.txt to "V" at the beginning of
④ grep V.ID a.txt :. On behalf of any letter
⑤ grep [the Hh] ILL a.txt : [the Hh] indicates that the position is H or h
⑥ grep [A-Za-Z] ILL a.txt : [A-Za-Z] indicates that the position is arbitrary letter
21, command combinations
① grep [A-Za-z] ILL a.txt | WC: the searched content Counting words