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

What are the Fedora proc file system commands

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Editor to share with you what the Fedora proc file system commands, I believe most people do not know much, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Display file contents Fedora proc file system command: cat, more,less,head,tailcat command to view the file, because some text is too large, the text flashes quickly on the screen, the user can not see its contents clearly. This command can display one screen of text at a time. After the display is full, stop and print-MORE-. at the bottom of the terminal. To continue the display, press enter or Spacebar.

Form of use: cat [option] file name

-V:--show-nonprinting displays control characters in a special form, except for LFD and TAB

-n or-- number numbers all output lines starting with 1

-b or-- number-nonblank is similar to-n, except that blank lines are not numbered

When-s or-- squeeze-blank encounters blank lines with more than two consecutive lines, replace them with blank lines of one line

Here are some examples to take a look at

Each one displays the contents of the 51CTO.txt file on the screen. Add-A to show it together if the file contains special characters.

The third is to merge the contents of the two files and put them into the file beijin.txt. Then check the changes in its content.

More command

In the process of viewing the file, because some of the text is too large, the text flashes quickly on the screen, and the user cannot see its contents clearly. This command can display one screen of text at a time. After the display is full, stop and print-MORE-. at the bottom of the terminal. To continue the display, press enter or Spacebar.

Use format: more [options] file name

-P: clear the screen before displaying the next screen

-C: the effect is similar to that of-P

-d: more friendly prompts are displayed at the bottom of each screen.

-s: successive blank lines in the file are compressed into a blank line display

You can use this command to display the first file in the Fedora proc file system command line. If the file name is too large, a file in the file name list will be displayed.

If iRDP specifies more than one folder name on the command line, you can use some commands to display the penultimate file, or * * file if I is too large.

IRank f displays the file name and number of lines of the current file.

Here are a few examples:

Display the contents of the file in paging mode

Less command

This command is basically the same as the above function, except that the folder display allows the user to flip through the file both forward and backward, while the MORE command can only flip backward.

Command format: less file name

If you page through the TEST file, do the following:

# less test

If you flip backwards to use the "PAGE UP" on the keyboard. Use "PAGE DOWN" forward

Head command

This command displays only the first few lines of a file or standard input. If a user wants to see what is saved in a file, just look at the first few lines of the file without having to browse the whole file. You can use this command.

Format: head [n value] file name

Here are the first three lines of the display file. Take a look at the first 8 lines.

Tail command

Corresponding to the HEAD command function, use this command if you want to see the end of the file.

Format: tail [option] file name

+ num: displays after the num line

-num: the display starts at the end of the file. If the parameter is omitted, the default is 10

L: the count unit of the text behavior num. When used in conjunction with the parameter + num or-num option, num represents the number of lines of text to be displayed.

C: num in bytes. When used with the parameter + num or-num option, num represents the number of characters to display.

Example:

Displays the * * 8 lines of the file.

File content query command: grep,egrep,fgrep

The search pattern search file expressed by this set of Fedora proc file system commands informs the user what files to search for strings that match the specified pattern. The GREP command can only search one specified pattern at a time. The EGREP command retrieves extended regular expressions. FGREP command retrieves fixed strings and does not recognize regular expressions. It is a faster command to search the Fedora proc file system. Used to search for keywords contained in a file.

Format: grep [option] [find mode] [file name 1, file name 2pm.]

Egrep [options] [find mode] [filename 1, filename 2dint.]

Fgrep [options] [find mode] [filename 1, filename 2dint.]

Example:

Search for the string "redhat".

* A Fedora proc file system command searches for lines that contain the string "51CTO" in all files in the current directory.

The above is all the contents of the article "what are the Fedora proc file system commands?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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