tar

linux pkgsrc 学习(一) 安装pkgsrc

冷暖自知 提交于 2019-12-05 22:00:31
使用pkgsrc.joyent.com 提供的linux 包 下载包 # # Copy and paste the lines below to install the 64-bit EL 7.x set. # BOOTSTRAP_TAR="bootstrap-trunk-x86_64-20170127.tar.gz" BOOTSTRAP_SHA="eb0d6911489579ca893f67f8a528ecd02137d43a" ​ # Download the bootstrap kit to the current directory. curl -O https://pkgsrc.joyent.com/packages/Linux/el7/bootstrap/${BOOTSTRAP_TAR} ​ # Verify the SHA1 checksum. echo "${BOOTSTRAP_SHA} ${BOOTSTRAP_TAR}" >check-shasum sha1sum -c check-shasum ​ # Verify PGP signature. This step is optional, and requires gpg. curl -O https://pkgsrc.joyent.com/packages/Linux/el7/bootstrap/$

Organizing files in tar bz2 file with python

[亡魂溺海] 提交于 2019-12-05 21:31:50
I have about 200,000 text files that are placed in a bz2 file. The issue I have is that when I scan the bz2 file to extract the data I need, it goes extremely slow. It has to look through the entire bz2 file to fine the single file I am looking for. Is there anyway to speed this up? Also, I thought about possibly organizing the files in the tar.bz2 so I can instead have it know where to look. Is there anyway to organize files that are put into a bz2? More Info/Edit: I need to query the compressed file for each textfile. Is there a better compression method that supports such a large number of

tar

天涯浪子 提交于 2019-12-05 19:06:50
功能 打包归档或者解包分离文件 简单用例 tar -cvf one.tar file1 file2 file3 # 打包 tar -tvf one.tar # 看包里面的内容 tar -xvf one.tar # 解开包 输入参数 -c :建立一个压缩档案的参数指令(create 的意思) -x :解开一个压缩档案的参数指令 -t :查看 tarfile 里面的档案 -z :是否同时具有 gzip 的属性?即是否需要用 gzip 压缩? -j :是否同时具有 bzip2 的属性?即是否需要用 bzip2 压缩? -v :压缩的过程中显示档案!这个常用,但不建议用在背景执行过程! -f :使用档名,请留意,在 f 之后要立即接档名喔!不要再加参数! -p :使用原档案的原来属性(属性不会依据使用者而变) -P :可以使用绝对路径来压缩! -N :比后面接的日期(yyyy/mm/dd)还要新的才会被打包进新建的档案中! --exclude FILE:在压缩的过程中,不要将 FILE 打包! # 特别注意,在参数的下达中, c/x/t 仅能存在一个!不可同时存在! 使用范例 # 范例一:将整个 /etc 目录下的档案全部打包成为 /tmp/etc.tar tar -cvf /tmp/etc.tar /etc # 仅打包,不压缩! tar -zcvf /tmp/etc.tar.gz

Linux学习五 文件与文件系统的压缩、打包与备份

二次信任 提交于 2019-12-05 18:59:43
1.1 Linux 系统常见的压缩指令   常见压缩文件案扩展名对应压缩指令:     *.Z              compress 程序压缩的文件;     *.zip              zip 程序压缩的文件;     *.gz              gzip 程序压缩的文件;     *.bz2             bzip2 程序压缩的文件;     *.xz              xz 程序打包的文件;     *.tar              tar 程序打包的数据,并没有压缩过;     *.tar.gz             tar 程序打包的文件,其中并且经过 gzip 的压缩;     *.tar.bz2            tar 程序打包的文件,其中并且经过 bzip2 的压缩;     *.tar.xz             tar 程序打包的文件,其中并且经过 xz 的压缩; 1.1.1 gzip,zcat/zmore/zless/zgrep   gzip [-cdtv#] 档名   zcat 档名.gz   选项与参数:     -c:将压缩的数据输出到屏幕上,可透过数据流重导向来处理;     -d:解压缩的参数;     -t :可以用来检验一个压缩文件的一致性     -v:可以显示出原文件

文件查找与压缩

僤鯓⒐⒋嵵緔 提交于 2019-12-05 18:17:53
tar -cvf test3.tar 444/ 1126/ 2019-11-08.log 打包 后面文件随便跟 然后将tar包 压缩成 gzip ; gzip test3.tar 源文件会没有 现在只有 test3.tar.gz 解压 gzip -d test3.tar.gz 同样源文件没有,现在只有test3.tar 将tar包 压缩成 bz2 ;bzip2 test3.tar 源文件会没有 现在只有 test3.tar.bz2 bzip2 -dk test3.tar.bz2 将其解压,解压完之后,源文件不删除,现在有 test3.tar.bz2 与 test3.tar gzip 将文件压缩成 .gz格式 -d 选项可以解压缩 (源文件都会删除) bzip2 将文件压缩成 .bz2格式 -d 选项可以解压缩 -k 选项可以保留源文件 tar [OPTION]... (1) 创建归档,保留权限 tar -cpvf /PATH/FILE.tar FILE... (2) 追加文件至归档: 注:不支持对压缩文件追加 tar -r -f /PATH/FILE.tar FILE... (3) 查看归档文件中的文件列表 tar -t -f /PATH/FILE.tar (4) 展开归档 tar -x -f /PATH/FILE.tar tar -x -f /PATH/FILE.tar -C

Linux CentOS 6.5 卸载、tar安装MySQL

只谈情不闲聊 提交于 2019-12-05 17:01:36
卸载系统自带MySQL 1. 查看系统当前是否安装有MySQL rpm -qa|grep -i mysql 2. 卸载当前版本的MySQL yum remove mysql mysql-server mysql-libs mysql-server 卸载过程中出现选择, 直接"y"就好 再检查一次无信息表示已卸载 3. 查找残留文件, 删除之 find / -name mysql 4. 创建 mysql 的用户组 / 用户 , data 目录及其用户目录 userdel mysql # 删除用户 groupdel mysql # 删除用户组名 mkdir /usr/local/mysql # mysql的默认安装路径,建议不要更换,如果更换后续需要更新配置 mkdir /usr/local/mysql/data # 在mysql文件夹下创建文件夹data groupadd mysql # 创建一个名为mysql的用户组 useradd -r -g mysql mysql           # 在用户组下创建用户 5. 解压并转移MySQL文件 # tar -xzvf mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz # 解压文件 # cd mysql-5.7.17-linux-glibc2.5-x86_64 # 进入 # mv * /usr

linux知识扫盲

情到浓时终转凉″ 提交于 2019-12-05 16:45:15
一、磁盘分区的配置   mbr与gpt的区别: 参考资料网站 https://zhidao.baidu.com/question/457998790987659965.html 二、什么是LVM   LVM(逻辑卷管理程序),是Linux环境下对 磁盘分区 进行管理的一种机制。    参考资料网站 https://baike.baidu.com/item/LVM/6571177?fr=aladdin 三、什么是挂载点   一棵大树(根目录/)有很多树枝(目录,挂载点),每个树枝上都挂着一个箱子(分区,存储空间)。 四、基础命令   0.改变文件属性与权限:     chgrp:改变文件所属群组 chgrp 群组名 目录或文件     chown:改变文件拥有者 chown 账号名[账号名:群组名] 目录或文件     chmod:改变文件的权限 chmod xyz[ugoa +-= rwx] 目录或文件   1.文件与目录的监视: ls [-adl] [--full-time] [--time=atime,ctime] 文件名或目录名称     -a : 全部文件,连同隐藏文件     -d : 仅列出目录     -l : 包含属性和权限。     full-time : 显示完整时间     atime(access time),ctime(change time),mtime

Pipe script and binary data to stdin via ssh

霸气de小男生 提交于 2019-12-05 12:43:38
I want to execute a bash script remotely which consumes a tarball and performs some logic to it. The trick is that I want to use only one ssh command to do it (rather than scp for the tarball followed by ssh for the script). The bash script looks like this: cd /tmp tar -zx ./archive/some_script.sh rm -r archive I realize that I can simply reformat this script into a one-liner and use tar -cz ./archive | ssh $HOST bash -c '<commands>' but my actual script is complicated enough that I must pipe it to bash via stdin. The challenge here is that ssh provides only one input pipe (stdin) which I want

How to list the contents of a compressed tar file in Java

假装没事ソ 提交于 2019-12-05 12:26:12
How do I list the contents of a compressed tar file in Java without extracting the files? I have looked at apache ant api, and I can see how to extract files, but I cannot work out how to just list them. The tar files are either bz2 or gz. I recommend using TrueZIP . It's really good. TrueZIP is a framework for virtual file systems and a library for accessing archive files as if they were just plain old directories. As a framework, TrueZIP provides the interfaces and classes to write file system drivers which plug-in to its federated file system space. As a library, TrueZIP provides convenient

tar指令集合

依然范特西╮ 提交于 2019-12-05 09:27:40
把常用的tar解压命令总结下,当作备忘: tar -c: 建立压缩档案 -x:解压 -t:查看内容 -r:向压缩归档文件末尾追加文件 -u:更新原压缩包中的文件 这五个是独立的命令,压缩解压都要用到其中一个,可以和别的命令连用但只能用其中一个。下面的参数是根据需要在压缩或解压档案时可选的。 -z:有gzip属性的 -j:有bz2属性的 -Z:有compress属性的 -v:显示所有过程 -O:将文件解开到标准输出 下面的参数-f是必须的 -f: 使用档案名字,切记,这个参数是最后一个参数,后面只能接档案名。 # tar -cf all.tar *.jpg 这条命令是将所有.jpg的文件打成一个名为all.tar的包。-c是表示产生新的包,-f指定包的文件名。 # tar -rf all.tar *.gif 这条命令是将所有.gif的文件增加到all.tar的包里面去。-r是表示增加文件的意思。 # tar -uf all.tar logo.gif 这条命令是更新原来tar包all.tar中logo.gif文件,-u是表示更新文件的意思。 # tar -tf all.tar 这条命令是列出all.tar包中所有文件,-t是列出文件的意思 # tar -xf all.tar 这条命令是解出all.tar包中所有文件,-x是解开的意思 压缩 tar –cvf jpg.tar *.jpg