File processing (create, view)

1, touch command:
create a file (add a space creates two files):

 

 (1) wanted to create a file named myfile, but due to the added space reasons, the name of the file into two (creates two files), it is not recommended to add spaces in the file name.

After quotation marks can solve this problem:

 

 (2) In Linux, the file extension is not valid, that has nothing to do with the file extension of the file type.

2, cat command:

(1) view the file contents:

(2) add line numbers:

 

 3, more command:

(1) more / etc / services command:

 

 (1) When the enter key can be displayed page, to avoid fleeting cat command.

(2) q to quit.

4, tac command:

Achieve reverse order output:

 

 5, less command:

(1) perform less / etc / services command:

 

 Page up and down keys may be implemented by line by line, pageup pagedown and page flipping, enter key page line by line.

(2) keyword search:

 

 In the following beginning with / enter a search keyword may be read by n, a keyword has been marked.

6, head command:

(1) 7 line before viewing the file:

 

 (2) is not specified, the default display line 10:

 

 7, tail command:

(1) 7 line to see the end of the file:

 

 (2) end of the line 10 the default file is displayed in the case:

 

 (3) tail -f can dynamically monitor log files, as long as the file content changes can be seen immediately.

 

Guess you like

Origin www.cnblogs.com/zhai1997/p/11789960.html