Linux--文件的压缩和打包

gzip,zcat

用法:

[root@linux ~]# gzip [-cd#] 文件名
[root@linux ~]# zcat 文件名.gz
参数:
-c :将压缩的数据输出到屏幕上;
-d :解压缩的参数;
-# :压缩等级,-1 最快,但是压缩比最差、-9 最慢,但是压缩比最好。预设是 -6 。

实例:

# 压缩 man.config 会变成 man.config.gz  
[root@linux tmp]# gzip man.config 
# 读取压缩文件
[root@linux tmp]# zcat man.config.gz 
# 解压缩 
[root@linux tmp]# gzip -d man.config.gz 

gzip是用来压缩与解压名为*.gz的文件。

bzip2,bzcat

用法:

[root@linux ~]# bzip2 [-cd#] 文件名
[root@linux ~]# bzcat 文件名.bz2
参数:
-c :将压缩的数据输出到屏幕上;
-d :解压缩的参数;
-z :压缩的参数
-# :计算压缩比的参数, -9 最佳, -1 最快。

bzip2是用来压缩与解压名为*.bz2的文件。

tar

用法:

[root@linux ~]# tar [-cxtzjvfpPN] 文件与目录
参数:
-c :建立一个压缩档案的参数指令
-x :解开一个压缩档案的参数指令
-t :查看 tarfile 里面的文件
特别注意,在参数的下达中, c/x/t 仅能存在一个!不可同时存在!
因为不可能同时压缩与解压缩。
-z :用 gzip 压缩
-j :用 bzip2 压缩
-v :压缩的过程中显示文件
-f :使用文件名,在 f 之后要立即接档名,不要再加参数
-p :使用原文件的原来属性(属性不会依据使用者而变)
-P :可以使用绝对路径来压缩
–exclude FILE:在压缩的过程中,不要将 FILE 打包

实例:

[root@linux ~]# tar -cvf /tmp/etc.tar /etc <==仅打包,不压缩
[root@linux ~]# tar -zcvf /tmp/etc.tar.gz /etc <==打包后,以 gzip 压缩 
[root@linux ~]# tar -jcvf /tmp/etc.tar.bz2 /etc <==打包后,以 bzip2 压缩
[root@linux ~]# tar -ztvf /tmp/etc.tar.gz <== 查看/tmp/etc.tar.gz 内有哪些文件
[root@linux ~]# tar -zxvf /tmp/etc.tar.gz <==解压
#备份 /home, /etc ,但不要 /home/dmtsai
[root@linux ~]# tar --exclude /home/dmtsai -zcvf myfile.tar.gz /home/* /etc

tar程序打包的数据,没有压缩的名为*.tar,经过gzip压缩的,名称为*.tar.gz。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
编译 ./configure --prefix=/usr/local/php --exec-prefix=/usr/local/php --bindir=/usr/local/php/bin --sbindir=/usr/local/php/sbin --includedir=/usr/local/php/include --libdir=/usr/local/php/lib/php --mandir=/usr/local/php/php/man --with-config-file-path=/usr/local/php/etc --with-mysql-sock=/var/run/mysql/mysql.sock --with-mcrypt=/usr /i nclude --with-mhash --with-openssl --with-mysql=shared,mysqlnd --with-mysqli=shared,mysqlnd --with-pdo-mysql=shared,mysqlnd --with-gd --with-iconv --with-zlib --enable-zip --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-mbregex --enable-mbstring --enable-ftp --enable-gd-native-ttf --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --without-pear --with-gettext --enable-session --with-curl --with-jpeg-dir --with-freetype-dir --enable-opcache --enable-fpm --enable-fastcgi --with-fpm-user=www --with-fpm-group=www --without-gdbm --with-mcrypt=/usr/local/apps/libmcrypt --disable-fileinfo 报错:1, **configure: error: system libzip must be upgraded to version >=**0.11。 使用Yum最新版只到0.10,不足以达到要求。 一、先删除libzip yum remove libzip -y SSH执行以上命令,先删除libzip 和 libzip-devel 二、下载安装并手动编译 wget https://nih.at/libzip/libzip-1.2.0.tar.gz tar -zxvf libzip-1.2.0.tar.gz cd libzip-1.2.0 ./configure make && make install 三、(可忽略)另外最新版本请参考官网:https://nih.at/libzip/ 1.5.0的libzip需要cmake wget https://libzip.org/download/libzip-1.5.0.tar.gz tar -zxvf libzip-* cd libzip* mkdir build && cd build && cmake .. && make && make install 报错2: error: off_t undefined; check your library configuration 根据报错信息分析 configure: error: off_t undefined; check your library configuration 未定义的类型 off_t。 off_t 类型是在 头文件 unistd.h中定义的,在32位系统 编程成 long int ,64位系统则编译成 long long int ,这里题主的系统应该是 64位的吧,在进行编译的时候 是默认查找64位的动态链接库,但是默认情况下 centos 的动态链接库配置文件/etc/ld.so.conf里并没有加入搜索路径,这个时候需要将 /usr/local/lib64 /usr/lib64 这些针对64位的库文件路径加进去。 采用下面的方法。 添加搜索路径到配置文件 echo '/usr/local/lib64 /usr/local/lib /usr/lib /usr/lib64'>>

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值