Common commands: Cat, TAC, NL, more, less, head, tail, OD ...
First, directly view the contents of the file: Cat, TAC, NL <== All-in-one read
1. cat [-abentv] File name
Parameter description:
-N: Prints the travel number, along with a blank line number.
-B: Prints the travel number, but only blank lines are displayed.
-E: Displays the trailing newline character $.
-T: Displays [Tab] as ^t.
-V: Lists some special characters that are not visible.
-A: Equivalent to the-vet parameter.
2, TAC: The effect is opposite to cat, reverse display.
3, NL: Add line number printing.
Second, can flip view: more, less
1, more (one page to flip): for example, More/etc/man.config;
At the end there will be a cursor waiting for input:--more--(28%)
Keys that can be entered:
SPACEBAR: Turn down one page.
Enter key: Scrolls down one line.
/string: Queries the keyword "string" down.
: F <== immediately displays the file name and the number of rows currently displayed.
Q: Leave the more command now.
2, less (one page, one page turn, and more features, but more flexible than more): Less/etc/man.config
Keys that can be entered:
SPACEBAR: down one page.
PgDn: down one page.
PgUp: Up one page.
/string: Query "string" down.
? string: Query up.
N: Repeats the previous query.
N: Reverse repeats the previous query.
Q: Leave.
Third, data selection: Head, tail (in behavioral units)
1. Head [-N number]:
Head/etc/man.config; <== Displays the first 10 rows by default.
Head-n 20/etc/man.config;
Head-n -100/etc/man.config; <== displays all rows except the last 100 lines.
2, tail [-N number]:-N: The representative shows a few lines; -F: Indicates continuous detection of the new file content that follows.
Tail/etc/man.config; <== Displays the following 10 rows by default.
Tail-n 20/etc/man.config;
Tail-n +100/etc/man.config; <== displays all rows after 100 rows.
Tail-f/var/log/catalina.out;
Four, non-plain text files: od <== for binary files and so on.
od [-t TYPE] File
V. Modify the file time or create a new file: Touch
Understand the meaning of mtime (last modified time), CTime (state change time), Atime (time last Read).
1. Command format: Touch [-ACDMT] File
2. Parameter Description:
-A: Only the access time is modified.
-C: Modifies only the file's CTime and does not create a new file if the file does not exist.
-D: You can specify a date.
-M: Modifies only mtime.
-T: Time can be specified.
3. Example:
Touch test1; <== Create an empty file
touch-d "2 days Ago" test1; <== date adjusted to two days ago