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 common CentOS commands related to organizing files?

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

Share

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

In this issue, the editor will bring you what are the common CentOS commands related to organizing documents. The article is rich in content and analyzes and describes for you from a professional point of view. I hope you can get something after reading this article.

Next, let's learn about the common CentOS commands about file operations.

Common CentOS commands for creating / changing file systems

NO1. Create a file system type

[root@rehat root] # umount / dev/sdb1

[root@rehat root] # mkfs-t ext3 / dev/db1

[root@rehat root] # mount / dev/sdb1 / practice

Common CentOS commands for changing file or folder permissions

Chmod

NO1. Set your notes so that only you can read them.

[root@rehat root] # chmod go-rwx test.txt

Or

[root@rehat root] # chmod 700 test.txt

NO2. Modify permissions for multiple files at the same time

[root@rehat root] # chmod 700 test1.txt test2.txt

NO3. Modify the permissions of a directory, including its subdirectories and files

[root@rehat root] # chmod 700R test

Change the CentOS common commands of the owner of a file or folder

Chown this command can only be used by root

NO1. Change the owner of a file

[root@rehat root] # chown jim:usergroup test.txt

NO2. Change the owner of a directory and include subdirectories

[root@rehat root] # chown jim:usergroup-R test

Common CentOS commands for viewing the contents of a text file

Cat

NO1. View the contents of the file and precede each line with a line number

[root@rehat root] # cat-n test.txt

NO2. View the contents of the file and add a line number before it is not a blank line

[root@rehat root] # cat-b test.txt

NO3. Merge the contents of two files

[root@rehat root] # cat test1.txt test2.txt > test_new.txt

NO4. Merge the contents of two files and retrieve one file

[root@rehat root] # cat test1.txt test2.txt > > test_total.txt

NO5. Empty the contents of a file

[root@rehat root] # cat / dev/null > test.txt

NO6. Create a new file

[root@rehat root] # cat > new.txt Press CTRL + C to end entry

Common CentOS commands for editing file files

Vi

NO1. Create a new file

[root@rehat root] # vi newfile.txt

NO2. Modify archival file

[root@rehat root] # vi test.txt test.txt already exists

NO3. Two working modes of vi: command mode and editing mode

NO4. Enter vi into command mode, press Insrt to enter edit mode

Press ESC to enter command mode. You cannot edit it in command mode. You can only enter commands.

NO5. Command mode common commands

W save the current document

: Q exit vi directly

Wq saves and then exits.

This is the common CentOS command about files.

These are the common CentOS commands that Xiaobian shared with you related to organizing documents. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are 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