Linux基础指令文件管理003

作者 : admin 本文共847个字,预计阅读时间需要3分钟 发布时间: 2024-06-10 共2人阅读

      本章讲述如何查看文件以及修改权限。

操作系统:

CentOS Stream 9

操作步骤:

查看文件:

指令cat

[root@localhost a]# cat 1.txt
123
[root@localhost a]# 

指令less

[root@localhost a]# less 1.txt
123
~
~
~
~
~
~
~
~

指令more

[root@localhost a]# more 1.txt
123
[root@localhost a]# 

指令head

[root@localhost a]# head 1.txt
123
[root@localhost a]# 

指令tail

[root@localhost a]# tail 1.txt
123
[root@localhost a]# 

修改文件权限:

指令chmod


[root@localhost a]# chmod 777 1.txt
[root@localhost a]# ll
总用量 4
-rwxrwxrwx 1 root root  4  6月  8 14:47 1.txt
drwxr-xr-x 3 root root 41  6月  8 14:33 b
[root@localhost a]# chmod 755 1.txt
[root@localhost a]# ll
总用量 4
-rwxr-xr-x 1 root root  4  6月  8 14:47 1.txt
drwxr-xr-x 3 root root 41  6月  8 14:33 b
[root@localhost a]# chmod -x 1.txt
[root@localhost a]# ll
总用量 4
-rw-r--r-- 1 root root  4  6月  8 14:47 1.txt
drwxr-xr-x 3 root root 41  6月  8 14:33 b
[root@localhost a]# 

修改所有权:

更改所有者

[root@localhost a]# chown  wq 1.txt

更改所属组

[root@localhost a]# chgrp wq 1.txt
[root@localhost a]# 

同时更改所有者和所属组

[root@localhost a]# chown wq:wq 1.txt
[root@localhost a]# 

本站无任何商业行为
个人在线分享 » Linux基础指令文件管理003
E-->