Linux package compression, soft links, hard links, configure mirroring source

  1. tar command: tar -cvf packed .tar file path of the file to be packaged    the packaged file into tar package, but has not been compressed;
    [@ Server- the root n93yom Test] LL # 
    Total 0 
    -rw-R & lt - r-- . 1 the root guanbin 0 Jul- 22 is  16 : 09 test1 
    [the root @ Server -n93yom Test] Touch # . 1 .py 
    [the root @ Server -n93yom the Test] Touch # 2 .py 
    [root @ Server -n93yom the Test] Touch # 3 .py 
    [root @ Server -n93yom the Test] # tar -cvf haha.tar * .py files in the current directory // ending the .py packaged into haha.tar
     . 1 .py
     2 .py
     . 3 .py

    tar options Description: 1.c to generate archive files, create a package file; 2.x to unlock the archive; 3.v as set out in detail the process of archiving solution archives, showing progress; 4 specify the archive file name, f behind. must be .tar file, it is necessary to finally put option

     

  2. tar -xvf to unpack the package file
    [root@Server-n93yom tmp]# tar -xvf haha.tar
    1.py
    2.py
    3.py
    [root@Server-n93yom tmp]# ll
    total 33808
    -rw-r--r--  1 root root        0 Jul 27 23:18 1.py
    -rw-r--r--  1 root root        0 Jul 27 23:18 2.py
    -rw-r--r--  1 root root        0 Jul 27 23:18 3.py

     

  3. gizp command and tar command used in combination, file archiving and compression: tar is only responsible for packaging, gzip compression in charge: in linux most common format: xxx.tar.gz
    [root@Server-n93yom tmp]# tar -zcvf haha.tar.gz  *.py
    1.py
    2.py
    3.py
    [root@Server-n93yom tmp]# ls -lh
    total 34M
    -rw-r--r--  1 root root   0 Jul 27 23:18 1.py
    -rw-r--r--  1 root root   0 Jul 27 23:18 2.py
    -rw-r--r--  1 root root   0 Jul 27 23:18 3.py
    -rw-r--r--  . 1 the root the root 10K Jul- 27  23 is : 20 is haha.tar
     -rw-R & lt - r--   . 1 the root the root 129 Jul- 27  23 is : 36 haha.tar.gz // see haha.tar.gz file size is only 129 words festival

     

  4. Extracting tar.gz file: tar -zxvf package file destination path .tar.gz -C ( -C unpacked into the specified directory, attention must exist unzipped )
    [root@Server-n93yom tmp]# tar -zxvf haha.tar.gz -C  /root/python/
    1.py
    2.py
    3.py
    [root@Server-n93yom tmp]# ll -lh /root/python/
    total 0
    -rw-r--r-- 1 root root 0 Jul 27 23:18 1.py
    -rw-r--r-- 1 root root 0 Jul 27 23:18 2.py
    -rw-r--r-- 1 root root 0 Jul 27 23:18 3.py

     

  5. tar command can be combined and packaged into bzip2, tar.bz2 package, usage and the like gzip: compressed tar -jcvf, decompression tar -xcvf


       6.ln -s linked source files linked files Note: -s is no hard links

[root@Server-n93yom ~]# ln -s  /var/log/cloudchef/server/cloudchef.log  cloudchef.log
[root@Server-n93yom ~]# ll
total 8
-rw-------. 1 root root    1706 Jun 17 09:56 anaconda-ks.cfg
-rw-r--r--  1 root root       1 Jul 25 23:05 cal.txt
lrwxrwxrwx  1 root root      39 Jul 27 23:53 cloudchef.log -> /var/log/cloudchef/server/cloudchef.log
drwxr-xr-x  2 root root      42 Jul 27 23:43 python
drwxr-xr-x  2 root guanbin   55 Jul 27 23:20 test
drwxr-xr-x. 2 root root     145 Jul 27 23:45 tmp

      Soft link is actually a shortcut to the source file; in fact, the data in the file name and file linux is stored separately;

      

      7. to install and uninstall the files using apt in ubuntu, apt full name: Advanced Packaging Tool, is a package management tool under linux

  •       Install the package: sudo apt install package
  •        Uninstall the packages: sudo aptremove package
  •        Update installed packages: sudo apt upgrade 

  

       8. Configuring the software source: Because to download from the official issuer server package will be very slow, can be downloaded from the domestic mirroring, mirroring domestic sources reported and the source server is the same, is authorized; in in ubuntu

        Mirroring source to the sudo vi /etc/apt/sources.list

 

Guess you like

Origin www.cnblogs.com/guanbin-529/p/11257363.html