Linux基础指令文件管理003

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

操作系统:

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]# 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值