linux8-which&find

linux8-which&find


which

查看linux命令的程序文件存放位置

# 查看cd命令的程序文件位置
which cd


find

文件/文件夹查找

选项: -name 以文件名形式去查找

文件名需要用双引号包裹

# 从根目录开始搜索test文件/文件夹
find / -name "test"
# 从HOME目录开始搜索test文件/文件夹
find ~ - name "test"

通过通配符查找

# 从根目录开始搜索test开头的文件/文件夹
find / -name "test*"
# 从根目录开始搜索test结尾的文件/文件夹
find / -name "*test"
# 从根目录开始搜索包含test的文件/文件夹
find / -name "*test*"

选项: -size 按照文件大小查找

# 查找小于10kb的文件
find / -size -10k
# 查找大于100MB的文件
find / -size +100M
# 查找大于1GB的文件
find / -size +1G

(可以用ctrl+c强制终止查询)

posted @ 2024-04-30 11:33  HIK4RU44  阅读(17)  评论(0)    收藏  举报