原创内容,转载请注明出处: https://www.myzhenai.com.cn/post/2610.html https://www.myzhenai.com/thread-17997-1-1.html
就我所了解的, Linux主流的版本分为两个派系, 一个是RedHat派生的 fedora centos和Debian派生的debian和ubuntu, 这两者之间还是有一些小的区别, 比如redhat下的安装包文件是rpm格式的, debian下的安装包是deb格式的. 然后系统控制上也有些命令不一样, 比如命令行下升级, redhat是用yum,而debian下是用apt-get.
Linux下查询命令参数请用 -h –help 即命令后边跟上-h 或者 –help
rpm 命令
[RucLinux@localhost ~]$ rpm --help
用法: rpm [选项...]
--quiet
Query/Verify package selection options:
-a, --all query/verify all packages
-f, --file query/verify package(s) owning file
-g, --group query/verify package(s) in group
-p, --package query/verify a package file
-W, --ftswalk query/verify package(s) from TOP file tree
walk
--pkgid query/verify package(s) with package
identifier
--hdrid query/verify package(s) with header
identifier
--fileid query/verify package(s) with file identifier
--specfile query a spec file
--triggeredby query the package(s) triggered by the
package
--whatrequires query/verify the package(s) which require a
dependency
--whatprovides query/verify the package(s) which provide a
dependency
--nomanifest do not process non-package files as
manifests
Query options (with -q or --query):
-c, --configfiles list all configuration files
-d, --docfiles list all documentation files
--dump dump basic file information
-l, --list list files in package
--queryformat=QUERYFORMAT use the following query format
-s, --state display the states of the listed files
Verify options (with -V or --verify):
--nofiledigest don't verify digest of files
--nomd5 don't verify digest of files
--nofiles don't verify files in package
--nodeps don't verify package dependencies
--noscript don't execute verify script(s)
File tree walk options (with --ftswalk):
--comfollow follow command line symlinks
--logical logical walk
--nochdir don't change directories
--nostat don't get stat info
--physical physical walk
--seedot return dot and dot-dot
--xdev don't cross devices
--whiteout return whiteout information
Signature options:
--addsign sign package(s) (identical to --resign)
-K, --checksig verify package signature(s)
--delsign delete package signatures
--import import an armored public key
--resign sign package(s) (identical to --addsign)
--nodigest don't verify package digest(s)
--nosignature don't verify package signature(s)
Database options:
--initdb initialize database
--rebuilddb rebuild database inverted lists from
installed package headers
Install/Upgrade/Erase options:
--aid add suggested packages to transaction
--allfiles install all files, even configurations
which might otherwise be skipped
--allmatches remove all packages which match
(normally an error is generated if
specified multiple packages)
--badreloc relocate files in non-relocatable package
-e, --erase= + erase (uninstall) package
--excludedocs do not install documentation
--excludepath= skip files with leading component
--fileconflicts detect file conflicts between packages
--force short hand for --replacepkgs --replacefiles
-F, --freshen=+ upgrade package(s) if already installed
-h, --hash print hash marks as package installs (good
with -v)
--ignorearch don't verify package architecture
--ignoreos don't verify package operating system
--ignoresize don't check disk space before installing
-i, --install install package(s)
--justdb update the database, but do not modify the
filesystem
--nodeps do not verify package dependencies
--nofiledigest don't verify digest of files
--nomd5 don't verify digest of files (obsolete)
--nocontexts don't install file security contexts
--noorder do not reorder package installation to
satisfy dependencies
--nosuggest do not suggest missing dependency
resolution(s)
--noscripts do not execute package scriptlet(s)
--notriggers do not execute any scriptlet(s) triggered
by this package
--oldpackage upgrade to an old version of the package
(--force on upgrades does this
automatically)
--percent print percentages as package installs
--prefix= relocate the package to , if
relocatable
--relocate== relocate files from path to
--replacefiles ignore file conflicts between packages
--replacepkgs reinstall if the package is already present
--test don't install, but tell if it would work or
not
-U, --upgrade=+ upgrade package(s)
Common options for all rpm modes and executables:
-D, --define='MACRO EXPR' define MACRO with value EXPR
-E, --eval='EXPR' print macro expansion of EXPR
--macros= read instead of default file(s)
--nodigest don't verify package digest(s)
--nosignature don't verify package signature(s)
--rcfile= read instead of default file(s)
-r, --root=ROOT use ROOT as top level directory (default:
"/")
--querytags display known query tags
--showrc display final rpmrc and macro configuration
--quiet provide less detailed output
-v, --verbose provide more detailed output
--version print the version of rpm being used
Options implemented via popt alias/exec:
--scripts list install/erase scriptlets from
package(s)
--setperms set permissions of files in a package
--setugids set user/group ownership of files in a
package
--conflicts list capabilities this package conflicts
with
--obsoletes list other packages removed by installing
this package
--provides list capabilities that this package provides
--requires list capabilities required by package(s)
--info list descriptive information from package(s)
--changelog list change logs for this package
--xml list metadata in xml
--triggers list trigger scriptlets from package(s)
--last list package(s) by install time, most
recent first
--dupes list duplicated packages
--filesbypkg list all files from each package
--fileclass list file names with classes
--filecolor list file names with colors
--fscontext list file names with security context from
file system
--fileprovide list file names with provides
--filerequire list file names with requires
--filecaps list file names with POSIX1.e capabilities
Help options:
-?, --help Show this help message
--usage Display brief usage message
演示
rpm -ivh xxxx.rpm 安装某个文件 rpm -qa|grep xxx 查询已经安装的所有包含某个文件名的所有包
yum 命令
[RucLinux@localhost ~]$ yum --help
已加载插件:fastestmirror, refresh-packagekit, security
Usage: yum [options] COMMAND
List of Commands:
check Check for problems in the rpmdb
check-update 检查是否有软件包更新
clean 删除缓存的数据
deplist 列出软件包的依赖关系
distribution-synchronization Synchronize installed packages to the latest available versions
downgrade downgrade a package
erase 从系统中移除一个或多个软件包
groupinfo 显示组的详细信息
groupinstall 向系统中安装一组软件包
grouplist 列出可安装的组
groupremove 从系统中移除一组软件包
help 显示用法信息
history Display, or use, the transaction history
info 显示关于软件包或组的详细信息
install 向系统中安装一个或多个软件包
list 列出一个或一组软件包
load-transaction load a saved transaction from filename
makecache 创建元数据缓存
provides 查找提供指定内容的软件包
reinstall 覆盖安装一个包
repolist 显示已配置的仓库
resolvedep 判断哪个包提供了指定的依赖
search 在软件包详细信息中搜索指定字符串
shell 运行交互式的 yum 外壳
update 更新系统中的一个或多个软件包
update-minimal Works like update, but goes to the 'newest' package match which fixes a problem that affects your system
updateinfo Acts on repository update information
upgrade 更新软件包同时考虑软件包取代关系
version Display a version for the machine and/or available repos.
Options:
-h, --help show this help message and exit
-t, --tolerant 容忍错误
-C, --cacheonly run entirely from system cache, don't update cache
-c [config file], --config=[config file]
配置文件路径
-R [minutes], --randomwait=[minutes]
命令最长等待时间
-d [debug level], --debuglevel=[debug level]
调试输出级别
--showduplicates 在 list/search 命令下,显示仓库里重复的条目。
-e [error level], --errorlevel=[error level]
错误输出级别
--rpmverbosity=[debug level name]
debugging output level for rpm
-q, --quiet 安静的操作
-v, --verbose verbose operation
-y, --assumeyes 回答所有的问题为是
--assumeno answer no for all questions
--version 显示 Yum 版本信息并退出
--installroot=[path] 设置目标根目录
--enablerepo=[repo] 启用一个或多个仓库(支持通配符)
--disablerepo=[repo] 禁用一个或多个仓库(支持通配符)
-x [package], --exclude=[package]
用全名或通配符排除软件包
--disableexcludes=[repo]
禁止从主配置,从仓库或者从任何位置排除
--obsoletes 升级时考虑软件包取代关系
--noplugins 禁用 Yum 插件
--nogpgcheck 禁用 gpg 签名检测
--disableplugin=[plugin]
禁用指定名称的插件
--enableplugin=[plugin]
enable plugins by name
--skip-broken 跳过有依赖问题的软件包
--color=COLOR 配置是否使用颜色
--releasever=RELEASEVER
set value of $releasever in yum config and repo files
--downloadonly don't update, just download
--downloaddir=DLDIR specifies an alternate directory to store packages
--setopt=SETOPTS set arbitrary config and repo options
插件选项:
--security Include security relevant packages
--bugfixes Include bugfix relevant packages
--cve=CVE Include packages needed to fix the given CVE
--bz=BZ Include packages needed to fix the given BZ
--sec-severity=SEVERITY
Include security relevant packages, of this severity
--advisory=ADVISORY
Include packages needed to fix the given advisory
演示
yum install xxx 安装某个包 yum update 升级系统 yum clan all 清除所有缓存 yum upgread 更新系统
apt-get 命令
ruclinux@debian:~$ apt-get --help
apt 1.0.9.8.4,用于 i386 构架,编译于 Dec 11 2016 09:48:30
用法: apt-get [选项] 命令
apt-get [选项] install|remove 软件包1 [软件包2 ...]
apt-get [选项] source 软件包1 [软件包2 ...]
apt-get 是一个用于下载和安装软件包的简易命令行界面。
最常用命令是 update 和 install。
命令:
update - 取回更新的软件包列表信息
upgrade - 进行一次升级
install - 安装新的软件包(注:软件包名称是 libc6 而非 libc6.deb)
remove - 卸载软件包
autoremove - 卸载所有自动安装且不再使用的软件包
purge - 卸载并清除软件包的配置
source - 下载源码包文件
build-dep - 为源码包配置所需的编译依赖关系
dist-upgrade - 发布版升级,见 apt-get(8)
dselect-upgrade - 根据 dselect 的选择来进行升级
clean - 删除所有已下载的包文件
autoclean - 删除已下载的旧包文件
check - 核对以确认系统的依赖关系的完整性
changelog - 下载指定软件包,并显示其changelog
download - 下载指定的二进制包到当前目录
选项:
-h 本帮助文档。
-q 让输出可作为日志 - 不显示进度
-qq 除了错误外,什么都不输出
-d 仅仅下载 - 【不】安装或解开包文件
-s 不作实际操作。只是依次模拟执行命令
-y 对所有询问都回答是(Yes),同时不作任何提示
-f 当出现破损的依赖关系时,程序将尝试修正系统
-m 当有包文件无法找到时,程序仍尝试继续执行
-u 显示已升级的软件包列表
-b 在下载完源码包后,编译生成相应的软件包
-V 显示详尽的版本号
-c=? 读取指定配置文件
-o=? 设置任意指定的配置选项,例如 -o dir::cache=/tmp
请查阅 apt-get(8)、sources.list(5) 和 apt.conf(5)的参考手册
以获取更多信息和选项。
本 APT 具有超级牛力。
演示
apt-get install xxx 安装某个安装包 apt-get update 升级系统 apt-get upgrade 更新系统 升级的时候需要 update和upgrade配合使用
dpkg 命令
ruclinux@debian:~$ dpkg --help 用法:dpkg [< 选项> ...] < 命令> 命令: -i|--install < .deb 文件名> ... | -R|--recursive < 目录> ... --unpack < .deb 文件名> ... | -R|--recursive < 目录> ... -A|--record-avail < .deb 文件名> ... | -R|--recursive < 目录> ... --configure < 软件包名> ... | -a|--pending --triggers-only < 软件包名> ... | -a|--pending -r|--remove < 软件包名> ... | -a|--pending -P|--purge < 软件包名> ... | -a|--pending -V|--verify < 软件包名> ... 检查包的完整性。 --get-selections [< 表达式> ...] 把已选中的软件包列表打印到标准输出。 --set-selections 从标准输入里读出要选择的软件。 --clear-selections 取消选中所有不必要的软件包。 --update-avail < 软件包文件> 替换现有可安装的软件包信息。 --merge-avail < 软件包文件> 把文件中的信息合并到系统中。 --clear-avail 清除现有的软件包信息。 --forget-old-unavail 忘却已被卸载的不可安装的软件包。 -s|--status < 软件包名> ... 显示软件包详尽的状态信息。 -p|--print-avail < 软件包名> ... 显示可供安装的版本详情。 -L|--listfiles < 软件包名> ... 列出所有属于该个(或多个)软件包的文件。 -l|--list [< 表达式> ...] 简明地列出软件包的状态。 -S|--search < 表达式> ... 搜寻拥有该文件(或多个文件)的包。 -C|--audit [< 表达式> ...] 检查搜寻残损的软件包。 --add-architecture < 体系结构> 添加 < 体系结构> 到体系结构列表。 --remove-architecture < 体系结构> 从架构列表中移除 < 体系结构>。 --print-architecture 显示 dpkg 体系架构。 --compare-vesions < 关系> 比较版本号 - 见下。 --force-help 显示本强制选项的帮助信息。 -Dh|--debug=help 显示有关出错调试的帮助信息。 -?, --help 显示本帮助信息。 --version 显示版本信息。 对归档文件使用 dpkg -b|--build|-c|--contents|-e|--control|-I|--info|-f|--field| -x|--extract|-X|--vextract|--fsys-tarfile (输入 dpkg-deb --help)。 供内部使用:dpkg --assert-support-predepends | --predep-package | --assert-working-epoch | --assert-long-filenames | --assert-multi-conrep | --assert-multi-arch | --assert-versioned-provides. 选项: --admindir=< 目录> 使用 < 目录> 而非 /var/lib/dpkg。 --root=< 目录> 安装到另一个根目录下。 --instdir=< 目录> 改变安装目录的同时保持管理目录不变。 --path-exclude=< 表达式> 不要安装符合Shell表达式的路径。 --path-include=< 表达式> 在排除模式后再包含一个模式。 -O|--selected-only 忽略没有被选中安装或升级的软件包。 -E|--skip-same-version 忽略版本与已安装软件版本相同的软件包。 -G|--refuse-downgrade 忽略版本早于已安装软件版本的的软件包。 -B|--auto-deconfigure 就算会影响其他软件包,也要安装。 --[no-]triggers 跳过或强制随之发生的触发器处理。 --verify-format=< 格式> 检查输出格式('rpm'被支持)。 --no-debsig 不去尝试验证软件包的签名。 --no-act|--dry-run|--simulate 仅报告要执行的操作 - 但是不执行。 -D|--debug=< 八进制数> 开启调试(参见 -Dhelp 或者 --debug=help)。 --status-fd发送状态更新到文件描述符 。 --status-logger=< 命令> 发送状态更新到 < 命令> 的标准输入。 --log=< 文件名> 将状态更新和操作信息到 < 文件名>。 --ignore-depends=< 软件包>,... 忽略关于 < 软件包> 的所有依赖关系。 --force-... 忽视遇到的问题(参见 --force-help)。 --no-force-...|--refuse-... 当遇到问题时中止运行。 --abort-after 累计遇到 个错误后中止。 可供--compare-version 使用的比较运算符有: lt le eq ne ge gt (如果版本号为空,那么就认为它先于任意版本号); lt-nl le-nl ge-nl gt-nl (如果版本号为空,那么就认为它后于任意版本号); < << <= = >= >> > (仅仅是为了与主控文件的语法兼容)。 'apt' 和 'aptitude' 提供了更为便利的软件包管理。
演示
dpkg --install xxx 安装某个安装包 dpkg --remove 卸载删除某个安装包 dpkg --list 查看某个包的依赖信息
su 命令
ruclinux@debian:~$ su --help 用法:su [选项] [登录] 选项: -c, --command COMMAND 将 COMMAND 传递至启动的 shell -h, --help 显示此帮助信息并退出 -, -l, --login 将 shell 设为登录 shell -m, -p, --preserve-environment 不重置环境变量并保持同一 shell -s, --shell SHELL 使用 SHELL 而非 passwd 中的默认值
演示
su root 切换到root账户,需要输入密码
sicnature ---------------------------------------------------------------------
I P 地 址: 216.73.216.210
区 域 位 置: 美国加利福尼亚洛杉矶
系 统 信 息:
Original content, please indicate the source:
同福客栈论坛 | 蟒蛇科普 | 海南乡情论坛 | JiaYu Blog
sicnature ---------------------------------------------------------------------
Welcome to reprint. Please indicate the source https://myzhenai.com.cn/post/2610.html




没有评论