Linux常用命令(下)

Linux文件权限及文件查找

Linux文件权限

echo pwd>>pwd.sh
ls -l pwd.sh

查看文件或目录的两种方式

umask
umask -S

查看新建是否与默认权限相符

umask
touch test1
mkdir test2
ls -l

修改pwd.sh文件权限为r-xr–r--

chmod 544 /root/pwd.sh

执行pwd.sh

./pwd.sh

添加用户stu,修改密码为123

useradd stu
passwd stu

修改问价test1的属主为stu,test属的组为stu

chmod stu test1
chgrp stu test2
ls -l

增加test1的属主具有可执行权限

chmod u+x test1
ls -l

文件查找

查看文件的类型

file /study/bashrc

查询ifconfig 和cd命令的完整文件名

which ifconfig
which cd

找出与passwd有关的“说明文件”文件名

whereis -m passwd

找出系统中所有与passwd相关的文件名

locate passwd

列出系统3天前24小时内修改过的文件

find / -mtime 3

使用find查找当前目录下比man.config新的文件,并存储到man.config.new文件。

find/root/27083914 -newer man.config>man.config.new

列出/etc下比/etc/man.config新的文件

find /etc -newer /etc/passwd

查找系统中所有属于root的文件和不属于任何人的文件

find	/	-user	root
find	/	-nouser

使用find查找/下面所有名称为man.config的文件

find	/	-name	man.config

使用locate查找所有名称为man.config的文件

locate man.config

locate 更加详细与man.config相关联的也都列出来
找出/etc下文件类型为f的文件

find	/etc -type f

找出系统大于1M的文件

find	/	-size +1000k
  • 11
    点赞
  • 50
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

oifengo

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值