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

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

find的命令的使用和文件名的后缀

發布時間:2025/5/22 编程问答 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 find的命令的使用和文件名的后缀 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

find的命令的使用和文件名的后綴

除了find ?還有其他的搜索命令,不過沒有find功能強大,了解即可 !

root@alex ~]# which pwd

/usr/bin/pwd

[root@alex ~]# whereis pwd

pwd: /usr/bin/pwd /usr/include/pwd.h /usr/share/man/man1/pwd.1.g

[root@alex ~]# yum install -y locatl ? ? locatl ?安裝這個包 ?

[root@alex ~]# updatedb ? ?需要更新數據庫 ? 才能查看 ??

[root@alex ~]# ls ? ? ? ? ? ? ?locate ?遍歷整個目錄 ?去搜索?

2.txt??3.txt??c??m??nb??p??zx

[root@alex ~]# locate zx

/root/zx

/root/zx/1.txt ?

find ?

ctrl +l清屏的快捷方式 ? ctrl+c結束一個命令 ? ctrl+ u ?把前面的東西全部刪除 ??

ctrl+e ?把光標快速移動到后面 ? ctrl+a光標移動最開始 ? ?ctrl+d快速退出一個終端 ?

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? find搜索加上-name ?

[root@alex ~]# find /etc/ -name "sshd_config"

/etc/ssh/sshd_config

[root@alex ~]# find /etc/ -name "sshd*" ? ? ?模糊搜索 ? ?

/etc/pam.d/sshd

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?find前面跟路徑后面跟條件 ?

[root@alex ~]# find /etc/ -type d -name "sshd*" ? ? ? ? ?-d是指定目錄 ? ?type是類型 ??

[root@alex ~]# find /etc/ -type f -name "sshd*" ? ? ? ? ? -f ?是指定文件 ? ?type是類型 ? ?

/etc/pam.d/sshd

/etc/sysconfig/sshd

/etc/ssh/sshd_config

d,f,p,s,l,b,c ?都可以跟 ??

find除了這些還有其他的 ?mtime ?ctine ?aitime ? ?

[root@alex ~]# stat 2.txt

??File: ‘2.txt’

??Size: 0?????????????Blocks: 0??????????IO Block: 4096???regular empty file

Device: fd01h/64769d????Inode: 657747??????Links: 1

Access: (0644/-rw-r--r--)??Uid: (????0/????root)???Gid: (????0/????root)

Context: unconfined_u:object_r:admin_home_t:s0

Access: 2017-10-26 09:22:01.701999759 +0800

Modify: 2017-10-26 09:22:01.701999759 +0800

Change: 2017-10-26 09:38:42.230549940 +0800

Birth: -

?

[root@alex ~]# chmod 700 2.txt ? ? 更改文件的權限 ?ctime跟著改變 ??

[root@alex ~]# stat 2.txt

??File: ‘2.txt’

??Size: 0?????????????Blocks: 0??????????IO Block: 4096???regular empty file

Device: fd01h/64769d????Inode: 657747??????Links: 1

Access: (0700/-rwx------)??Uid: (????0/????root)???Gid: (????0/????root)

Context: unconfined_u:object_r:admin_home_t:s0

Access: 2017-10-26 09:22:01.701999759 +0800

Modify: 2017-10-26 09:22:01.701999759 +0800

Change: 2017-10-28 09:14:22.073579116 +0800

Birth: -

[root@alex ~]# echo “232323” >> 2.txt ? ? ? 更改了文件的內容 ,mtime,ctime 都會改變?

ctime是記錄文件的大小 ?文件的時間 權限所有者

[root@alex ~]# stat??2.txt

??File: ‘2.txt’

??Size: 13????????????Blocks: 8??????????IO Block: 4096???regular file

Device: fd01h/64769d????Inode: 657747??????Links: 1

Access: (0700/-rwx------)??Uid: (????0/????root)???Gid: (????0/????root)

Context: unconfined_u:object_r:admin_home_t:s0

Access: 2017-10-26 09:22:01.701999759 +0800

Modify: 2017-10-28 09:17:43.810493592 +0800

Change: 2017-10-28 09:17:43.810493592 +0800

Birth: -

[root@alex ~]# cat 2.txt ? ? ? ? 訪問2.txt ??

“232323”

[root@alex ~]# stat 2.txt

??File: ‘2.txt’

??Size: 13????????????Blocks: 8??????????IO Block: 4096???regular file

Device: fd01h/64769d????Inode: 657747??????Links: 1

Access: (0700/-rwx------)??Uid: (????0/????root)???Gid: (????0/????root)

Context: unconfined_u:object_r:admin_home_t:s0

Access: 2017-10-28 09:21:37.432551257 +0800 ? ? atime 時間跟著改變 ??

Modify: 2017-10-28 09:17:43.810493592 +0800

Change: 2017-10-28 09:17:43.810493592 +0800

Birth: -

atime ?最近訪問時間 ? mtime ?最近更改時間 ?ctime ?最近改動時間 ?

[root@alex ~]# find / -type??f -mtime -1 ? ?查看更改權限內容 -1 ?一天以內的 ? +7是七天以內?

[root@alex ~]# find /etc/ -type f -mtime -1 ? ?etc下一天以內更改的?

/etc/group

/etc/gshadow ? ?

[root@alex ~]# find /etc/ -type f -mtime +1 ?是一天以前的 ? ??

/etc/group

/etc/gshadow

[root@alex ~]# find /etc/ -type f -atime +1 ?一天一前訪問etc下文件的?

[root@alex ~]# find /etc/ -type f -ctime +1 ? ? 一天一前更改etc下權限的 文件 ? ? ??

[root@alex ~]# find /etc/ -type f -atime -1??-name??"*.conf" ? ?

/etc/nsswitch.conf

/etc/security/access.conf

/etc/security/limits.conf

/etc/security/limits.d/20-nproc.conf

[root@alex ~]# find /etc/ -type f -o -atime -1??-o -name??"*.conf" ?或者的意思 ? -o

-type ?-name -o ? -mtime ?

find 查找硬鏈接 ?文件 ??

??

首先查找 inum ? 號 ? ?

然后find ?/ -inum 2344221 ? 就可以查找 ?

find查找 root下60分鐘以內文件 ??

[root@alex ~]# find /root/??-type f -mmin??-60

/root/2.txt

[root@alex ~]# find /root/??-type f -mmin??-120

[root@alex ~]# find /root/ -type f -mmin -120 -exec ls -l {} \; ? ??

-rwx------. 1 root root 13 Oct 28 09:17 /root/2.txt

[root@alex ~]# find /root/ -type f -mmin -150 -exec mv {} {}.bak \; ? ?

[root@alex ~]# find /root/ -type f -mmin -150

/root/2.txt.bak

[root@alex ~]# find /root/ -size -10k ? ? ? ?小于10k的 ??

/root/

[root@alex ~]# find /root/ -type f -size -10k -exec ls -lh {} \;

-rw-r--r--. 1 root root 69 Aug 17 07:47 /root/.cache/pip/selfcheck.json

-rw-r--r--. 1 root root 64 Aug 17 07:48 /root/.pydistutils.cfg

-rw-r--r--. 1 root root 129 Dec 29??2013 /root/.tcshrc

-rw-r--r--. 1 root root 0 Oct 24 09:34 /root/zx/1.txt

-rw-r--r--. 1 root root 18 Dec 29??2013 /root/.bash_logout ?

[root@alex ~]# find /root/ -type f -size -10M -exec ls -lh {} \;

-rw-r--r--. 1 root root 129 Dec 29??2013 /root/.tcshrc

-rw-r--r--. 1 root root 0 Oct 24 09:34 /root/zx/1.txt

-rw-r--r--. 1 root root 18 Dec 29??2013 /root/.bash_logout

-rw-r--r--. 1 root root 100 Dec 29??2013 /root/.cshrc

[root@alex ~]# echo $LANG ? ?這個是寫法 ?表示英文 ?

en_US.UTF-8

linux下不是所有文件以什么結尾就是什么文件 ?具體要查看 ??

Linux文件類型常見的有:普通文件、目錄、字符設備文件、塊設備文件、符號鏈接文件等。


轉載于:https://blog.51cto.com/11335852/1976968

總結

以上是生活随笔為你收集整理的find的命令的使用和文件名的后缀的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。