Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Linux commands for beginners-File View

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Linux commands for beginners-File View

Text keywords: Linux, frequently used commands, file viewing

Cat: view the contents of the file more: view the contents of the file by paging, flip down less: view the contents of the file by paging, head: view the header of the file tail: view the tail of the file wc: display the line, word and byte statistics of the file grep: find keywords and print matching lines echo: display a line of specified text 1, cat

View the contents of the file

Usage: cat [options] [file]-b: display line numbers, blank lines do not display line numbers-n: display line numbers, including blank lines

II. More

View the contents of the file in pages, view the next page through spaces, enter to view the next line, and Q to exit the view.

Usage: more [options] [file]-d: display the prompt message, otherwise you will only hear the tone-s: merge when you encounter more than two blank lines, improve reading efficiency + num: display from the num line-num: set the number of lines per page + / pattern: search for the pattern string before display Then enter enter after entering reading mode from near this position: turn down 1 line space: scroll down one screen Ctrl+B: return to the previous screen =: output the line number of the current line Q: exit

III. Less

View the contents of the file in pages, view the next page through the space, flip the arrow keys up and down, and Q exit the view.

Usage: less [option] [file]-e: leave automatically after the file is displayed-N: display the line number of each line and enter after reading mode: scroll one space: scroll one page / string: look down for the specified content? String: find the specified content up b: turn back one page d: turn back half a page Q: exit

IV. Head

View the high-quality content of the file. The first 10 lines are displayed by default.

Usage: head [options] [file]-c nK: display the contents of the nKB before the file-n: display the contents of the first n lines of the file

5. Tail

View the tail of the file. The last 10 lines are displayed by default.

Usage: tail [options] [file]-c nK: display the contents of the nKB at the end of the file-n: display the contents of the last n lines of the file-f: dynamically display the contents of the file (keep reading the last contents), press Ctrl+C to exit

VI. Wc

Display file, word and byte statistics

Usage: wc [options] [File]-c: display file byte statistics-l: display file line statistics-w: display file word statistics

7. Grep

Find keywords and print matching lines

Usage: grep [option] matching pattern [file]-I: ignore case-v: take inverse match-w: match word-- color: display color

VIII. Echo

Displays a line of specified text

Usage: echo [option] [string]-n: do not output newline (default echo output will break)-e: support escape characters at the beginning of the backslash, mask the original meaning of the characters after the backslash\ an alarm\ b backspace key\ f enter the form format, retain the cursor position after the line break\ t generate horizontal Tab\ v generate vertical Tab

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report