CentOS common commands for viewing and editing files

藏色散人
Release: 2021-02-19 17:44:50
forward
4517 people have browsed it

The following tutorial column of centos will introduce you to the commonly used CentOS commands to view and edit files. I hope it will be helpful to friends in need!

CentOS common commands for viewing and editing files

cat:

1.cat file Viewing files

2.cat file -A to view all files

3. cat file -b to view non-blank lines and output line numbers

4. cat file -n to view all lines to output line numbers

5. cat file -s does not output multiple blank lines

vi:

1. vi file enters the file

2. Press [i] to enter insert mode. You can edit

3. Press [o] to insert a carriage return at the cursor and then edit

4. Press [x] to delete a character to the right of the cursor

5. Press [r] to replace the character where the cursor is.

6. [#dd] Delete the content from the current line to the # line (# represents a number)

7. [#yy 】Copy the characters in the line to

#5. Press ESC to exit the current mode

6. Press [:] to enter lastlinemode mode

Enter [q]: No Save and exit

Enter [wq]: Save and exit

Enter [q!]: Force exit (without saving)

Enter [wfilename]: Save as filename File

Enter [/]: search for characters

in the file

The above is the detailed content of CentOS common commands for viewing and editing files. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:cnblogs.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template