File search
Brief introduction
which: command to find
find: file search for file names
locate: Find files, database-dependent
Find command file
Find the ls command position
which ls // from the PATH environment variable
or whereis vim
Find any file
grammar
find [path...] [options] [expression] [action]
Options command path expression action
By file name
[root@qianfeng ~]# find /etc -name "hosts"
[root@qianfeng ~]# find /etc -iname "hosts"
[root@qianfeng ~]# find /etc -iname "hos*" //-i忽略大小写
The results output / etc / hosts file to find success
By file size:
[root@qianfeng ~]# find /etc -size +5M //文件>5M
[root@qianfeng ~]# find /etc -size 5M // 文件=5M
[root@qianfeng ~]# find /etc -size -5M // 文件<5M
Depth specified directory lookup
[root@qianfeng ~]# find / -maxdepth 3 -a -name "ifcfg-en*"
[root@qianfeng ~]# find / -maxdepth 4 -a -name "ifcfg-en*"
By file owner, is looking for group
[root@qianfeng ~]# find /home -user jack //属主是jack的文件
[root@qianfeng ~]# find /home -group hr //属组是hr组的文件
By file type
[root@qianfeng ~]# find /tmp -type f //f普通文件
[root@qianfeng ~]# find /dev -type b //b块设备文件
Press file permissions:
[root@qianfeng ~]# find . -perm 644 -ls
-ls action is one of the find, the precise rights
Find postprocessing action ACTIONS
After finding Delete: find / etc -name "775 * " -delete
After finding the copy: find / etc -name "ifcfg * " -ok cp -rvf {} / tmp;
Compression and file packaging
Brief introduction
tar command is a reliable method Unix / Linux system backup files, can work in almost any environment, its use rights for all users. Recommendations for directory
syntax: tar options archive file name of the source
observed volume of the three packages.
Inversely proportional to the speed and compression volume.
Decompression
View, and did not unpack # tar -tf etc.tar // t f file name to view
decompress
# tar xf etc3.tar.xz // brute
# tar -xvf etc2.tar.bz2 -C / tmp // - C redirected to // tmp directory