Package and Compressed Archive Commands

Package and Compressed Archive Commands

package management commands

debain series (Ubuntu14.04)

  • dpkg local package management commands

    • -i PKG_NAME install/update
    • -r PKG_NAME uninstall
    • -P PKG_NAME uninstall and delete configuration files
    • -c DEB_PKG List the contents of the deb package
    • -l [PKG_NAME] list package information
    • -s PKG_NAME list package details
    • -L PKG_NAME list package installation directory
  • apt command Software source management command (-y automatically answers yes)

apt-get update 更新软件包源 (/etc/apt/sources.list)
apt-get install PKG_NAME 安装/更新软件包
apt-get source PKG_NAME 获取源码 
apt-get remove PKG_NAME 删除软件包
apt-get purge PKG_NAME(remove --purge) 删除软件包及配置文件
apt-get autoremove [PKG_NAME] 自动检索并删除不需要的软件包(危险命令)
apt-get upgrade PKG_NAME更新软件包
apt-get dist-upgrade 更新系统版本

apt-get clean 清空软件包目录(/var/cache/apt/archives)
apt-get autoclean 清除软件包目录中不需要的软件包
apt-get build-dep PKG_NAME 解决编译PKG_NAME需要的环境

apt-cache search PKG_NAME 搜索软件包
apt-cache showpkg PKG_NAME 显示软件包信息
apt-cache dumpavail 打印可用软件包列表所有软件包信息
apt-cache pkgnames [PKG_NAME]打印软件包列表中所有软件包名

apt-file search FILE 查询文件所在包(需要使用apt-file update更新查询源)

The aptitude command is similar to the apt-get command

The method of configuring the source on the local hard disk is to write apt-get update in the source configuration file /etc/apt/sources.list and use it after updating the sourcedeb file:///[挂载点] trusty main restricted

redhat series (CentOS6.5)

  • rpm local package management commands

    • -i PKG_NAME install
    • -U PKG_NAME upgrade
    • -e PKG_NAME uninstall
    • -h progress# means %2
    • -v verbose process
    • -vv more verbose process
    • -q Query packages (requires combination)
      • -qa [PKG_NAME] show all package names
      • -qi PKG_NAME Display package description information
      • -ql PKG_NAME show the package's file list (installation location)
      • -qc PKG_NAME show package configuration file
      • -qd PKG_NAME show package help file
      • -qf FILE specifies which package installation generated the file
      • -qR PKG_NAME query package dependencies
      • -qp RPM_PKG Query information about packages not installed
  • yum software source management command (-y automatically answers yes)

yum clean [packages|headers|metadata|dbcache|all] 清除缓存
yum list [all|available|installed|updates|PKGNAME] 软件包可用列表
yum search PKG_NAME 搜索软件包

yum update/update_to PKG_NAME 升级/升级到 软件包
yum install PKG_NAME 安装软件包
yum remove PKG_NAME 卸载软件包以及依赖的软件包(危险命令)

yum grouplist [PKG_GROUP] 列出软件包组
yum groupinstall PKG_GROUP 安装软件包组
yum groupremove PKG_GROUP 卸载软件包组

yum repolist [all|enabled|disabled] 显示repo列表和信息
yum info 查看yum源信息
yum provides FILE 显示文件FILE所属的包
yum localinstall PKG_NAME 本地包安装(自动解决依赖关系)

Local hard disk configuration source method source configuration file /etc/yum.repos.d/CentOS-Base.repo [base] container name name container description mirrorlist mirror site baseurl yum source server address is enabled or not (1/0) in /etc Move other repo files out of the directory in the /yum.repos.d directory/rename the suffix and modify the /etc/yum.repos.d/CentOS-Media.repo filebaseurl=file:///[挂载点] enable=1

zip archive command

Compression ratio comparison: zip < gzip < bzip2 < xz FILE.gbxz means files with extension .gz/.bz2/.xz

compression

  • gzip/bzip2/xz FILE compression generates FILE.gbxz (the original file will be deleted)
  • gunzip/bunzip2/unxz FILE(.gz/.bz2/.xz) Unzip the file (the original file will be deleted)
  • zcat/bzcat/xzcat FILE.gbxz View the contents of text files without decompression gzip/bzip2/xz general options
    • -k keep source files (gzip not supported)
    • -d decompress
    • -N specifies the compression ratio in the range [1, 9], the default is 6
  • zip FILE.zip FILE... A command that both archives and compresses (the original file is not deleted after compression, the compression format supported by each OS by default.)
  • unzip FILE.zip decompression (do not delete the original file)

archive

Decompression and expansion: tar xf FILE.gbxz Archive compression (.gz): tar zxf FILE

  • tar -f FILE.gbxz [FILE...] archive (options can be without -)
    • -c archive
    • -x expand
    • -t View a list of filenames in the archive
    • -v show details
    • -f FILE archive filename
    • -C DIR Expand (unzip) in the specified directory
    • -z archive/expand also decompress/compress .gz files
    • -j archive/expand also decompress/compress .bz2 files
    • -J archive/expand also decompress/compress .xz files
    • -p preserve the original permissions and attributes of the backup data
    • -P Expand directly under the original absolute path of the file before archiving --exclude=FILE Do not archive FILE during archiving
  • cpio 's ancient but useful archive and expand commands
    • -o copy output (backup)
    • -i copy from file or device to system
    • -d Automatically create a new directory, otherwise the expansion may not be in the same directory
    • -B default blocks increase from 512b to 5120b to increase the storage speed of large files
    • -u new file overwrites old file
    • -t with -i to view file or device content
    • -c Store in a portable format format
    • -v Display detailed information cpio -ovcB > [FILE/DEVICE] Backup (requires find command) cpio -ivcdu < [FILE/DEVICE] Restore cpio -ivct < [FILE|DEVICE] View
  • dd if=INPUT_FILE of=OUTPUT_FILE bs=BLOCK_SIZE count=COUNT [skip=SKIP] [seek=SEEK] Copy from INPUT_FILE to OUTPUT_FILE The copy size is BLOCK_SIZE*COUNT. skip: INPUT_FILE skip how many SKIP bytes to start copying seek: OUTPUT_FILE Start copying by skipping SEEK bytes.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325456664&siteId=291194637