问题1:我建立了一个硬连接文件,可是我不知道放在那里了,请问怎么办?node
思路:ide
[root@]# stat test.txt //获取文件的inode号码 File:`test.txt' Size:55 Blocks: 8 IO Block: 4096 regular file Device: 803h/2051d Inode: 148677 Links: 2 Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2016-04-17 15:32:13.861206307 +0800 Modify: 2016-04-17 14:20:13.246213893 +0800 Change: 2016-04-17 16:04:17.023206128 +0800 [root@]# find / -inum 1486772 >/dev/null //根据Inode号码查找,把错误提示丢弃 /usr/local/111test /data/oldboy/linktest.txt
问题2:我对文件n建立了一个软链接文件,可是我不知道放在哪里了,也不知道叫什么名字,请问怎么办?测试
思路:code
[root@]# find -type l -exec ls -l {} \; lrwxrwxrwx 1 root root 1 Apr 17 16:21 ./111test.txt-> 1 lrwxrwxrwx 1 root root 10 Apr 17 16:16./linktest.txt -> test.txt //找到文件后,长格式显示,而后过滤源文件名 [root@]# find -type l -exec ls -l {}\;| grep 'linktest.txt' lrwxrwxrwx 1 root root 10 Apr 17 16:16 ./linktest.txt -> test.txt
转载原文位置:http://www.javashuo.com/article/p-cznzslrx-dn.htmlblog