Common Good command of Linux programmers share - related operations documents

Common Good command of Linux programmers share - related operations documents

1, the user switching

su (switch user)

2, displays a list of files in the current directory

LS (List)
LS the -l
LS -a (All)
LL
LL -a
Linux inside, hidden files "." At the beginning

3, the directory operation

Change directory: cd (change directory)
displays the current directory: pwd (print working directory)
Create a directory: mkdir (the make directoriy)
-p Mr. parent directory to the parent directory is not the case (parents) exists
cp copy files or directories (Copy)
- r recursive processing, the file in the specified directory and subdirectories together copies (recursive This)
Music Videos move a file or directory, rename a file or directory (move)
rmdir remove empty directory (remove directoriy)
RM delete files (remove)
-R & lt deleted All files (recursive) in that directory
-f Force delete files or directories (force)
the average user when deleted, without any prompting
but super administrator when removed, will prompt

Supplementary points: cd ~ fast home directory

4, the document editing -VI, VIM (focus)

work flow chart:

Common Good command of Linux programmers share - related operations documents

Insert command parsing:

a: added after the current character text;
A: end of the line to add text;
I: Insert text prior to the current character;
the I: beginning of the line is inserted into the text;
O: Insert after the current line by a blank line;
O: inserted in front of the current row a blank line;

Shortcut command:

Positioning command

: Set number display line numbers
: set nonumber Cancel line number
: n to n-th row of text
gg to the first line of text
G to the last line of text

Delete command

x: delete a single character under the cursor
dd: delete the row

Undo command

u undo, cancel the previous operation
before the Ctrl + r redo, undo returns to

Copy command

yy+p

5, view the file contents and statistics

Create an empty file touch

Display file contents:

cat text file contents
more text paging file contents
less 
at the beginning or end of the content of the head, tail See text
first three rows head -n 3 java.txt file view java.txt

Wc statistics the number of lines of text, words, characters (word count)

-m statistics the number of characters of text
-w count the number of words recognized text space
-l statistics text lines

6, file merge and redirect

Incorporated with the output file, cat 1.txt 2.txt
merge files: cat 1.txt 2.txt> 3.txt
as a standard input,
CAT> 1.txt 
CAT >> 1.txt

This is a symbol to redirect the output of the
case: quickly emptied the contents of a file
using redirection way
1.txt

7, file search

find find the specified file in the file system,
find / usr / local / -name word.txt

8, decompressed file compression and packaging

Command At a Glance

gzip: compression (decompression), compressed file suffix GZ
Bzip2: compression (decompression), compressed file suffix is bz2
Tar: Packed file or directory

Command Detailed

Detailed gzip command: gzip [options] To compress (decompress) the file name

The compressed file -d (Decompress)
-l for the compressed file, display the compressed file size, the file size before compression, the compression ratio
-num with the specified number num adjusting the speed of compression, -1 or - -fast represents the fastest compression method (but low compression ratio),
-9 or --best slowest compression method (high compression ratio). The default value is 6

Detailed command bzip2: bzip2 [options] filenames

-d decompress
-z compression
-num Ibid.

Detailed Tar command: tar [options] package file name to be packed files to be packaged file 1 2

-c build a packaged file the Create
-x unlock a packed file Extract
the -z files compressed with gzip
-j bzip2 compressed file with the
process of displaying the compressed file -v
-f using the document name, and then immediately after the f file name

Case:

Realization of packing and unpacking files

To achieve the compression and decompression of files

gzip 1.txt file compression

gzip -d 1.txt.zip decompress files

tar -cf 33.tar 1.txt 2.txt // package file

tar -xf 33.tar // unpack files

gzip 33.tar // tar.gz compressed packed files

tar -zcf 33.tar.gz 1.txt 2.txt // will 1.txt and 2.txt packaged and compressed into 33.tar.gz

tar -zxf 33.tar.gz // 解 压缩 33.tar.gz

9, the pipe command

Format:

command1 | command2

For example:

the -l LS / usr / bin | less
LS the -l / usr / bin | grep less
standard output of one command can be piped to the standard input of another command:
grep is a very powerful program, used to find matching text file

Guess you like

Origin blog.51cto.com/14256902/2423566