linux中的tail以及unzip命令的简单使用

时间:2021-01-22 12:31:31   收藏:0   阅读:0

linux 中的 tail 命令

tail 命令可用于查看文件的内容,有一个常用的参数 -f 常用于查阅正在改变的日志文件。

tail -f filename 会把 filename 文件里的最尾部的内容显示在屏幕上,并且不断刷新,只要 filename 更新就可以看到最新的文件内容。

命令格式:

tail [参数] [文件]  

参数:

实例

要显示 notes.log 文件的最后 10 行,请输入以下命令:

tail notes.log

要跟踪名为 notes.log 的文件的增长情况,请输入以下命令:

tail -f notes.log

此命令显示 notes.log 文件的最后 10 行。当将某些行添加至 notes.log 文件时,tail 命令会继续显示这些行。 显示一直继续,直到您按下(Ctrl-C)组合键停止显示。

显示文件 notes.log 的内容,从第 20 行至文件末尾:

tail -n +20 notes.log

显示文件 notes.log 的最后 10 个字符:

tail -c 10 notes.log

linux 中的 unzip 简单使用

1、把文件解压到当前目录下

unzip test.zip

2、如果要把文件解压到指定的目录下,需要用到-d参数。

unzip -d /temp test.zip

3、解压的时候,有时候不想覆盖已经存在的文件,那么可以加上-n参数

unzip -n test.zip
unzip -n -d /temp test.zip

4、只看一下zip压缩包中包含哪些文件,不进行解压缩

unzip -l test.zip

5、查看显示的文件列表还包含压缩比率

unzip -v test.zip

6、检查zip文件是否损坏

unzip -t test.zip

7、将压缩文件test.zip在指定目录tmp下解压缩,如果已有相同的文件存在,要求unzip命令覆盖原先的文件

unzip -o test.zip -d /tmp/
评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!