对新手来说,尤其是英语功底不太好的小伙伴,去看命令的man page的时候,那么多参数,那么多指令,我该如何用,我该如何选择?(你的心情,下面的图就是最好的写照)多多少少会有些吃力,那是否有对新手友好的工具来实现快速上手的辅助工具呢?答案是肯定的,今天我就给你推荐两个小工具来帮你实现这个命令的快速上手,仅需两步就可以满足你的需求。
不单单支持pip安装,同时也支持npm, brew等方式安装,显示结果代码高亮,增加了可视化效果,而且还支持在线检索。
> pip install tldr
> tldr tar
# tar
Archiving utility.
Often combined with a compression method, such as gzip or bzip.
More information: <https://www.gnu.org/software/tar>.
- Create an archive from files:
tar cf target.tar file1 file2 file3
- Create a gzipped archive:
tar czf target.tar.gz file1 file2 file3
- Create a gzipped archive from a directory using relative paths:
tar czf target.tar.gz -C path/to/directory .
- Extract a (compressed) archive into the current directory:
tar xf source.tar[.gz|.bz2|.xz]
- Extract an archive into a target directory:
tar xf source.tar -C directory
- Create a compressed archive, using archive suffix to determine the compression program:
tar caf target.tar.xz file1 file2 file3
- List the contents of a tar file:
tar tvf source.tar
- Extract files matching a pattern:
tar xf source.tar --wildcards "*.html"
- Extract a specific file without preserving the folder structure:
tar xf source.tar source.tar/path/to/extract --strip-components=depth_to_strip
该命令对应的仓库已经被move了,新版本我看是使用了go进行编写,我在下面有贴对应的地址。
> pip install cheat
> cheat tar
# To extract an uncompressed archive:
tar -xvf /path/to/foo.tar
# To create an uncompressed archive:
tar -cvf /path/to/foo.tar /path/to/foo/
# To extract a .gz archive:
tar -xzvf /path/to/foo.tgz
# To create a .gz archive:
tar -czvf /path/to/foo.tgz /path/to/foo/
# To list the content of an .gz archive:
tar -ztvf /path/to/foo.tgz
# To extract a .bz2 archive:
tar -xjvf /path/to/foo.tgz
# To create a .bz2 archive:
tar -cjvf /path/to/foo.tgz /path/to/foo/
# To extract a .tar in specified Directory:
tar -xvf /path/to/foo.tar -C /path/to/destination/
# To list the content of an .bz2 archive:
tar -jtvf /path/to/foo.tgz
# To create a .gz archive and exclude all jpg,gif,... from the tgz
tar czvf /path/to/foo.tgz --exclude=\*.{jpg,gif,png,wmv,flv,tar.gz,zip} /path/to/foo/
# To use parallel (multi-threaded) implementation of compression algorithms:
tar -z ... -> tar -Ipigz ...
tar -j ... -> tar -Ipbzip2 ...
tar -J ... -> tar -Ipixz ...
酒虽好,勿贪杯,工具只是辅助你快速的掌握一个默认的命令,要想深入的了解命令的完整使用方式和每个参数的使用场景,还是需要去仔细研读man page, 步子大了会扯着蛋的~,嗯,很疼
。
欢迎关注我的公众号“追马Linux”,原创技术文章第一时间推送。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。