日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

搜索fing

發(fā)布時間:2023/12/8 编程问答 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 搜索fing 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
 1.which?? 用于搜索一個命令在什么地方,不能搜索文件
? eg:[root@ns1 ~]# which passwd
????? /usr/bin/passwd
2.有些命令 比如 pwd ls cp? mv cat 可以直接使用? 是因為他們在環(huán)境變量 echo $PATH下都可以找到
3.locate?? 用來查詢數(shù)據(jù)庫中文件
??? 如果locate命令不能使用,先進(jìn)行安裝
?[root@ns1 tmp]# touch /root/erzi.com
?[root@ns1 tmp]# locate erzi.com
?[root@ns1 tmp]# updatedb?????????????????????? //數(shù)據(jù)庫的更新每天在凌晨4點會執(zhí)行一次
?[root@ns1 tmp]# locate erzi.com
?顯示結(jié)果:/root/erzi.com
4.查詢文件或目錄的命令?? find? 這個命令比較強(qiáng)大
? eg:[root@ns1 tmp]# find . -name father????????? //查詢本目錄下名字叫father的文件
????? 顯示結(jié)果:./father
????? [root@ns1 tmp]# find . -name son??????????
????? 顯示結(jié)果:./zuzong/son???????????????????
????? [root@ns1 tmp]# find . -type f -name son???? //只要文檔????
????? 顯示結(jié)果:./zuzong/son
?? [root@ns1 tmp]# find . -mtime +10??????????? //查詢10天以前創(chuàng)建的
??./yum.log
??./auto2Ij53g
?? [root@ns1 tmp]# find . -mtime -10??????????? //查詢10天以內(nèi)創(chuàng)建的
??.?
??./mother
??./father
??./zuzong
??./zuzong/son
??./.ICE-unix
?? [root@ns1 tmp]# find . -mmin +10??????????? //10分鐘
??.
??./mother
??./yum.log
??./father
??./zuzong
??./zuzong/son
??./auto2Ij53g
??./.ICE-unix
??[root@ns1 tmp]# find . -mmin -10
????? [root@ns1 tmp]#
????? [root@ns1 tmp]# stat zuzong????????????? //查看這個目錄
??File: "zuzong"
??Size: 4096????? ?Blocks: 8????????? IO Block: 4096?? 目錄
??Device: 803h/2051d?Inode: 659359????? Links: 2
??Access: (0755/drwxr-xr-x)? Uid: (??? 0/??? root)?? Gid: (??? 0/??? root)
??Access: 2018-03-30 00:22:38.033079400 +0800?????????????? //訪問時間
??Modify: 2018-03-30 00:22:16.049079037 +0800?????????????? //創(chuàng)建時間
??Change: 2018-03-30 00:22:16.049079037 +0800?????????????? //更改屬性權(quán)限的時間
??
??? 刪除日志:find /date/log/ -mtime +30 -type f |xargs rm -f??? 或者?? find /date/log/ -mtime +30 -type f -exec rm {} \; // \轉(zhuǎn)意符
?修改文件的名稱:find ./ -type f |xargs -i mv {} {} .bak????????? //? -i的意思是一個一個處理
?刪除文件:find ./ -type f |xargs rm
??????????? [root@ns1 tmp]# ls -la
????總用量 20
????drwxrwxrwt.? 5 root root 4096 3月? 30 17:14 .
????dr-xr-xr-x. 25 root root 4096 3月? 30 17:14 ..
????drwx------?? 2 root root 4096 3月?? 6 17:33 auto2Ij53g
????-rw-r--r--?? 1 root root??? 0 3月? 30 00:14 father
????drwxrwxrwt?? 2 root root 4096 3月? 30 17:14 .ICE-unix
????-rw-r--r--?? 1 root root??? 0 3月? 30 00:14 mother
????-rw-------.? 1 root root??? 0 3月?? 5 23:59 yum.log
????drwxr-xr-x?? 2 root root 4096 3月? 30 00:22 zuzong
??????????? [root@ns1 tmp]# find ./ -type f |xargs rm
?????????????? [root@ns1 tmp]# ls -la
????總用量 20
????drwxrwxrwt.? 5 root root 4096 3月? 30 18:08 .
????dr-xr-xr-x. 25 root root 4096 3月? 30 17:14 ..
????drwx------?? 2 root root 4096 3月?? 6 17:33 auto2Ij53g
????drwxrwxrwt?? 2 root root 4096 3月? 30 17:14 .ICE-unix
????drwxr-xr-x?? 2 root root 4096 3月? 30 18:08 zuzong
5.軟鏈接
???? eg:?????????
???[root@ns1 ~]# touch /root/zjz.com
???[root@ns1 ~]# ls -la
???總用量 80
???dr-xr-x---.? 2 root root? 4096 3月? 30 18:25 .
???dr-xr-xr-x. 25 root root? 4096 3月? 30 18:24 ..
???-rw-------.? 1 root root? 1250 3月?? 6 00:11 anaconda-ks.cfg
????? -rw-------.? 1 root root?? 622 3月?? 6 18:13 .bash_history
???-rw-r--r--.? 1 root root??? 18 5月? 20 2009 .bash_logout
???-rw-r--r--.? 1 root root?? 176 5月? 20 2009 .bash_profile
???-rw-r--r--.? 1 root root?? 176 9月? 23 2004 .bashrc
???-rw-r--r--.? 1 root root?? 100 9月? 23 2004 .cshrc
???-rw-r--r--.? 1 root root 28232 3月?? 6 00:11 install.log
???-rw-r--r--.? 1 root root? 7570 3月?? 6 00:07 install.log.syslog
???-rw-r--r--.? 1 root root?? 129 12月? 4 2004 .tcshrc
???-rw-------?? 1 root root?? 875 3月?? 6 17:32 .viminfo
???-rw-r--r--?? 1 root root???? 0 3月? 30 18:25 zjz.com?????????????????
???[root@ns1 ~]#?
???[root@ns1 ~]# ln -s /root/zjz.com linux???? 做軟鏈接?????? 做軟鏈接時最好寫成絕對路徑
???[root@ns1 ~]# ls -l
???總用量 44
???-rw-------. 1 root root? 1250 3月?? 6 00:11 anaconda-ks.cfg
???-rw-r--r--. 1 root root 28232 3月?? 6 00:11 install.log
???-rw-r--r--. 1 root root? 7570 3月?? 6 00:07 install.log.syslog
???lrwxrwxrwx? 1 root root??? 13 3月? 30 18:27 linux -> /root/zjz.com //發(fā)生變化? 此行開頭的l表示這是一個軟鏈接,名字叫Linux,其真正的文件在root下叫zjz.com
???-rw-r--r--? 1 root root???? 0 3月? 30 18:25 zjz.com
?????
???????????? 一個軟連接的例子
??????????? [root@ns1 ~]# cat linux
???[root@ns1 ~]# echo "wo shi ni baba." > /root/zjz.com
???[root@ns1 ~]# cat linux
??????????? wo shi ni baba.
??????????? 軟鏈接的作用:可以很快很方便的查找文件
6.硬鏈接
????? 做硬鏈接有限制:不能在同一個分區(qū)下,不能給目錄做硬鏈接
??? 例如:
??? [root@ns1 tmp]# ln zjz zjz
??ln: "zjz": 不允許將硬鏈接指向目錄?? //提示不能給目錄做硬鏈接
?????? 做硬鏈接:
????????? [root@ns1 tmp]# touch father.txt
???????????? [root@ns1 tmp]# ln father.txt son.txt
????????????? [root@ns1 tmp]# ls -li
????總用量 8
????659355 drwx------? 2 root root 4096 3月?? 6 17:33 auto2Ij53g
????659360 -rw-r--r--? 2 root root??? 0 3月? 30 18:50 father.txt???? //最前面659360
????659361 -rw-r--r--? 1 root root??? 0 3月? 30 18:50 mother.txt
????659360 -rw-r--r--? 2 root root??? 0 3月? 30 18:50 son.txt??????? //659360??? 兩者相同
????655362 -rw-------. 1 root root??? 0 3月?? 5 23:59 yum.log
????659359 drwxr-xr-x? 2 root root 4096 3月? 30 18:46 zjz
???????????? 把源(father.txt)刪了也沒關(guān)系 ,只要替身(son.txt)在 數(shù)據(jù)就在。
??? [root@ns1 tmp]# rm -f father.txt
????[root@ns1 tmp]# ls -li
????總用量 8
????659355 drwx------? 2 root root 4096 3月?? 6 17:33 auto2Ij53g
????659361 -rw-r--r--? 1 root root??? 0 3月? 30 18:50 mother.txt
????659360 -rw-r--r--? 1 root root??? 0 3月? 30 18:50 son.txt
????655362 -rw-------. 1 root root??? 0 3月?? 5 23:59 yum.log
????659359 drwxr-xr-x? 2 root root 4096 3月? 30 18:46 zjz
??????????? 硬鏈接的作用:更安全,做備份,不占用磁盤空間

總結(jié)

以上是生活随笔為你收集整理的搜索fing的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。