Find command
- -name Specify name Search
[[email protected] ~]# find /etc/ -name "sshd_config"/etc/ssh/sshd_config
Fuzzy search for files containing specified characters
[[email protected] ~]# find /etc/ -name "sshd*"/etc/ssh/sshd_config/etc/systemd/system/multi-user.target.wants/sshd.service/etc/sysconfig/sshd/etc/pam.d/sshd
- -TYPE Specifies the file type, followed by D,f,l,b,c.
[[email protected] ~]# find /etc/ -type d -name "sshd*"[[email protected] ~]# find /etc/ -type f -name "sshd*"/etc/ssh/sshd_config/etc/sysconfig/sshd/etc/pam.d/sshd
- -mtime the last time the file content was changed
- -atime time of most recent file access
- -ctime recently changed the time of the file, such as permissions, size, change mtime,ctime also changed
[[email protected] ~]# find /etc/ -type f -mtime -1 小于一天,+1是大于一天/etc/resolv.conf/etc/tuned/active_profile[[email protected] ~]# find /etc/ -type f -mtime -1 -name "*.conf" 小于一天并且文件名为"*.conf",-o是或者。/etc/resolv.conf
- -inum Specify inode number, find hard link file
[[email protected] ~]# find / -inum 33583028/root/2.txt/tmp/2.txt.bak
- -mmin-60 within one hour.
- -exec can throw the found file to the back of the command.
[[email protected] ~]# find /root/ -type f -mmin -12000 -exec ls -l {} \;-rw-------. 1 root root 3100 6月 8 23:46 /root/.bash_history-rwx------. 2 root root 0 6月 8 20:22 /root/2.txt[[email protected] ~]# find /root/ -type f -mmin -60 -exec mv {} {}.bak \;
- -size-10k less than 10k files or 10M, must be with units
[[email protected] ~]# find /root/ -type f -size -10k -exec ls -l {} \;-rw-r--r--. 1 root root 18 12月 29 2013 /root/.bash_logout-rw-r--r--. 1 root root 176 12月 29 2013 /root/.bash_profile-rw-r--r--. 1 root root 176 12月 29 2013 /root/.bashrc-rw-r--r--. 1 root root 100 12月 29 2013 /root/.cshrc-rw-r--r--. 1 root root 129 12月 29 2013 /root/.tcshrc-rw-------. 1 root root 1261 5月 28 19:09 /root/anaconda-ks.cfg-rw-------. 1 root root 3100 6月 8 23:46 /root/.bash_history-rw-r--r--. 1 root root 799 5月 30 21:11 /root/.ssh/authorized_keys-rw-r--r--. 1 root root 352 5月 31 23:19 /root/.ssh/known_hosts-rw-------. 1 root root 1675 5月 31 23:28 /root/.ssh/id_rsa-rw-r--r--. 1 root root 400 5月 31 23:28 /root/.ssh/id_rsa.pub-rwx------. 2 root root 0 6月 8 20:22 /root/2.txt
Stat View the details of a file[[email protected] ~]# stat 2.txt 文件:"2.txt"大小:0 块:0 IO 块:4096 普通空文件设备:803h/2051d Inode:33583028 硬链接:1权限:(0700/-rwx------) Uid:( 0/ root) Gid:( 0/ root)环境:unconfined_u:object_r:admin_home_t:s0最近访问:2017-06-08 20:22:15.371780752 +0800最近更改:2017-06-08 20:22:15.371780752 +0800最近改动:2017-06-08 22:13:30.666649524 +0800创建时间:-
FileName suffix
- File names are case sensitive
The suffix of the file name can be customized, but it does not represent the types of files.
Linux and Windows inter-pass files
- Yum install-y Lrzsz can be used after installation, SZ command can transfer files from Linux to Windows, RZ command can transfer files from WINDIWS to Linux
Find command, Linux and Windows inter-pass files