tar

Linux下软件包的多种安装方式

一世执手 提交于 2019-12-03 11:42:56
1.源码包安装 在Linux下的很多软件都是通过源码包方式发布的,虽然相对于二进制软件包,配置和编译起来繁琐点,但是它的可移植性却好得多,针对不同的体系结构,软件开发者往往仅需发布同一份源码包,不同的最终用户经过编译就可以正确运行。 安装的具体步骤: $ tar zxvf XXXX.tar.gz (or tar jxvf XXXX.tar.bz2) $ cd XXXX $ ./configure $ make # make install ##安装 $ make clean ##安装完成后用来清理临时文件 $ake uninstall ##用来卸载软件 1、解压: 最常见源码包的就两种(XXXX.tar.gz or XXXX.tar.bz2),其实这些源码包都是由2个工具压缩而成的,tar.gz结尾的文件用到的工具是tar和gunzip,而tar.bz2结尾的文件所使用的工具是tar和bzip2,之所以这样做是因为,tar仅仅能够打包多个文件但是没有压缩的功能,而gz和bz2却刚好相反,仅能够压缩单个文件,这样我们常见的源码包实际上是通过tar先将不同的源文件打包,然后再通过gunzip或者bzip2压缩后发布的,当然这两个步骤可以通过一条命令实现: $ tar zcvf XXXX.tar.gz XXXX(or tar jcvf XXXX.tar.bz2 XXXX)

Write Tar File of Unknown (Large) Size in Java

…衆ロ難τιáo~ 提交于 2019-12-03 11:40:31
I'd like to write a large stream of unknown size to a tar file in Java. I know that Apache has the commons compress library which handles tar files , but they require me to know the size in advance. Consider Apache's own example : TarArchiveEntry entry = new TarArchiveEntry(name); entry.setSize(size); tarOutput.putArchiveEntry(entry); tarOutput.write(contentOfEntry); tarOutput.closeArchiveEntry(); I will know the size of the entry after I write it, but not before. Isn't there a way that I can write the content and when I finish the size is then written to the header? I ended up taking jtar and

How to compare the content of a tarball with a folder

假如想象 提交于 2019-12-03 11:00:55
问题 How can I compare a tar file (already compressed) of the original folder with the original folder? First I created archive file using tar -kzcvf directory_name.zip directory_name Then I tried to compare using tar -diff -vf directory_name.zip directory_name But it didn't work. 回答1: --compare (-d) is more handy for that. tar --compare --file=archive-file.tar works if archive-file.tar is in the directory it was created. To compare archive-file.tar against a remote target (eg if you have moved

archiving (ubuntu tar) hidden directories

China☆狼群 提交于 2019-12-03 10:07:26
tar on a directory mydir will archive hidden files and hidden subdirectories, but tar from within mydir with a * wildcard will not. Is this a longstanding and known inconsistency or bug? Edit (additional information): tar from within mydir with a wildcard will not "see" nor archive hidden files and hidden subdirectories in the immediate directory. However, in the non-hidden subdirectories of mydir hidden files and hidden subdirectories will be archived. With wildcard it will not work. You have to specify . (current directory) if you mean full directory including hidden files. You can do tar

Linux

谁都会走 提交于 2019-12-03 10:05:42
一、Linux目录结构 1 /bin: (binaries) 存放系统命令的目录,所有用户都可以执行。 2 /sbin : (super user binaries) 保存和系统环境设置相关的命令,只有超级用户可以使用这些命令,有些命令可以允许普通用户查看。 3 /usr/bin:存放系统命令的目录,所有用户可以执行。这些命令和系统启动无关,单用户模式下不能执行 4 /usr/sbin:存放根文件系统不必要的系统管理命令,超级用户可执行 5 /root: 存放root用户的相关文件,root用户的家目录。宿主目录 超级用户 6 /home:用户缺省宿主目录 7 /tmp:(temporary)存放临时文件 8 /etc:(etcetera)系统配置文件 9 /usr:(unix software resource)系统软件共享资源目录,存放所有命令、库、手册页等 10 /proc:虚拟文件系统,数据保存在内存中,存放当前进程信息 11 /boot:系统启动目录 12 13 /dev:(devices)存放设备文件 14 /sys :虚拟文件系统,数据保存在内存中,主要保存于内存相关信息 15 /lib:存放系统程序运行所需的共享库 16 /lost+found:存放一些系统出错的检查结果。 17 /var:(variable) 动态数据保存位置,包含经常发生变动的文件,如邮件

tar exclude single files/directories, not patterns

我的梦境 提交于 2019-12-03 09:47:24
I'm using tar to make daily backups of a server and want to avoid backup of /proc and /sys system directories, but without excluding any directories named "proc" or "sys" somewhere else in the file tree. For, example having the following directory tree (" bla " being normal files): # find . ./sys ./sys/bla ./foo ./foo/sys ./foo/sys/bla I would like to exclude ./sys but not ./foo/sys . I can't seem to find an --exclude pattern that does that... # tar cvf /dev/null * --exclude=sys foo/ or... # tar cvf /dev/null * --exclude=/sys foo/ foo/sys/ foo/sys/bla sys/ sys/bla Any ideas? (Linux Debian 6)

Handling Single File Extraction From Corrupted GZ (TAR)

匿名 (未验证) 提交于 2019-12-03 09:02:45
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: This is my first post on Stack Overflow, I have a question regarding extracting a single file from a TAR file using GZ compression. I'm not the best at Python so I may be doing this incorrectly, any help would be much appreciated. Scenario: Corrupted *.tar.gz file comes in, the first file in the GZ contains important information for obtaining the SN of the system. This can be used to identify the machine so that we can issue a notification to it's administrator that the file was corrupted. The Problem : Using the regular UNIX tar binary I am

bash: /bin/tar: Argument list too long when compressing many files with tar

扶醉桌前 提交于 2019-12-03 08:51:20
问题 I am trying compress files from an archive with the command tar -czvf compress_file.tar.gz $(cat file_list.txt) And I have an error -bash: /bin/tar: Argument list too long The files numbers is too long, how can I resolve this? 回答1: Use the "-T" option to pass a file to tar that contains the filenames to tar up. tar -cv -T file_list.txt -f tarball.tar 回答2: and how to make list of files to tar up: first ls > temp ## create the list of files to tar up then tar cvzf dicionario_ultra.tgz -X FILE

Best archiver library for iOS [closed]

三世轮回 提交于 2019-12-03 08:50:23
I'm looking for an archiver library to use in my iOS app (zip or other formats). What is the best library in terms of: How easy it is to include it in a iOS project Memory consumption Speed of unarchiving How stable it is Ondrej Peterka I used Objective Zip and it worked quite well on iOS4. Work with this library is easy as this: ZipFile *zipFile= [[ZipFile alloc] initWithFileName:@"test.zip" mode:ZipFileModeCreate]; ZipWriteStream *stream= [zipFile writeFileInZipWithName:@"abc.txt" compressionLevel:ZipCompressionLevelBest]; [stream writeData:abcData]; [stream finishedWriting]; Unzipping is

Convert tar.gz to zip

匿名 (未验证) 提交于 2019-12-03 08:48:34
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've got a large collection of gzipped archives on my Ubuntu webserver, and I need them converted to zips. I figure this would be done with a script, but what language should I use, and how would I go about unzipping and rezipping files? 回答1: I'd do it with a bash(1) one-liner: for f in *.tar.gz;\ do rm -rf ${f%.tar.gz} ;\ mkdir ${f%.tar.gz} ;\ tar -C ${f%.tar.gz} zxvf $f ;\ zip -r ${f%.tar.gz} $f.zip ;\ rm -rf ${f%.tar.gz} ;\ done It isn't very pretty because I'm not great at bash(1) . Note that this destroys a lot of directories so be sure