Linux打包压缩命令——tar

一tar工具的介绍

Tar(Tape ARchive,磁带归档的缩写)

NAME
tar - manual page for tar 1.26 SYNOPSIS
tar [OPTION...] [FILE]... DESCRIPTION
GNU `tar' saves many files together into a single tape or disk archive, and can restore indi‐
vidual files from the archive. Note that this manual page contains just very brief description (or more like a list of possi‐
ble functionality) originally generated by the help2man utility. The full documentation for
tar is maintained as a Texinfo manual. If the info and tar programs are properly installed at
your site, the command `info tar' should give you access to the complete manual

二tar工具的使用

tar [OPTION]...

(1) 创建归档

tar -c -f /PATH/TO/SOMEFILE.tar FILE...

(2) 追加文件至归档

注:不支持对压缩文件追加

tar -r -f /PATH/TO/SOMEFILE.tar FILE...

(3) 查看归档文件中的文件列表

tar -t -f /PATH/TO/SOMEFILE.tar

(4) 展开归档

tar -x -f /PATH/TO/SOMEFILE.tar

tar -x -f /PATH/TO/SOMEFILE.tar -C /PATH/

(5) 结合压缩工具实现:归档并压缩

-j: bzip2, -z: gzip, -J: xz

(一)对文件进行打包,并且显示过程

-c表示创建打包文件,和压缩工具一样,要指明对应的后缀

-f表示打包到哪个文件里面

对整个目录进行打包

[root@centos72 ~]# tar  -cvf   /app/sysconfig.tar   /etc/sysconfig/
tar: Removing leading `/' from member names
/etc/sysconfig/
/etc/sysconfig/ip6tables-config
/etc/sysconfig/iptables-config
/etc/sysconfig/cbq/
/etc/sysconfig/cbq/avpkt
/etc/sysconfig/cbq/cbq-0000.example
/etc/sysconfig/rdisc
/etc/sysconfig/console/
/etc/sysconfig/init
/etc/sysconfig/modules/
/etc/sysconfig/netconsole
/etc/sysconfig/network-scripts/
/etc/sysconfig/network-scripts/ifcfg-lo
/etc/sysconfig/network-scripts/ifdown
/etc/sysconfig/network-scripts/ifdown-bnep
/etc/sysconfig/network-scripts/ifdown-eth
/etc/sysconfig/network-scripts/ifdown-ippp
/etc/sysconfig/network-scripts/ifdown-ipv6
/etc/sysconfig/network-scripts/ifdown-isdn
/etc/sysconfig/network-scripts/ifdown-post
/etc/sysconfig/network-scripts/ifdown-ppp
/etc/sysconfig/network-scripts/ifdown-routes
/etc/sysconfig/network-scripts/ifdown-sit
/etc/sysconfig/network-scripts/ifdown-tunnel
/etc/sysconfig/network-scripts/ifup
/etc/sysconfig/network-scripts/ifup-aliases
/etc/sysconfig/network-scripts/ifup-bnep
/etc/sysconfig/network-scripts/ifup-eth
/etc/sysconfig/network-scripts/ifup-ippp
/etc/sysconfig/network-scripts/ifup-ipv6
/etc/sysconfig/network-scripts/ifup-isdn
/etc/sysconfig/network-scripts/ifup-plip
/etc/sysconfig/network-scripts/ifup-plusb
/etc/sysconfig/network-scripts/ifup-post
/etc/sysconfig/network-scripts/ifup-ppp
/etc/sysconfig/network-scripts/ifup-routes
/etc/sysconfig/network-scripts/ifup-sit
/etc/sysconfig/network-scripts/ifup-tunnel
/etc/sysconfig/network-scripts/ifup-wireless
/etc/sysconfig/network-scripts/init.ipv6-global
/etc/sysconfig/network-scripts/network-functions
/etc/sysconfig/network-scripts/network-functions-ipv6
/etc/sysconfig/network-scripts/ifdown-Team
/etc/sysconfig/network-scripts/ifdown-TeamPort
/etc/sysconfig/network-scripts/ifup-Team
/etc/sysconfig/network-scripts/ifup-TeamPort
/etc/sysconfig/network-scripts/ifcfg-ens33
/etc/sysconfig/network-scripts/ifcfg-ens37
/etc/sysconfig/readonly-root
/etc/sysconfig/crond
/etc/sysconfig/run-parts
/etc/sysconfig/selinux
/etc/sysconfig/wpa_supplicant
/etc/sysconfig/ebtables-config
/etc/sysconfig/grub
/etc/sysconfig/irqbalance
/etc/sysconfig/man-db
/etc/sysconfig/rsyslog
/etc/sysconfig/firewalld
/etc/sysconfig/kdump
/etc/sysconfig/sshd
/etc/sysconfig/authconfig
/etc/sysconfig/cpupower
/etc/sysconfig/kernel
/etc/sysconfig/network
/etc/sysconfig/anaconda
/etc/sysconfig/chronyd
/etc/sysconfig/ntpdate
/etc/sysconfig/ntpd
/etc/sysconfig/keepalived
/etc/sysconfig/ipvsadm-config
/etc/sysconfig/nginx
/etc/sysconfig/nginx-debug
/etc/sysconfig/htcacheclean
/etc/sysconfig/httpd

打包的文件变小了,但是实际上没有压缩

[root@centos72 ~]# ls  /app/sysconfig.tar  -l
-rw-r--r-- 1 root root 235520 May 3 10:10 /app/sysconfig.tar
[root@centos72 ~]# ls /app/sysconfig.tar -lh
-rw-r--r-- 1 root root 230K May 3 10:10 /app/sysconfig.tar
[root@centos72 ~]# du -sh /etc/sysconfig/
368K /etc/sysconfig/

(二)对文件进行打包并且压缩

结合压缩工具实现:归档并压缩  -j: bzip2, -z: gzip, -J: xz

[root@centos72 ~]# tar  -zcf   /app/sysconfig.tar.gz  /etc/sysconfig/
tar: Removing leading `/' from member names
[root@centos72 ~]# tar -Jcf /app/sysconfig.tar.xz /etc/sysconfig/
tar: Removing leading `/' from member names
[root@centos72 ~]# tar -jcf /app/sysconfig.tar.bz2 /etc/sysconfig/
tar: Removing leading `/' from member names
[root@centos72 ~]# ls /app/ -lt
total 4272
-rw-r--r-- 1 root root 38103 May 3 10:27 sysconfig.tar.bz2
-rw-r--r-- 1 root root 37988 May 3 10:22 sysconfig.tar.xz
-rw-r--r-- 1 root root 47000 May 3 10:22 sysconfig.tar.gz
-rw-r--r-- 1 root root 235520 May 3 10:10 sysconfig.tar
----rwx--- 1 root root 15 May 2 23:42 aa.txt
-rw-r--r-- 1 root root 832545 May 2 23:37 messages
-rw-r--r-- 1 root root 108052 May 2 23:28 messages.zip
-rw-r--r-- 1 root root 80145 May 2 23:24 sysconfig.zip
-rw-r--r-- 1 root root 831851 May 2 23:00 m1
-rw------- 1 root root 106019 May 2 22:59 m.gz.txt
-rw-r--r-- 1 root root 831851 May 2 22:46 mmm
-rw-r--r-- 1 root root 831851 May 2 17:58 mm
-rw-r--r-- 1 root root 49513 May 2 17:58 mm.bz2
-rw-r--r-- 1 root root 197701 May 2 17:55 m.z
-rw------- 1 root root 106019 May 2 17:31 m.gz

上面提示tar: Removing leading `/' from member names无关紧要的,如果你显示,那么就在f前面加上P即可

参考文档:https://blog.51cto.com/13447608/2105102

[root@centos72 ~]# tar  -jcPf   /app/sysconfig.tar.bz2  /etc/sysconfig/
[root@centos72 ~]# tar -JcPf /app/sysconfig.tar.xz /etc/sysconfig/
[root@centos72 ~]# tar -zcPf /app/sysconfig.tar.gz /etc/sysconfig/

(三)查看归档文件中的文件列表

tar -t -f /PATH/TO/SOMEFILE.tar

压缩与否都有效

[root@centos72 ~]# tar  -tvf   /app/sysconfig.tar.gz
tar: Removing leading `/' from member names
drwxr-xr-x root/root 0 2019-05-02 14:46 /etc/sysconfig/
-rw------- root/root 2393 2018-11-05 01:03 /etc/sysconfig/ip6tables-config
-rw------- root/root 2374 2018-11-05 01:03 /etc/sysconfig/iptables-config
drwxr-xr-x root/root 0 2019-01-13 00:15 /etc/sysconfig/cbq/
-rw-r--r-- root/root 11 2018-04-11 16:08 /etc/sysconfig/cbq/avpkt
-rw-r--r-- root/root 79 2018-04-11 16:08 /etc/sysconfig/cbq/cbq-0000.example
-rw-r--r-- root/root 15 2017-08-04 16:01 /etc/sysconfig/rdisc
drwxr-xr-x root/root 0 2018-10-31 06:57 /etc/sysconfig/console/
-rw-r--r-- root/root 798 2018-10-31 06:57 /etc/sysconfig/init
drwxr-xr-x root/root 0 2018-10-31 06:57 /etc/sysconfig/modules/
-rw-r--r-- root/root 634 2018-10-31 06:57 /etc/sysconfig/netconsole
drwxr-xr-x root/root 0 2019-05-02 14:45 /etc/sysconfig/network-scripts/
-rw-r--r-- root/root 254 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifcfg-lo
lrwxrwxrwx root/root 0 2019-05-02 14:45 /etc/sysconfig/network-scripts/ifdown -> ../../../usr/sbin/ifdown
-rwxr-xr-x root/root 654 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifdown-bnep
-rwxr-xr-x root/root 6532 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifdown-eth
-rwxr-xr-x root/root 781 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifdown-ippp
-rwxr-xr-x root/root 4540 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifdown-ipv6
lrwxrwxrwx root/root 0 2019-05-02 14:45 /etc/sysconfig/network-scripts/ifdown-isdn -> ifdown-ippp
-rwxr-xr-x root/root 2130 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifdown-post
-rwxr-xr-x root/root 1068 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifdown-ppp
-rwxr-xr-x root/root 870 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifdown-routes
-rwxr-xr-x root/root 1456 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifdown-sit
-rwxr-xr-x root/root 1462 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifdown-tunnel
lrwxrwxrwx root/root 0 2019-05-02 14:45 /etc/sysconfig/network-scripts/ifup -> ../../../usr/sbin/ifup
-rwxr-xr-x root/root 12415 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifup-aliases
-rwxr-xr-x root/root 910 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifup-bnep
-rwxr-xr-x root/root 13475 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifup-eth
-rwxr-xr-x root/root 12075 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifup-ippp
-rwxr-xr-x root/root 11893 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifup-ipv6
lrwxrwxrwx root/root 0 2019-05-02 14:45 /etc/sysconfig/network-scripts/ifup-isdn -> ifup-ippp
-rwxr-xr-x root/root 650 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifup-plip
-rwxr-xr-x root/root 1064 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifup-plusb
-rwxr-xr-x root/root 4997 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifup-post
-rwxr-xr-x root/root 4154 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifup-ppp
-rwxr-xr-x root/root 2001 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifup-routes
-rwxr-xr-x root/root 3303 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifup-sit
-rwxr-xr-x root/root 2711 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifup-tunnel
-rwxr-xr-x root/root 1836 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifup-wireless
-rwxr-xr-x root/root 5419 2018-08-24 18:23 /etc/sysconfig/network-scripts/init.ipv6-global
-rw-r--r-- root/root 20671 2018-08-24 18:23 /etc/sysconfig/network-scripts/network-functions
-rw-r--r-- root/root 31027 2018-08-24 18:23 /etc/sysconfig/network-scripts/network-functions-ipv6
-rwxr-xr-x root/root 1621 2017-03-18 01:41 /etc/sysconfig/network-scripts/ifdown-Team
-rwxr-xr-x root/root 1556 2017-03-18 01:41 /etc/sysconfig/network-scripts/ifdown-TeamPort
-rwxr-xr-x root/root 1755 2017-03-18 01:41 /etc/sysconfig/network-scripts/ifup-Team
-rwxr-xr-x root/root 1876 2017-03-18 01:41 /etc/sysconfig/network-scripts/ifup-TeamPort
-rw-r--r-- root/root 206 2019-04-15 17:16 /etc/sysconfig/network-scripts/ifcfg-ens33
-rw-r--r-- root/root 210 2019-04-15 17:18 /etc/sysconfig/network-scripts/ifcfg-ens37
-rw-r--r-- root/root 905 2018-10-31 06:57 /etc/sysconfig/readonly-root
-rw------- root/root 110 2018-04-11 09:48 /etc/sysconfig/crond
-rw-r--r-- root/root 0 2014-06-10 06:14 /etc/sysconfig/run-parts
lrwxrwxrwx root/root 0 2019-01-13 00:16 /etc/sysconfig/selinux -> ../selinux/config
-rw-r--r-- root/root 610 2018-10-31 07:03 /etc/sysconfig/wpa_supplicant
-rw------- root/root 1390 2018-04-11 10:44 /etc/sysconfig/ebtables-config
lrwxrwxrwx root/root 0 2019-05-02 14:45 /etc/sysconfig/grub -> ../default/grub
-rw-r--r-- root/root 903 2018-04-11 04:31 /etc/sysconfig/irqbalance
-rw-r--r-- root/root 200 2018-10-30 22:55 /etc/sysconfig/man-db
-rw-r--r-- root/root 196 2018-10-30 22:49 /etc/sysconfig/rsyslog
-rw-r--r-- root/root 73 2018-10-31 06:46 /etc/sysconfig/firewalld
-rw-r--r-- root/root 1722 2018-11-05 01:10 /etc/sysconfig/kdump
-rw-r----- root/root 506 2018-04-11 12:21 /etc/sysconfig/sshd
-rw-r--r-- root/root 483 2019-01-13 00:21 /etc/sysconfig/authconfig
-rw-r--r-- root/root 150 2018-11-09 07:49 /etc/sysconfig/cpupower
-rw-r--r-- root/root 180 2019-01-13 00:21 /etc/sysconfig/kernel
-rw-r--r-- root/root 22 2019-05-02 14:45 /etc/sysconfig/network
-rw-r--r-- root/root 366 2019-01-13 00:22 /etc/sysconfig/anaconda
-rw-r--r-- root/root 46 2018-04-13 01:37 /etc/sysconfig/chronyd
-rw-r--r-- root/root 111 2018-04-11 04:29 /etc/sysconfig/ntpdate
-rw-r--r-- root/root 45 2018-04-11 04:29 /etc/sysconfig/ntpd
-rw-r--r-- root/root 673 2019-04-16 00:33 /etc/sysconfig/keepalived
-rw------- root/root 774 2015-03-06 09:33 /etc/sysconfig/ipvsadm-config
-rw-r--r-- root/root 98 2018-12-04 23:01 /etc/sysconfig/nginx
-rw-r--r-- root/root 148 2018-12-04 23:01 /etc/sysconfig/nginx-debug
-rw-r--r-- root/root 348 2018-10-30 23:00 /etc/sysconfig/htcacheclean
-rw-r--r-- root/root 802 2018-10-30 23:00 /etc/sysconfig/httpd

前面的-可以不加

[root@centos72 ~]# tar  -tvf   /app/sysconfig.tar.gz
tar: Removing leading `/' from member names
drwxr-xr-x root/root 0 2019-05-02 14:46 /etc/sysconfig/
-rw------- root/root 2393 2018-11-05 01:03 /etc/sysconfig/ip6tables-config
-rw------- root/root 2374 2018-11-05 01:03 /etc/sysconfig/iptables-config
drwxr-xr-x root/root 0 2019-01-13 00:15 /etc/sysconfig/cbq/
-rw-r--r-- root/root 11 2018-04-11 16:08 /etc/sysconfig/cbq/avpkt
-rw-r--r-- root/root 79 2018-04-11 16:08 /etc/sysconfig/cbq/cbq-0000.example
-rw-r--r-- root/root 15 2017-08-04 16:01 /etc/sysconfig/rdisc
drwxr-xr-x root/root 0 2018-10-31 06:57 /etc/sysconfig/console/
-rw-r--r-- root/root 798 2018-10-31 06:57 /etc/sysconfig/init
drwxr-xr-x root/root 0 2018-10-31 06:57 /etc/sysconfig/modules/
-rw-r--r-- root/root 634 2018-10-31 06:57 /etc/sysconfig/netconsole
drwxr-xr-x root/root 0 2019-05-02 14:45 /etc/sysconfig/network-scripts/
-rw-r--r-- root/root 254 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifcfg-lo
lrwxrwxrwx root/root 0 2019-05-02 14:45 /etc/sysconfig/network-scripts/ifdown -> ../../../usr/sbin/ifdown
-rwxr-xr-x root/root 654 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifdown-bnep
-rwxr-xr-x root/root 6532 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifdown-eth
-rwxr-xr-x root/root 781 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifdown-ippp
-rwxr-xr-x root/root 4540 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifdown-ipv6
lrwxrwxrwx root/root 0 2019-05-02 14:45 /etc/sysconfig/network-scripts/ifdown-isdn -> ifdown-ippp
-rwxr-xr-x root/root 2130 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifdown-post
-rwxr-xr-x root/root 1068 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifdown-ppp
-rwxr-xr-x root/root 870 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifdown-routes
-rwxr-xr-x root/root 1456 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifdown-sit
-rwxr-xr-x root/root 1462 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifdown-tunnel
lrwxrwxrwx root/root 0 2019-05-02 14:45 /etc/sysconfig/network-scripts/ifup -> ../../../usr/sbin/ifup
-rwxr-xr-x root/root 12415 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifup-aliases
-rwxr-xr-x root/root 910 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifup-bnep
-rwxr-xr-x root/root 13475 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifup-eth
-rwxr-xr-x root/root 12075 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifup-ippp
-rwxr-xr-x root/root 11893 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifup-ipv6
lrwxrwxrwx root/root 0 2019-05-02 14:45 /etc/sysconfig/network-scripts/ifup-isdn -> ifup-ippp
-rwxr-xr-x root/root 650 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifup-plip
-rwxr-xr-x root/root 1064 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifup-plusb
-rwxr-xr-x root/root 4997 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifup-post
-rwxr-xr-x root/root 4154 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifup-ppp
-rwxr-xr-x root/root 2001 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifup-routes
-rwxr-xr-x root/root 3303 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifup-sit
-rwxr-xr-x root/root 2711 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifup-tunnel
-rwxr-xr-x root/root 1836 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifup-wireless
-rwxr-xr-x root/root 5419 2018-08-24 18:23 /etc/sysconfig/network-scripts/init.ipv6-global
-rw-r--r-- root/root 20671 2018-08-24 18:23 /etc/sysconfig/network-scripts/network-functions
-rw-r--r-- root/root 31027 2018-08-24 18:23 /etc/sysconfig/network-scripts/network-functions-ipv6
-rwxr-xr-x root/root 1621 2017-03-18 01:41 /etc/sysconfig/network-scripts/ifdown-Team
-rwxr-xr-x root/root 1556 2017-03-18 01:41 /etc/sysconfig/network-scripts/ifdown-TeamPort
-rwxr-xr-x root/root 1755 2017-03-18 01:41 /etc/sysconfig/network-scripts/ifup-Team
-rwxr-xr-x root/root 1876 2017-03-18 01:41 /etc/sysconfig/network-scripts/ifup-TeamPort
-rw-r--r-- root/root 206 2019-04-15 17:16 /etc/sysconfig/network-scripts/ifcfg-ens33
-rw-r--r-- root/root 210 2019-04-15 17:18 /etc/sysconfig/network-scripts/ifcfg-ens37
-rw-r--r-- root/root 905 2018-10-31 06:57 /etc/sysconfig/readonly-root
-rw------- root/root 110 2018-04-11 09:48 /etc/sysconfig/crond
-rw-r--r-- root/root 0 2014-06-10 06:14 /etc/sysconfig/run-parts
lrwxrwxrwx root/root 0 2019-01-13 00:16 /etc/sysconfig/selinux -> ../selinux/config
-rw-r--r-- root/root 610 2018-10-31 07:03 /etc/sysconfig/wpa_supplicant
-rw------- root/root 1390 2018-04-11 10:44 /etc/sysconfig/ebtables-config
lrwxrwxrwx root/root 0 2019-05-02 14:45 /etc/sysconfig/grub -> ../default/grub
-rw-r--r-- root/root 903 2018-04-11 04:31 /etc/sysconfig/irqbalance
-rw-r--r-- root/root 200 2018-10-30 22:55 /etc/sysconfig/man-db
-rw-r--r-- root/root 196 2018-10-30 22:49 /etc/sysconfig/rsyslog
-rw-r--r-- root/root 73 2018-10-31 06:46 /etc/sysconfig/firewalld
-rw-r--r-- root/root 1722 2018-11-05 01:10 /etc/sysconfig/kdump
-rw-r----- root/root 506 2018-04-11 12:21 /etc/sysconfig/sshd
-rw-r--r-- root/root 483 2019-01-13 00:21 /etc/sysconfig/authconfig
-rw-r--r-- root/root 150 2018-11-09 07:49 /etc/sysconfig/cpupower
-rw-r--r-- root/root 180 2019-01-13 00:21 /etc/sysconfig/kernel
-rw-r--r-- root/root 22 2019-05-02 14:45 /etc/sysconfig/network
-rw-r--r-- root/root 366 2019-01-13 00:22 /etc/sysconfig/anaconda
-rw-r--r-- root/root 46 2018-04-13 01:37 /etc/sysconfig/chronyd
-rw-r--r-- root/root 111 2018-04-11 04:29 /etc/sysconfig/ntpdate
-rw-r--r-- root/root 45 2018-04-11 04:29 /etc/sysconfig/ntpd
-rw-r--r-- root/root 673 2019-04-16 00:33 /etc/sysconfig/keepalived
-rw------- root/root 774 2015-03-06 09:33 /etc/sysconfig/ipvsadm-config
-rw-r--r-- root/root 98 2018-12-04 23:01 /etc/sysconfig/nginx
-rw-r--r-- root/root 148 2018-12-04 23:01 /etc/sysconfig/nginx-debug
-rw-r--r-- root/root 348 2018-10-30 23:00 /etc/sysconfig/htcacheclean
-rw-r--r-- root/root 802 2018-10-30 23:00 /etc/sysconfig/httpd
[root@centos72 ~]# tar -tvf /app/sysconfig.tar.gz
tar: Removing leading `/' from member names
drwxr-xr-x root/root 0 2019-05-02 14:46 /etc/sysconfig/
-rw------- root/root 2393 2018-11-05 01:03 /etc/sysconfig/ip6tables-config
-rw------- root/root 2374 2018-11-05 01:03 /etc/sysconfig/iptables-config
drwxr-xr-x root/root 0 2019-01-13 00:15 /etc/sysconfig/cbq/
-rw-r--r-- root/root 11 2018-04-11 16:08 /etc/sysconfig/cbq/avpkt
-rw-r--r-- root/root 79 2018-04-11 16:08 /etc/sysconfig/cbq/cbq-.example
-rw-r--r-- root/root 15 2017-08-04 16:01 /etc/sysconfig/rdisc
drwxr-xr-x root/root 0 2018-10-31 06:57 /etc/sysconfig/console/
-rw-r--r-- root/root 798 2018-10-31 06:57 /etc/sysconfig/init
drwxr-xr-x root/root 0 2018-10-31 06:57 /etc/sysconfig/modules/
-rw-r--r-- root/root 634 2018-10-31 06:57 /etc/sysconfig/netconsole
drwxr-xr-x root/root 0 2019-05-02 14:45 /etc/sysconfig/network-scripts/
-rw-r--r-- root/root 254 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifcfg-lo
lrwxrwxrwx root/root 0 2019-05-02 14:45 /etc/sysconfig/network-scripts/ifdown -> ../../../usr/sbin/ifdown
-rwxr-xr-x root/root 654 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifdown-bnep
-rwxr-xr-x root/root 6532 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifdown-eth
-rwxr-xr-x root/root 781 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifdown-ippp
-rwxr-xr-x root/root 4540 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifdown-ipv6
lrwxrwxrwx root/root 0 2019-05-02 14:45 /etc/sysconfig/network-scripts/ifdown-isdn -> ifdown-ippp
-rwxr-xr-x root/root 2130 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifdown-post
-rwxr-xr-x root/root 1068 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifdown-ppp
-rwxr-xr-x root/root 870 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifdown-routes
-rwxr-xr-x root/root 1456 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifdown-sit
-rwxr-xr-x root/root 1462 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifdown-tunnel
lrwxrwxrwx root/root 0 2019-05-02 14:45 /etc/sysconfig/network-scripts/ifup -> ../../../usr/sbin/ifup
-rwxr-xr-x root/root 12415 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifup-aliases
-rwxr-xr-x root/root 910 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifup-bnep
-rwxr-xr-x root/root 13475 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifup-eth
-rwxr-xr-x root/root 12075 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifup-ippp
-rwxr-xr-x root/root 11893 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifup-ipv6
lrwxrwxrwx root/root 0 2019-05-02 14:45 /etc/sysconfig/network-scripts/ifup-isdn -> ifup-ippp
-rwxr-xr-x root/root 650 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifup-plip
-rwxr-xr-x root/root 1064 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifup-plusb
-rwxr-xr-x root/root 4997 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifup-post
-rwxr-xr-x root/root 4154 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifup-ppp
-rwxr-xr-x root/root 2001 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifup-routes
-rwxr-xr-x root/root 3303 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifup-sit
-rwxr-xr-x root/root 2711 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifup-tunnel
-rwxr-xr-x root/root 1836 2018-08-24 18:23 /etc/sysconfig/network-scripts/ifup-wireless
-rwxr-xr-x root/root 5419 2018-08-24 18:23 /etc/sysconfig/network-scripts/init.ipv6-global
-rw-r--r-- root/root 20671 2018-08-24 18:23 /etc/sysconfig/network-scripts/network-functions
-rw-r--r-- root/root 31027 2018-08-24 18:23 /etc/sysconfig/network-scripts/network-functions-ipv6
-rwxr-xr-x root/root 1621 2017-03-18 01:41 /etc/sysconfig/network-scripts/ifdown-Team
-rwxr-xr-x root/root 1556 2017-03-18 01:41 /etc/sysconfig/network-scripts/ifdown-TeamPort
-rwxr-xr-x root/root 1755 2017-03-18 01:41 /etc/sysconfig/network-scripts/ifup-Team
-rwxr-xr-x root/root 1876 2017-03-18 01:41 /etc/sysconfig/network-scripts/ifup-TeamPort
-rw-r--r-- root/root 206 2019-04-15 17:16 /etc/sysconfig/network-scripts/ifcfg-ens33
-rw-r--r-- root/root 210 2019-04-15 17:18 /etc/sysconfig/network-scripts/ifcfg-ens37
-rw-r--r-- root/root 905 2018-10-31 06:57 /etc/sysconfig/readonly-root
-rw------- root/root 110 2018-04-11 09:48 /etc/sysconfig/crond
-rw-r--r-- root/root 0 2014-06-10 06:14 /etc/sysconfig/run-parts
lrwxrwxrwx root/root 0 2019-01-13 00:16 /etc/sysconfig/selinux -> ../selinux/config
-rw-r--r-- root/root 610 2018-10-31 07:03 /etc/sysconfig/wpa_supplicant
-rw------- root/root 1390 2018-04-11 10:44 /etc/sysconfig/ebtables-config
lrwxrwxrwx root/root 0 2019-05-02 14:45 /etc/sysconfig/grub -> ../default/grub
-rw-r--r-- root/root 903 2018-04-11 04:31 /etc/sysconfig/irqbalance
-rw-r--r-- root/root 200 2018-10-30 22:55 /etc/sysconfig/man-db
-rw-r--r-- root/root 196 2018-10-30 22:49 /etc/sysconfig/rsyslog
-rw-r--r-- root/root 73 2018-10-31 06:46 /etc/sysconfig/firewalld
-rw-r--r-- root/root 1722 2018-11-05 01:10 /etc/sysconfig/kdump
-rw-r----- root/root 506 2018-04-11 12:21 /etc/sysconfig/sshd
-rw-r--r-- root/root 483 2019-01-13 00:21 /etc/sysconfig/authconfig
-rw-r--r-- root/root 150 2018-11-09 07:49 /etc/sysconfig/cpupower
-rw-r--r-- root/root 180 2019-01-13 00:21 /etc/sysconfig/kernel
-rw-r--r-- root/root 22 2019-05-02 14:45 /etc/sysconfig/network
-rw-r--r-- root/root 366 2019-01-13 00:22 /etc/sysconfig/anaconda
-rw-r--r-- root/root 46 2018-04-13 01:37 /etc/sysconfig/chronyd
-rw-r--r-- root/root 111 2018-04-11 04:29 /etc/sysconfig/ntpdate
-rw-r--r-- root/root 45 2018-04-11 04:29 /etc/sysconfig/ntpd
-rw-r--r-- root/root 673 2019-04-16 00:33 /etc/sysconfig/keepalived
-rw------- root/root 774 2015-03-06 09:33 /etc/sysconfig/ipvsadm-config
-rw-r--r-- root/root 98 2018-12-04 23:01 /etc/sysconfig/nginx
-rw-r--r-- root/root 148 2018-12-04 23:01 /etc/sysconfig/nginx-debug
-rw-r--r-- root/root 348 2018-10-30 23:00 /etc/sysconfig/htcacheclean
-rw-r--r-- root/root 802 2018-10-30 23:00 /etc/sysconfig/httpd

(四)对文件进行解压缩

展开归档

tar -x -f   /PATH/TO/SOMEFILE.tar 解压到当前目录

tar -x -f    /PATH/TO/SOMEFILE.tar   -C /PATH/  解压到特定的目录

[root@centos72 ~]# tar  xvf  /app/sysconfig.tar.gz   -C /app/
[root@centos72 ~]# ls  /app -lth
total 4.2M
drwxr-xr-x 3 root root 23 May 3 10:59 etc
-rw-r--r-- 1 root root 46K May 3 10:32 sysconfig.tar.gz
-rw-r--r-- 1 root root 38K May 3 10:32 sysconfig.tar.xz
-rw-r--r-- 1 root root 38K May 3 10:31 sysconfig.tar.bz2
-rw-r--r-- 1 root root 230K May 3 10:10 sysconfig.tar
----rwx--- 1 root root 15 May 2 23:42 aa.txt
-rw-r--r-- 1 root root 814K May 2 23:37 messages
-rw-r--r-- 1 root root 106K May 2 23:28 messages.zip
-rw-r--r-- 1 root root 79K May 2 23:24 sysconfig.zip
-rw-r--r-- 1 root root 813K May 2 23:00 m1
-rw------- 1 root root 104K May 2 22:59 m.gz.txt
-rw-r--r-- 1 root root 813K May 2 22:46 mmm
-rw-r--r-- 1 root root 813K May 2 17:58 mm
-rw-r--r-- 1 root root 49K May 2 17:58 mm.bz2
-rw-r--r-- 1 root root 194K May 2 17:55 m.z
-rw------- 1 root root 104K May 2 17:31 m.gz

解压缩文件大小和原目录里面的文件大小是一样的,说明解压缩成功了

[root@centos72 ~]#  du -sh   /etc/sysconfig/
368K /etc/sysconfig/
[root@centos72 ~]# du -sh /app/etc/sysconfig/
368K /app/etc/sysconfig/
[root@centos72 ~]# ll /etc/sysconfig/  -d
drwxr-xr-x. 6 root root 4096 May 2 14:46 /etc/sysconfig/
[root@centos72 ~]# ll /app/etc/sysconfig/ -d
drwxr-xr-x 6 root root 4096 May 2 14:46 /app/etc/sysconfig/

-T选项指定输入文件,-X选项指定包含要排除的文件列表

创建文件并且添加要压缩的文件

[root@centos72 ~]# cat  filelist.txt
/etc/issue
/etc/passwd
/etc/services
/root/anaconda-ks.cfg

如果文件名很长可以在文件里面输入:r!ls ,文件的路径就会自动补齐

:r!ls  /root/anaconda-ks.cfg,按回车键就会把文件的完整路径输入到光标指定的地方

读取文件里面的文件列表,并且进行压缩

[root@centos72 ~]# tar  -T   filelist.txt   -Jcvf     /app/fl.xz
tar: Removing leading `/' from member names
/etc/issue
/etc/passwd
/etc/services
/root/anaconda-ks.cfg
[root@centos72 ~]# ls /app
aa.txt fl.xz messages m.gz mm mmm sysconfig.tar sysconfig.tar.gz sysconfig.zip
etc m1 messages.zip m.gz.txt mm.bz2 m.z sysconfig.tar.bz2 sysconfig.tar.xz
[root@centos72 ~]# ls /app/fl.xz
/app/fl.xz
[root@centos72 ~]# ls /app/fl.xz -l
-rw-r--r-- 1 root root 101048 May 3 11:21 /app/fl.xz
[root@centos72 ~]# ls /app/fl.xz -lh
-rw-r--r-- 1 root root 99K May 3 11:21 /app/fl.xz

tar: Removing leading `/' from member names表示把文件最前面的/删除了

预览的时候可看到,这样做的好处是解压的时候文件是相对路径,不会覆盖原来的文件

[root@centos72 ~]# tar  tvf  /app/fl.xz
-rw-r--r-- root/root 23 2018-11-23 21:16 etc/issue
-rw-r--r-- root/root 1161 2019-05-02 14:05 etc/passwd
-rw-r--r-- root/root 670293 2013-06-07 22:31 etc/services
-rw------- root/root 1592 2019-01-13 00:22 root/anaconda-ks.cfg

分割大的 tar 文件为多份小文件:
split –b Size –d tar-file-name prefix-name
split -b 1M –d mybackup.tgz mybackup-parts
split -b 1M mybackup.tgz mybackup-parts

有些网站对文件大小有限制,那么就要先把文件切割成小份再上传

对系统目录进行打包压缩,并且切分成4M一个的文件

[root@centos72 ~]# tar  cf  /app/etc.tar  /etc/
tar: Removing leading `/' from member names
[root@centos72 ~]# ls /app/etc.tar -lh
-rw-r--r-- 1 root root 32M May 3 11:31 /app/etc.tar
[root@centos72 ~]# split   -b   4M  /app/etc.tar    /app/etc
[root@centos72 ~]# ls /app -lt
total 69492
-rw-r--r-- 1 root root 3981312 May 3 11:34 etcah
-rw-r--r-- 1 root root 4194304 May 3 11:34 etcag
-rw-r--r-- 1 root root 4194304 May 3 11:34 etcaf
-rw-r--r-- 1 root root 4194304 May 3 11:34 etcae
-rw-r--r-- 1 root root 4194304 May 3 11:34 etcad
-rw-r--r-- 1 root root 4194304 May 3 11:34 etcac
-rw-r--r-- 1 root root 4194304 May 3 11:34 etcab
-rw-r--r-- 1 root root 4194304 May 3 11:34 etcaa
-rw-r--r-- 1 root root 33341440 May 3 11:31 etc.tar
-rw-r--r-- 1 root root 101048 May 3 11:21 fl.xz
drwxr-xr-x 3 root root 23 May 3 10:59 etc
-rw-r--r-- 1 root root 46994 May 3 10:32 sysconfig.tar.gz
-rw-r--r-- 1 root root 37992 May 3 10:32 sysconfig.tar.xz
-rw-r--r-- 1 root root 38109 May 3 10:31 sysconfig.tar.bz2
-rw-r--r-- 1 root root 235520 May 3 10:10 sysconfig.tar
----rwx--- 1 root root 15 May 2 23:42 aa.txt
-rw-r--r-- 1 root root 832545 May 2 23:37 messages
-rw-r--r-- 1 root root 108052 May 2 23:28 messages.zip
-rw-r--r-- 1 root root 80145 May 2 23:24 sysconfig.zip
-rw-r--r-- 1 root root 831851 May 2 23:00 m1
-rw------- 1 root root 106019 May 2 22:59 m.gz.txt
-rw-r--r-- 1 root root 831851 May 2 22:46 mmm
-rw-r--r-- 1 root root 831851 May 2 17:58 mm
-rw-r--r-- 1 root root 49513 May 2 17:58 mm.bz2
-rw-r--r-- 1 root root 197701 May 2 17:55 m.z
-rw------- 1 root root 106019 May 2 17:31 m.gz
[root@centos72 ~]# ls /app  -lth
total 68M
-rw-r--r-- 1 root root 3.8M May 3 11:34 etcah
-rw-r--r-- 1 root root 4.0M May 3 11:34 etcag
-rw-r--r-- 1 root root 4.0M May 3 11:34 etcaf
-rw-r--r-- 1 root root 4.0M May 3 11:34 etcae
-rw-r--r-- 1 root root 4.0M May 3 11:34 etcad
-rw-r--r-- 1 root root 4.0M May 3 11:34 etcac
-rw-r--r-- 1 root root 4.0M May 3 11:34 etcab
-rw-r--r-- 1 root root 4.0M May 3 11:34 etcaa
-rw-r--r-- 1 root root 32M May 3 11:31 etc.tar
-rw-r--r-- 1 root root 99K May 3 11:21 fl.xz
drwxr-xr-x 3 root root 23 May 3 10:59 etc
-rw-r--r-- 1 root root 46K May 3 10:32 sysconfig.tar.gz
-rw-r--r-- 1 root root 38K May 3 10:32 sysconfig.tar.xz
-rw-r--r-- 1 root root 38K May 3 10:31 sysconfig.tar.bz2
-rw-r--r-- 1 root root 230K May 3 10:10 sysconfig.tar
----rwx--- 1 root root 15 May 2 23:42 aa.txt
-rw-r--r-- 1 root root 814K May 2 23:37 messages
-rw-r--r-- 1 root root 106K May 2 23:28 messages.zip
-rw-r--r-- 1 root root 79K May 2 23:24 sysconfig.zip
-rw-r--r-- 1 root root 813K May 2 23:00 m1
-rw------- 1 root root 104K May 2 22:59 m.gz.txt
-rw-r--r-- 1 root root 813K May 2 22:46 mmm
-rw-r--r-- 1 root root 813K May 2 17:58 mm
-rw-r--r-- 1 root root 49K May 2 17:58 mm.bz2
-rw-r--r-- 1 root root 194K May 2 17:55 m.z
-rw------- 1 root root 104K May 2 17:31 m.gz

把文件还原为原始文件,也就是对文件进行合并

把文件读取出来并且重定向到一个文件里面即可

[root@centos72 ~]# cat  /app/etca*  >  /app/etc2
[root@centos72 ~]# ls /app -lth
total 100M
-rw-r--r-- 1 root root 32M May 3 11:40 etc2
-rw-r--r-- 1 root root 3.8M May 3 11:34 etcah
-rw-r--r-- 1 root root 4.0M May 3 11:34 etcag
-rw-r--r-- 1 root root 4.0M May 3 11:34 etcaf
-rw-r--r-- 1 root root 4.0M May 3 11:34 etcae
-rw-r--r-- 1 root root 4.0M May 3 11:34 etcad
-rw-r--r-- 1 root root 4.0M May 3 11:34 etcac
-rw-r--r-- 1 root root 4.0M May 3 11:34 etcab
-rw-r--r-- 1 root root 4.0M May 3 11:34 etcaa
-rw-r--r-- 1 root root 32M May 3 11:31 etc.tar
-rw-r--r-- 1 root root 99K May 3 11:21 fl.xz
drwxr-xr-x 3 root root 23 May 3 10:59 etc
-rw-r--r-- 1 root root 46K May 3 10:32 sysconfig.tar.gz
-rw-r--r-- 1 root root 38K May 3 10:32 sysconfig.tar.xz
-rw-r--r-- 1 root root 38K May 3 10:31 sysconfig.tar.bz2
-rw-r--r-- 1 root root 230K May 3 10:10 sysconfig.tar
----rwx--- 1 root root 15 May 2 23:42 aa.txt
-rw-r--r-- 1 root root 814K May 2 23:37 messages
-rw-r--r-- 1 root root 106K May 2 23:28 messages.zip
-rw-r--r-- 1 root root 79K May 2 23:24 sysconfig.zip
-rw-r--r-- 1 root root 813K May 2 23:00 m1
-rw------- 1 root root 104K May 2 22:59 m.gz.txt
-rw-r--r-- 1 root root 813K May 2 22:46 mmm
-rw-r--r-- 1 root root 813K May 2 17:58 mm
-rw-r--r-- 1 root root 49K May 2 17:58 mm.bz2
-rw-r--r-- 1 root root 194K May 2 17:55 m.z
-rw------- 1 root root 104K May 2 17:31 m.gz

以数字方式区分不同的文件

[root@centos72 ~]# split   -d  -b   4M  /app/etc.tar    /app/etc
[root@centos72 ~]# ls /app -lth
total 132M
-rw-r--r-- 1 root root 3.8M May 3 11:42 etc07
-rw-r--r-- 1 root root 4.0M May 3 11:42 etc06
-rw-r--r-- 1 root root 4.0M May 3 11:42 etc05
-rw-r--r-- 1 root root 4.0M May 3 11:42 etc04
-rw-r--r-- 1 root root 4.0M May 3 11:42 etc03
-rw-r--r-- 1 root root 4.0M May 3 11:42 etc02
-rw-r--r-- 1 root root 4.0M May 3 11:42 etc01
-rw-r--r-- 1 root root 4.0M May 3 11:42 etc00
-rw-r--r-- 1 root root 32M May 3 11:40 etc2
-rw-r--r-- 1 root root 3.8M May 3 11:34 etcah
-rw-r--r-- 1 root root 4.0M May 3 11:34 etcag
-rw-r--r-- 1 root root 4.0M May 3 11:34 etcaf
-rw-r--r-- 1 root root 4.0M May 3 11:34 etcae
-rw-r--r-- 1 root root 4.0M May 3 11:34 etcad
-rw-r--r-- 1 root root 4.0M May 3 11:34 etcac
-rw-r--r-- 1 root root 4.0M May 3 11:34 etcab
-rw-r--r-- 1 root root 4.0M May 3 11:34 etcaa
-rw-r--r-- 1 root root 32M May 3 11:31 etc.tar
-rw-r--r-- 1 root root 99K May 3 11:21 fl.xz
drwxr-xr-x 3 root root 23 May 3 10:59 etc
-rw-r--r-- 1 root root 46K May 3 10:32 sysconfig.tar.gz
-rw-r--r-- 1 root root 38K May 3 10:32 sysconfig.tar.xz
-rw-r--r-- 1 root root 38K May 3 10:31 sysconfig.tar.bz2
-rw-r--r-- 1 root root 230K May 3 10:10 sysconfig.tar
----rwx--- 1 root root 15 May 2 23:42 aa.txt
-rw-r--r-- 1 root root 814K May 2 23:37 messages
-rw-r--r-- 1 root root 106K May 2 23:28 messages.zip
-rw-r--r-- 1 root root 79K May 2 23:24 sysconfig.zip
-rw-r--r-- 1 root root 813K May 2 23:00 m1
-rw------- 1 root root 104K May 2 22:59 m.gz.txt
-rw-r--r-- 1 root root 813K May 2 22:46 mmm
-rw-r--r-- 1 root root 813K May 2 17:58 mm
-rw-r--r-- 1 root root 49K May 2 17:58 mm.bz2
-rw-r--r-- 1 root root 194K May 2 17:55 m.z
-rw------- 1 root root 104K May 2 17:31 m.gz

Linux文件归档工具——tar的更多相关文章

  1. Linux文件归档工具——cpio

    一cpio的介绍 功能:复制文件从或到归档 cpio命令是通过重定向的方式将文件进行打包备份,还原恢复的工具,它可以解压以“.cpio”或者“.tar”结尾的文件. cpio [选项] > 文件 ...

  2. Linux下压缩工具gzip和归档工具tar及其实战shell应用

    Linux下压缩工具gzip和归档工具tar及其实战shell应用       第一章:gzip的使用技巧 gzip [option]... file... -d: 解压缩,相当于gunzip; -# ...

  3. window与linux文件传输工具

    window与linux文件传输工具 [一般用于SecureCRT ssh中使用] 法一:直接用yum安装lrzsz(推荐) yum install lrzsz -y 注意:rhel安装完系统后 直接 ...

  4. 9款最佳的Linux文件比较工具

    程序员和撰稿人在编写程序文件或平常的文本文件时,有时想知道两个文件或同一文件的两个版本之间的差异.你在Linux上比较两个计算机文件时,文件内容之间的差异就叫diff.这一描述来源于提到diff的输出 ...

  5. Linux文件编辑工具——VIM

    Linux文件编辑工具--VIM 1.VIM基本概述 1.1 什么是vim vi 和 vim 是 Linux 下的一个文本编辑工具.(可以理解为 windows 的记事本,或 Notepad++ 1. ...

  6. Linux文件系统测试工具

    一.文件系统测试工具简介 1.LTP 参考网站:http://oss.sgi.com/projects/ltp/ LTP(Linux Test Project)是由SGI和IBM联合发起的项目,提供一 ...

  7. Linux文件查找工具之find “大宝剑”--转载

    原文地址:http://xinzong.blog.51cto.com/10018904/1749465 一.文件查找工具常用软件 locate: locate命令其实是find -name的另一种写法 ...

  8. Linux文件归档和解压缩

    1.tar tar命令相当于归档,不做压缩,解压同样也是把归档文件释放出来(归档通俗上可以理解为把文件分类,把一些文件放到一个包中归类,方便用户管理) 解包:tar -zxvf file.tar #解 ...

  9. Linux文件同步工具之rsync

    学习背景 1.最近公司的项目在使用jenkins做自动化构建,因为jenkins在构建时是比较耗性能的,便单独使用了一台服务器做构建服务器.但是个人觉得这样成本过高,单独拿一台服务器来构建并且该服务器 ...

随机推荐

  1. 【TCP】tcp协议通信中io

    阻塞IO recv,接收数据,若没有,将阻塞, 当对方发数据来后,linux内核缓冲区得到数据, 内核数据复制到recv()调用所在的用户空间, 阻塞解除,进行下一步处理, 非阻塞IO 轮询调用rec ...

  2. Android SDK的下载与安装*(PC版)

    Android SDK的下载与安装   一.Android SDK简介下载地址:https://www.androiddevtools.cn/ 将下载后的安装包解压到相应的目录下,如下图: 三.安装A ...

  3. python使用qq邮箱向163邮箱发送邮件、附件

    在生成html测试报告后 import smtplib,time from email.mime.text import MIMEText from email.mime.multipart impo ...

  4. .Net Core 使用Redis进行数据缓存

    1.运行环境 开发工具:Visual Studio 2017 JDK版本:.NET Core 2.0 项目管理工具:nuget 2.GITHUB地址 https://github.com/nbfujx ...

  5. pytest_用例运行级别_函数级

    '''  函数级(setup_function/teardown_function只对函数用例生 效(不在类中)在类中是用该方法不生效 ''' import pytest def setup_mod ...

  6. MongoDB拥有SSD秒杀高富帅使用过程分享

    [IT168现场报道]2013年4月18-20日,第四届中国数据库技术大会(DTCC 2013)在北京福朋喜来登酒店拉开序幕.在为期三天的会议中,大会将围绕大数据应用.数据架构.数据管理(数据治理). ...

  7. LightOJ 1418 Trees on My Island (Pick定理)

    题目链接:LightOJ 1418 Problem Description I have bought an island where I want to plant trees in rows an ...

  8. OSX 创建 randisk(或称 tmpfs)

    创建步骤: #!/bin/bash ramdisk_size_in_mb= mount_point=/private/tmp ramdisk_size_in_sectors=$((${ramdisk_ ...

  9. tensorflow|tf.train.slice_input_producer|tf.train.Coordinator|tf.train.start_queue_runners

    #### ''' tf.train.slice_input_producer :定义样本放入文件名队列的方式[迭代次数,是否乱序],但此时文件名队列还没有真正写入数据 slice_input_prod ...

  10. 深入理解__proto__ 、constructor和prototype的关系

    深入理解__proto__ .constructor和prototype的关系 2013-11-12 09:56 1390人阅读 评论(3) 收藏 举报  分类: 前端之Javascript(59)  ...