file 显示文件类型
mkdir 目录不存在 后面加 -p
-普通文件
d目录
l链接文件
p管道文件
c字符文件
b块文件
s 套接字文件
txt,log,
cfg cong configure xml配置文件
sh csh shell脚本
后缀名对linux系统没有意义 windows 中用于关联程序
find
find / -ctime -1 -name '*'|xargs ls -l
find -name '*.txt'|xargs cp /tmp
find -name '*.txt'|xargs cp -t /tmp
find / -ctime -1 -name '*' -size +10M|xargs (可加其他命令理解成拆开)ls -l(把文件类型列出来)
find / -maxdepth 4 -type f -size +100k | xargs ls -l -h(将大小换成单位)
find / -maxdepth 4 -type f -size +100k |wc -l (统计数量)
date
date +%Y-%m-%d
date -d '1 day' 按照描述输出
date -s '20150506 12:30:30' 修改日期
date +%F 格式化输出年月日
date+%格式化输出时分秒
创建名为test5.tar压缩包 压缩home下的所有文件 但不包括 5.txt
zcvf
z gzip进行压缩 c 创建压缩包 v 显示压缩过程 f 指定压缩
压缩路径换成相对路径比较安全
tar zcvf /tmp/test5.tar --exclude 5.txt ~/
解压到指定路径 tar -xf /tmp/test4.tar -C ~/f
zip -r /tmp/test1.zip /etc
unzip -d /tmp/ttt /tmp/test1.zip
软链接 ln -s 6.tx t 666.txt
当服务器运行了很长时间后 可能会出现磁盘已满的问题但是当你查看容量时发现还有空闲容量
可能是因为inode节点不够用了,是由于小文件过多造成的
使用find 来查找小文件 进行清理
如果确实视容量不足 我们可以删除无用大文件
使用du命令查找
du / -sh |grep G # 查找超过一个G的文件
然后一步一步跟踪找到对应文件进行清理