A. Linux common Commands
mkdir dirname New Folder
CD ~ Go to your home directory
CD dirname into the directory named dirname;
• Displays the file and folder names under the current folder;
Myrm filename to delete the file named filename;
Myrm–r dirname Delete name dirname directory; (related to folder with parameter-R)
MV filename1 filename2 Renaming the file 1 to file 2;
MV Filename1 dirname to move the file 1 to dirname;
CP filename1 filename2 File 2 is a backup of file 1;
CP filename1 dirname Copy the file 1 to the specified directory;
wc–l filename View the number of rows in a file
PWD View the full path of the current directory;
head-100 filename to view the first 100 lines of the specified file;
tail-100 filename View the following 100 lines of the development file
grep word filename to view the word entry in the file;
Grep–n Word filename To view the word's entry in the file and display the line number;
grep "\<word\>" filename to view the entries in the file that are equal to Word;
grep Word FileName | head-100 See the word in the file, give the first 100 entries;
| called pipe command, note | The parameter condition of the command after
The contents of document 1, document 2 and document 3 are added to Filename4, and the original content in Filename4 is not retained;
Cat filename1 filename2 Filename3>filename4
Append the contents of file 1, file 2, file 3 file four to Filename4, and retain the original contents of Filename4;
Cat filename1 filename2 Filename3>>filename4
Vim A.txt Open a file that already exists;
: Set NU displays line number;
: Set Nonu cancel line number;
GG moves to the first line of the file;
G moves to the last line of the file;
: (58G) moves the cursor to line 58th;
10→ move 10 characters to the right;
The home key cursor moves to the beginning of the line;
The end key cursor moves to the end of the line;
/word down looking for a string called word;
? Word looks up for a string called word;
N (Do not need to enter) to repeat the previous search;
DD deletes the entire line of the cursor;
NDD removes the downward n-line (with the line of the cursor) where the cursor is located;
YY Copy the cursor in a whole line;
Nyy the next n line where the cursor is copied (with the row of the cursor);
P Paste the copied data on the next line of the cursor;
U restore the previous operation;
Ctrl+r redo the previous operation;
Vim b.txt new file;
I enter the edit mode ("Insert" in the lower left corner);
ESC exits edit mode;
: w Save the edited data;
: Q Exits.
: Wq save exit.
: q! Modified files, do not want to store, forced to leave without saving the file.
A. Linux common Commands
mkdir dirname New Folder
CD ~ Go to your home directory
CD dirname into the directory named dirname;
• Displays the file and folder names under the current folder;
RM filename Deletes the file named filename;
Rm–r dirname Delete the name dirname directory;
MV filename1 filename2 Renaming the file 1 to file 2;
MV Filename1 dirname to move the file 1 to dirname;
CP filename1 filename2 File 2 is a backup of file 1;
CP filename1 dirname Copy the file 1 to the specified directory;
wc–l filename View the number of rows in a file
PWD View the full path of the current directory;
head-100 filename to view the first 100 lines of the specified file;
grep word filename to view the word entry in the file;
Grep–n Word filename To view the word's entry in the file and display the line number;
grep "\<word\>" filename to view the entries in the file that are equal to Word;
grep Word FileName | head-100 See the word in the file, give the first 100 entries;
CUT–F1 filename; Obtain the specified column of the file;
[Job Requirements]linux common commands and vim common commands