1.touch
- Command name: touch
- The path then the command: / bin / touch
- Execute permissions: All users
- Description: Create an empty file
touch [文件名]
useCreate an empty file touch。
Plus the file name directly
Absolute path to the file name
2.cat
- Command name: cat
- The path then the command: / bin / cat
- Execute permissions: All users
- Description: The file contents
cat [-n] [文件名]
You can not open the file, view the file contents directly. To ensure that no changes to the contents of the file after we read the contents of the file.
2.1 -n
When you can view filesAdd line numbersTo prevent errors.
3.tac
- Command name: tac
- Command then the path: / usr / bin / tac
- Execute permissions: All users
- Description: The file contents (reverse display)
tac [文件名]
The documents show the tail to the head。
tac command without the -n parameter a。
4.more
- Command name: more
- The path then the command: / bin / more
- Execute permissions: All users
- Description: page display file contents
more [文件名]
If aExcessive content of the document is too longWe order not to miss the content, usemore command to view the page。
You can use the followingOptionsoperating:
- (Spaces) or f: page
- (Enter): Wrap
- q or Q: quit
Note : more command displays the contents,Can only be turned down, not like the turn。
5.less
- Command name: less
- Command then the path: / usr / bin / less
- Execute permissions: All users
- Description: page display file contents (available page up)
less [文件名]
This command is compared with the moreThere are page-up function。
You can use the followingOptionsoperating:
- (Space) or f: Down
- PgUp: Page Up
- (Arrow): up linefeed
- (The Enter) or (down arrow): Down linefeed
Note : You can alsoQueries specific content
/service[关键内容]
You can use the followingOptionssearch for:
- n: next match downwardly
Note : less exit no marks on the character device.
6.head
- Command name: head
- Command then the path: / usr / bin / head
- Execute permissions: All users
- Description: display the first few lines of the file
head [-n] [文件名]
can useDigital parameter -n +A few lines before, decided to see if that is not followed by -nDefault View first 10 rows。
Displays the first 5 lines
7.tail
- Command name: tail
- Command then the path: / usr / bin / tail
- Execute permissions: All users
- After the show a few lines of the file: Functional Description
tail [-n/-f] [文件名]
Back from the front display articleAfter a few lines specified, Without -n10 default Line。
After 5 lines
Note : tail can dynamically update the end of the content of the article, as a kind of file can monitor.
After we open a new terminal, new content written to the file, the file will automatically find tail 10 lines with the new.