tar

Parallel tar with split for large folders

徘徊边缘 提交于 2019-12-11 02:35:57
问题 I am have really huge folder I would like to gzip and split them for archive: #!/bin/bash dir=$1 name=$2 size=32000m tar -czf /dev/stdout ${dir} | split -a 5 -d -b $size - ${name} Are there way to speed up this with gnu parallel? thanks. 回答1: It seems the best tool for parallel gzip compression is pigz. See the comparisons. With it you can have a command like this: tar -c "${dir}" | pigz -c | split -a 5 -d -b "${size}" - "${name}" With its option -p you could also specify the number of

How can I tar multiple files in Perl?

风流意气都作罢 提交于 2019-12-11 02:34:35
问题 How can I tar multiple directories and also append files with some pattern like '.txt' and exclude some directories and exclude some patterns like '.exe' all into a single tar file. The main point is the number of directories are unknown(dynamic), so I need to loop through I guess? 回答1: Assuming you have worked out what files you want using File::Find then something like my @dir = qw/a b/ ; system "tar -cvf mytar @dir" ; might work. But you might find that the command line is too long. In

How to have git treat tar archives transparently as directories?

冷暖自知 提交于 2019-12-11 02:26:13
问题 I'd like git to version a tar file such that for repository-related functions such as git-diff (and even sophisticated git-merge conflict solutions) the file appears to be a directory with its included files being committed regularly to git, except that on checkout one should obtain a valid tar archive again. Is this somehow achievable? I first thought about using smudge/clean filters, but they merely allow you to modify the file contents of the stored git blob. So, now I'm thinking about

ansible playbook unable to continue as the `tar` fails due to `file change as we read`

泪湿孤枕 提交于 2019-12-10 22:34:20
问题 I am running an ansible-playbook which is doing running tar command to zip a directory. Following is the ansible task. - name: tar the old code command: tar -czf {{ansible_date_time.date}}.tar.gz /home/ubuntu/my-folder The above gives the following error. "warnings": use unarchive module rather than running tar stderr: tar: Removing leading '/' from member names tar: /home/ubuntu/my-folder/xyz.log: file change as we read it I also tried with option --ignore-failed-read but it didn't zipped

How do I build a debian package whose sources include symbolic links outside of the source tree?

时间秒杀一切 提交于 2019-12-10 20:23:17
问题 I have a project whose source includes symbolic links to other source trees (notably, the CppUTest framework). I need to build a debian package out of my project, but dpkg-source will not follow the symbolic links. Digging further, I believe this is because the default behavior for tar is not to dereference symbolic links unless explicitly told to (with -h ). I was unable to find a way to pass this extra option to tar when building the debian source tarball. So what am I doing wrong here? Is

Python write text to .tar.gz

守給你的承諾、 提交于 2019-12-10 17:17:10
问题 I look for a possibility to write a text file directly (OnTheFly) in a .tar.gz file with python. The best would be a solution like fobj = open (arg.file, "a") to append the text. I want to use this feature for long log files that you are not allowed to split. Thanks in advance 回答1: Yes, this is possible, but most likely not in the way you'd like to use it. .tar.gz is actually two things in one: gz or gzip is being used for compression, but this tool can only compress single files , so if you

ansible安装及简单使用

浪子不回头ぞ 提交于 2019-12-10 17:13:20
Ansible安装及使用 环境centos7,64 位。Python 版本为2.7.5 一、基础介绍 ========================================================================================== 1 、简介 ansible是新出现的自动化运维工具,基于Python开发,集合了众多运维工具(puppet、cfengine、chef、func、fabric)的优点,实现了批量系统配置、批量程序部署、批量运行命令等功能。ansible是基于模块工作的,本身没有批量部署的能力。真正具有批量部署的是ansible所运行的模块,ansible只是提供一种框架。主要包括: (1)、连接插件connection plugins:负责和被监控端实现通信; (2)、host inventory:指定操作的主机,是一个配置文件里面定义监控的主机; (3)、各种模块核心模块、command模块、自定义模块; (4)、借助于插件完成记录日志邮件等功能; (5)、playbook:剧本执行多个任务时,非必需可以让节点一次性运行多个任务。 2、特性 (1)、no agents:不需要在被管控主机上安装任何客户端; (2)、no server:无服务器端,使用时直接运行命令即可; (3)、modules in any

5. 最长回文子串

 ̄綄美尐妖づ 提交于 2019-12-10 16:28:56
我一开始的辣鸡算法 var longestPalindrome = function(s) { if(s.length<=1){ return s }else{ let tar='' for(let i=0;i<s.length;i++){ let con='' con+=s[i] let flag=0 for(let j=i+1;j<s.length;j++){ con+=s[j] if(con.split('').reverse().join('')==con){ flag++; if(tar.length<con.length){ tar=con } } } if(flag==0 && i==0){ tar=s[i] } } return tar } }; 来源: CSDN 作者: Caroline_Yang 链接: https://blog.csdn.net/Caroline_Yang/article/details/103475942

Linux使用高压缩率的lzma和xz

时光毁灭记忆、已成空白 提交于 2019-12-10 16:08:12
压缩 tar -c --xz -f my_archive.tar.xz /some_directory # results in my_archive.tar.xz tar -c --lzma -f my_archive.tar.lzma /some_directory # results in my_archive.tar.lzma 解压缩 tar -x --xz -f my_archive.tar.xz # results in /some_directory tar -x --lzma -f my_archive.tar.lzma # results in /some_directory 其中--xz可以用-J代替 更简洁的方式: tar -cJf aaa.tar.xz my_dir tar -xJf aaa.tar.xz 或者使用tar的选项"-a"自动识别压缩文件后缀的方式: tar -caf aaa.tar.xz my_dir tar -xaf aaa.tar.xz 如果你嫌tar.xz 太长了,可以使用txz。 由于受到Dos 8.3文件名格式的限制,tar常使用下列缩写: .tgz等价于.tar.gz .tbz与tb2等价于.tar.bz2 .taz等价于.tar.Z .tlz等价于.tar.lzma .txz等价于.tar.xz 继续补充: 查看tar包中的文件

*.zip、*.tar、*.tar.gz、*.tar.bz2、*.tar.xz、*.jar、*.7z

匆匆过客 提交于 2019-12-10 16:08:00
zip格式 压缩: zip -r [目标文件名].zip [原文件/目录名]解压: unzip [原文件名].zip 注:-r参数代表递归 tar格式(该格式仅仅打包,不压缩) 打包:tar -cvf [目标文件名].tar [原文件名/目录名]解包:tar -xvf [原文件名].tar 注:c参数代表create(创建),x参数代表extract(解包),v参数代表verbose(详细信息),f参数代表filename(文件名),所以f后必须接文件名。 tar.gz格式 方式一:利用前面已经打包好的tar文件,直接用压缩命令。 压缩:gzip [原文件名].tar 解压:gunzip [原文件名].tar.gz 方式二:一次性打包并压缩、解压并解包 打包并压缩: tar -zcvf [目标文件名].tar.gz [原文件名/目录名]解压并解包: tar -zxvf [原文件名].tar.gz 注:z代表用gzip算法来压缩/解压。 tar.bz2格式 方式一:利用已经打包好的tar文件,直接执行压缩命令: 压缩:bzip2 [原文件名].tar 解压:bunzip2 [原文件名].tar.bz2 方式二:一次性打包并压缩、解压并解包 打包并压缩: tar -jcvf [目标文件名].tar.bz2 [原文件名/目录名]解压并解包: tar -jxvf [原文件名].tar