viewing file paths
- Ls/path1/path2/filename----------------------Show full path
- Dirname/path1/path2/filename-------------Show only the folder path of FileName
- Basename/path1/path2/filename-----------Show Only FileName
View text files--cat, TAC, NL, more, less, tail, head ... Cat:
- Start from the first line, until the last line
- Cat-n xx.txt--Display line number
- Cat--help
Tac
- Start display from the last line until the beginning of the file
nl
- Displays from the first line, until the last row, and with the line number displayed
- When there is a blank line in the file, the number of rows is slightly too blank
- The blank line is also displayed with a line number, Nl-b Xx.txt
[[email protected] etc]# cat-n rsyslog.conf//Show All line numbers (including blank lines) [[email protected] etc]# cat-b rsyslog.conf//Display all line numbers (but not blank lines) or : [[email protected] etc]# Nl-ba rsyslog.conf//Show All line numbers (including blank lines) [[email protected] etc]# NL-BT rsyslog.conf//Show All line numbers (but not empty lines) Or: [[email protected] etc]# less-n rsyslog.conf//Display all line numbers (including blank lines) Cat options:-n Displays line numbers (including blank lines)-B displays line numbers (excluding blank lines) NL options: The display of the-B row//Line display There are two ways, a means displaying all rows (including blank lines), and t means displaying all non-blank rows (excluding blank lines), i.e.:-BA//Display all line numbers (including blank lines)-BT//Display all line numbers (but not blank lines) VI xx
MORE: Split screen display
- Press ENTER to display a line
- Press space, split screen display
- Disadvantage: can only page back, not forward
- Also supports keyword search/xxx n--top-down, n--bottom-up
- Exit More:ctrl+c
Less: Split-screen display, more powerful than more
- Press ENTER to display a line
- Press space, split screen display
- Also supports keyword search/xxx n--top-down, n--bottom-up
- pagedown--PAGE Down
- pageup--Page Forward
- Home key--go directly to the beginning of the file
- End key--directly to the end of the file
- Exit Less: Direct Q can
Head: View the first 10 lines of the file by default
- Head-n aa.txt: View the first 100 lines of the Aa.txt file
- head-100 aa.txt: View the first 100 lines of the Aa.txt file
Tail: The last 10 lines of the file are viewed by default
- Tail-n aa.txt: View the last 100 lines of the Aa.txt file
- tail-100 aa.txt: View the last 100 lines of the Aa.txt file
- Tail-f -100 aa.txt: Convenient monitoring log log,-f will always be displayed on the screen, press CTRL + C to exit '
- Tail-f = = Tailf
Touch: Time to create or modify a file
- Touch Aa.txt--if aa.txt does not exist, create
- Touch Aa.txt-If aa.txt exists, modify the file creation time to the current time and the current time
- Touch-t 201607061014 Aa.txt--Specify the Aa.txt file creation time as July 6, 2016 10 o'clock 14
OD: View non-text files
- Od-t c/bin/ls (t:type c:ascii code form)
- Strings/bin/ls
Text File View and creation