CentOS文件管理

基础命令

mkdir ls
touch rm mv cp
cat more less head tail wc file stat

各种查询

搜文件

find、locate

find -name 'filename'
find ! -name 'filename'
find -name 'filename1' -a -name 'filename2'
find -name 'filename1' -o -name 'filename2'

locate “python”

查找文件内容

grep、egrep、fgrep

grep "ERROR" catalina.out --color=auto -C2 -n
grep 'string' *
grep 'string' *.c
grep -rn 'target-char' file-name

其他

which python

字数统计

wc

文件对比

comm、diff

链接

ln -s file link

权限管理

chmod

chmod 755 file-name
chmod 755 directory-name -r

chown

待补充

压缩解压

tar

查看压缩包

tar -tf compress.tar | more

压缩文件

tar -cvf compress.tar /foldername

解压文件

tar -xzvf compress.tar.gz -C /foldername

zip

压缩文件

zip -r compress.zip filename /foldername

查看压缩包里面的内容

unzip -Z compress.zip

解压文件,通过-d指定解压路径

unzip compress.zip -d dirname

猜你喜欢

转载自blog.csdn.net/lpw_cn/article/details/84626610