Beginners will be Linux command - file to view articles

Beginners will be Linux command - file to view articles

Text Keywords: Linux, commonly used commands, file viewing

  • cat: view the file contents
  • more: Paging view the file contents, flip down
  • less: page view file contents can be repeatedly turned back
  • head: Check the file header
  • Tail view the contents of the file: tail
  • wc: line displays the file, word and byte statistics
  • grep: find keywords and print matching lines
  • echo: a line of the specified text

A, cat

View the file contents

  • Usage: cat [option] [file]
    • -b: display the line number, blank line does not display line numbers
    • -n: display the line number, including blank lines

Beginners will be Linux command - file to view articles

Two, more

Paged view file contents, view the next by a space, see the next line by a carriage return, q to exit View

  • Usage: more [options] [file]
    • -d: display a message, otherwise you will hear a tone
    • -s: encountered more than two lines of blank rows merge, improve reading efficiency
    • + Num: num from the first line began to show
    • -num: it sets the number of rows displayed per page
    • + / Pattern: before displaying search pattern string, and then displayed from the vicinity of the position
  • After entering reading mode
    • ENTER: 1 turn-down line
    • Space: Scroll down one screen
    • Ctrl + B: return to the previous screen
    • =: The output line number of the current row
    • q: quit

Beginners will be Linux command - file to view articles

Beginners will be Linux command - file to view articles

Beginners will be Linux command - file to view articles

Three, less

Paged view file contents, view the next by a space, up and down arrow keys to turn back, q to exit View

  • Usage: less [options] [file]
    • -e: After the end of the file is displayed automatically leave
    • -N: display the line number for each line
  • After entering reading mode
    • Enter: scroll one line
    • Space: Scroll one page
    • / String: Find specify the content down
    • ? String: Specifies the content to find up
    • b: Backward one
    • d: half a page Backward
    • q: quit

Beginners will be Linux command - file to view articles

Four, head

Check the contents of the file header, before the default 10-line display

  • Usage: head [options] [file]
    • -c nK: displays the contents of the file before the nKB
    • -n: display the contents of the file before n rows

Beginners will be Linux command - file to view articles

Five, tail

Tail view the contents of the file, the default display at the end of the line 10

  • Usage: tail [options] [file]
    • -c nK: displays the contents of the file at the end of nKB
    • -n: display the contents of the file at the end of the line n
    • -f: dynamic display file contents (continue reading end of the content), press Ctrl + C key combination to quit

Beginners will be Linux command - file to view articles

Six, wc

, Word and byte statistics show file

  • Usage: wc [options] [file]
    • -c: Displays the file byte statistics
    • -l: Displays the file number of lines statistics
    • -w: display a word document statistics

Beginners will be Linux command - file to view articles

Seven, grep

Find keywords and print matching lines

  • Usage: grep [options] pattern matching [file]
    • -i: ignore case
    • -v: invert match
    • -w: matching words
    • --color: color display

Beginners will be Linux command - file to view articles

Eight, echo

A line of the specified text

  • Usage: echo [options] [string]
    • -n: Do not change the output line (after the default echo output content will wrap)
    • -e: Support the beginning of the backslash escape character, shielding original meaning of the character following the backslash
\\ 反斜线
\a 报警器
\b 退格键
\f 输入表单格式,换行后保留光标位置
\n 换行
\t 生成水平Tab
\v 生成垂直Tab

Beginners will be Linux command - file to view articles

Guess you like

Origin blog.51cto.com/10984944/2454927
Recommended