文件查找
- which:命令查找(常用)
- whereis:(不常用)
- find:文件查找(常用)
- locate:文件查找,依赖数据库
which ls
> alias ls='ls --color=auto'
> /bin/ls
alias myls='ls --color=auto'
find --help
tests (N can be +N or -N or N): -amin N -anewer FILE -atime N -cmin N
-cnewer FILE -ctime N -empty -false -fstype TYPE -gid N -group NAME
-ilname PATTERN -iname PATTERN -inum N -iwholename PATTERN -iregex PATTERN
-links N -lname PATTERN -mmin N -mtime N -name PATTERN -newer FILE
-nouser -nogroup -path PATTERN -perm [-/]MODE -regex PATTERN
-readable -writable -executable
-wholename PATTERN -size N[bcwkMG] -true -type [bcdpflsD] -uid N
-used N -user NAME -xtype [bcdpfls]
-context CONTEXT
find [path..] [options] [expression] [action]
find /etc -name "1.txt"
find /etc/ -iname "1.TXT"
ls -lh /etc/1.txt
find /etc/ -size +5M
find / -maxdepth 2 -a -name sdf*
find . -name 1.txt -o -name 2.txt
find /home/ -user user01
find /home/ -type l
find /home/ -perm 644
actions: -delete -print0 -printf FORMAT -fprintf FILE FORMAT -print
-fprint0 FILE -fprint FILE -ls -fls FILE -prune -quit
-exec COMMAND ; -exec COMMAND {} + -ok COMMAND ;
-execdir COMMAND ; -execdir COMMAND {} + -okdir COMMAND ;
find . -name 1.txt -ls
文件压缩、解压
压缩
tar -cf myetc.tar /etc/
tar -czf myetc.tar.gz /etc/
tar -cjg myetc.tar.bz /etc/
tar -cJg myetc.tar.xz /etc/
解压
tar -xf myetc.tar
tar -xf myetc.tar -C /root/myetc
|