####find########
find 命令
find 路径 条件 条件值
find /mnt -name file ##查找名为file的文件
[root@localhost Desktop]# ls
[root@localhost Desktop]# touch file{1..8}
[root@localhost Desktop]# find / -name file3
/root/Desktop/file3
find /mnt -name "file*" ##查找所有文件名以file开头的所有文件
find /etc -name "*.conf" ##查找所有包含.conf的文件
find / -user liu ##查找用户liu
find / -group groupname ##查找名为groupname的组
find 条件1 -o 条件2 ##满足条件1或条件2的
[root@localhost mnt]# find / -size 0 -name file2
/root/Desktop/file2
find -type 文件类型 ##查找属于文件类型的文件
find -mmin +|-数字 ##时间
-maxdepth levels
Descend at most levels (a non-negative integer) levels of direc‐
tories below the command line arguments. -maxdepth 0
means only apply the tests and actions to the command line
arguments.
-mindepth levels
Do not apply any tests or actions at levels less than levels (a
non-negative integer). -mindepth 1 means process all files
except the command line arguments.
-mount Don't descend directories on other filesystems. An alternate
name for -xdev, for compatibility with some other versions of
find.
dd if=/dev/zero of=/mnt/file bs=1024 count=10##
dd ##数据截取
if ##数据模板
of ##数据存放文件
bs ##数据快大小(block size)
count ##数据快个数
--size 数字|-数字|+数字 ###查找大小符合条件的文件
-maxdepth 数字 ###最深目录层
-mindepth 数字 ###最小目录层
-exec 命令 {} \; ###对查找出的结果做相应处理
推荐网址:http://man.linuxde.net/find
########locate###########
locate +条件 ##在数据库中查找符合条件的文加
updatedb ##更新数据库
例子:
[root@localhost Desktop]# ls
file1 file2 file3 file4 file5 file6 file7 file8
[root@localhost Desktop]# locate file3
[root@localhost Desktop]# updatedb
[root@localhost Desktop]# locate file3
/root/Desktop/file3
5.链接
#######硬链接#########
硬链接是文件的副本,为了节省设备节点号
ln 文件 链接
######软链接############
软链接时文件的快捷方式,为了节省设备存储快
ln -s 文件 链接
ls -i ##查看一个文件节点号
本文详细介绍了Linux下find命令的使用方法,包括路径搜索、文件类型筛选、时间及大小过滤等高级用法,并对比了locate命令的特点。此外,还讲解了硬链接和软链接的区别及其创建方式。
9900

被折叠的 条评论
为什么被折叠?



