Linux's basic command - File Viewer

cat (Connection File and Print)

  • -n: starting from number 1 to number of lines for all outputs.
  • -b: -n and similar, but not number blank lines.
  • -s: When faced with more than two consecutive lines of blank lines, one line on the blank line substitution.
  • CAT A b               View A b two files
  • CAT - n- a > b         will be a content file with line numbers, inputted to the b file
  • CAT A B >> c         The A B is incorporated into the file c,
  • CAT / dev / null > a     clear a file content

more (display file contents page by page, the spacebar to flip, b Back key)

  • -num a number of rows displayed
  • + Num num began to show from the first row
  • -f calculating the number of rows, the number of rows in fact, rather than after the number of lines automatically wrap (some words long single line will be extended to more than two lines or two lines) 
  • -s when faced with more than two consecutive blank lines, one line on the blank line substitution
  • More - S AAA     Press page displays document content, if two or more consecutive blank lines blank line display line places
  • More + 20 aaa     from the document's beginning to show the contents of 20 lines
  • More - 20 aaa     a display 20 lines of the document content

less (and more similar, more powerful than more)

  • -g flag only last keyword search
  • -I ignore case when searching
  • -m shows the percentage is similar to the more command
  • -N display line numbers for each line
  • -s display a continuous line empty behavior
  • / String: function down search
  • ? String: the ability to search up
  • n: repetition before a search
  • N: inverted repeat a search before
  • b back down one page
  • d Half-page Backward
  • Q to exit the less command
  • u Scroll half a page forward
  • y Scroll forward one row
  • Spacebar to scroll one line
  • Enter key Scroll one page
  • [Pagedown]: Scroll down a
  • [Pageup]: flipping up a
  • less catalina the .out     by viewing less Tomcat's log
  • PS - EF | less      to see the process through less Paged view

head (see the beginning of the file contents)

  • -N number of lines to display file
  • head - 5 Catalina . out     display Catalina . before out of five lines

tail or tailf (end view file contents)

  • tail end of the file is mainly used for dynamic viewing content, such as: view the log.
  • -f Dynamic View
  • tailf catalina . OUT      dynamic view tomcat log file (tailf)
  • tail - 200f catalina . OUT      final print file after 200 lines, dynamic view tomcat log file.

Guess you like

Origin www.cnblogs.com/wuzm/p/10991676.html