# 指定查看前3行内容 [root@192 etc]# head -n 3 services # /etc/services: # $Id: services,v 1.55 2013/04/14 ovasik Exp $ # # 参数与指定行数不加空格 [root@192 etc]# head -n2 services # /etc/services: # $Id: services,v 1.55 2013/04/14 ovasik Exp $ # 默认10行,不写参数 -n [root@192 etc]# head services # /etc/services: # $Id: services,v 1.55 2013/04/14 ovasik Exp $ # # Network services, Internet style # IANA services version: last updated 2013-04-10 # # Note that it is presently the policy of IANA to assign a single well-known # port number for both TCP and UDP; hence, most entries here have two entries # even if the protocol doesn't support UDP operations. # Updated from RFC 1700, ``Assigned Numbers'' (October 1994). Not all ports
# 查询命令所在目录 [root@VM-0-9-centos ~]# which ll alias ll='ls -l --color=auto' /usr/bin/ls # 只能查询命令 [root@VM-0-9-centos ~]# which help /usr/bin/which: no help in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)
7.36 XiaoMi/MiuiBrowser/15.6.12" [root@VM-0-9-centos ~]# more /etc/inittab # inittab is no longer used when using systemd. # # ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM. # # Ctrl-Alt-Delete is handled by /usr/lib/systemd/system/ctrl-alt-del.target # # systemd uses 'targets' instead of runlevels. By default, there are two main targets: # # multi-user.target: analogous to runlevel 3 # graphical.target: analogous to runlevel 5 # # To view current default target, run: # systemctl get-default # # To set a default target, run: # systemctl set-default TARGET.target # # 去除以"#"号开头的所在行 [root@VM-0-9-centos ~]# grep -v ^# /etc/inittab # 去除含有"systemctl"的所在行 [root@VM-0-9-centos ~]# grep -v systemctl /etc/inittab # inittab is no longer used when using systemd. # # ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM. # # Ctrl-Alt-Delete is handled by /usr/lib/systemd/system/ctrl-alt-del.target # # systemd uses 'targets' instead of runlevels. By default, there are two main targets: # # multi-user.target: analogous to runlevel 3 # graphical.target: analogous to runlevel 5 # # To view current default target, run: # # To set a default target, run: # [root@VM-0-9-centos ~]#
# 查看命令帮助信息 [root@VM-0-9-centos ~]# man ls LS(1) User Commands LS(1)
NAME ls - list directory contents
SYNOPSIS ls [OPTION]... [FILE]...
DESCRIPTION List information about the FILEs (the current directory by default). Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.
Mandatory arguments to long options are mandatory for short options too.
-a, --all do not ignore entries starting with .
-A, --almost-all ...skipping...
SUMMARY OF LESS COMMANDS
Commands marked with * may be preceded by a number, N. Notes in parentheses indicate the behavior if N is given. A key preceded by a caret indicates the Ctrl key; thus ^K is ctrl-K.
h H Display this help. q :q Q :Q ZZ Exit. ---------------------------------------------------------------------------
MOVING
e ^E j ^N CR * Forward one line (or N lines). y ^Y k ^K ^P * Backward one line (or N lines). f ^F ^V SPACE * Forward one window (or N lines). b ^B ESC-v * Backward one window (or N lines). z * Forward one window (and set window to N). w * Backward one window (and set window to N). ESC-SPACE * Forward one window, but don't stop at end-of-file. d ^D * Forward one half-window (and set half-window to N). u ^U * Backward one half-window (and set half-window to N). ESC-) RightArrow * Left one half screen width (or N positions). ESC-( LeftArrow * Right one half screen width (or N positions). HELP -- Press RETURN for more, or q when done # 查看配置文件帮助 [root@VM-0-9-centos ~]# man services 没有 services 的手册页条目
# 查看 mkdir 命令的帮助 [root@VM-0-9-centos tat_agent]# mkdir --help 用法:mkdir [选项]... 目录... Create the DIRECTORY(ies), if they do not already exist.
Mandatory arguments to long options are mandatory for short options too. -m, --mode=MODE set file mode (as in chmod), not a=rwx - umask -p, --parents no error if existing, make parent directories as needed -v, --verbose print a message for each created directory -Z set SELinux security context of each created directory to the default type --context[=CTX] like -Z, or if CTX is specified then set the SELinux or SMACK security context to CTX --help 显示此帮助信息并退出 --version 显示版本信息并退出
'touch' changes the access and/or modification times of the specified files. Synopsis:
touch [OPTION]... FILE...
Any FILE argument that does not exist is created empty, unless option '--no-create' ('-c') or '--no-dereference' ('-h') was in effect.
A FILE argument string of '-' is handled specially and causes 'touch' to change the times of the file associated with standard output.
--zz-Info: (coreutils.info.gz)touch invocation, 153 lines --Top---------------------------------- Welcome to Info version 5.1. Type h for help, m for menu item.
[root@VM-0-9-centos ~]# w 20:01:00 up 2 days, 19:48, 4 users, load average: 0.68, 0.37, 0.27 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT root pts/0 123.147.248.159 19:40 4.00s 0.05s 0.00s w root pts/1 123.147.248.159 19:40 20:44 1.08s 1.06s top tiam pts/3 123.147.248.159 19:58 20.00s 0.02s 0.02s -bash tiam pts/4 123.147.248.159 19:58 2:23 0.15s 0.13s top [root@VM-0-9-centos ~]# write tiam write: tiam is logged in more than once; writing to pts/3 Hello I very miss you everyday
1 2 3 4 5 6
[tiam@VM-0-9-centos ~]$ Message from root@VM-0-9-centos on pts/0 at 20:01 ... Hello I very miss you everyday EOF
# 给root发送邮件,不需要在线,不需要联网 [root@VM-0-9-centos ~]# mail root Subject: test Hello Nice to meet you EOT # 查看本机收到的邮件 [root@VM-0-9-centos ~]# mail Heirloom Mail version 12.5 7/5/10. Type ? for help. "/var/spool/mail/root": 1 message 1 new >N 1 root Wed Dec 22 20:15 18/645 "test" & ^H^H^[^CInterrupt & Held 1 message in /var/spool/mail/root
# 查看init配置文件 [tiam@VM-0-9-centos ~]$ cat /etc/inittab # inittab is no longer used when using systemd. # # ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM. # # Ctrl-Alt-Delete is handled by /usr/lib/systemd/system/ctrl-alt-del.target # # systemd uses 'targets' instead of runlevels. By default, there are two main targets: # # multi-user.target: analogous to runlevel 3 # graphical.target: analogous to runlevel 5 # # To view current default target, run: # systemctl get-default # # To set a default target, run: # systemctl set-default TARGET.target # [tiam@VM-0-9-centos ~]$
help.txt For Vim version 7.4. Last change: 2012 Dec 06
VIM - main help file k Move around: Use the cursor keys, or "h" to go left, h l "j" to go down, "k" to go up, "l" to go right. j Close this window: Use ":q<Enter>". Get out of Vim: Use ":qa!<Enter>" (careful, all changes are lost!).
Jump to a subject: Position the cursor on a tag (e.g. bars) and hit CTRL-]. With the mouse: ":set mouse=a" to enable the mouse (in xterm or GUI). Double-click the left mouse button on a tag, e.g. bars. Jump back: Type CTRL-T or CTRL-O (repeat to go further back).
Get specific help: It is possible to go directly to whatever you want help
[root@VM-0-9-centos ~]# rpm -q yum 未安装软件包 yum [root@VM-0-9-centos ~]# rpm -qa ustr-1.0.4-16.el7.x86_64 libselinux-devel-2.5-15.el7.x86_64 libdaemon-0.14-7.el7.x86_64 libXft-2.3.2-2.el7.x86_64 python-2.7.5-90.el7.x86_64 keyutils-libs-devel-1.5.8-3.el7.x86_64 ncurses-5.9-14.20130511.el7_4.x86_64 iptables-1.4.21-35.el7.x86_64 tk-devel-8.5.13-6.el7.x86_64 hostname-3.13-3.el7_7.1.x86_64 satyr-0.13-15.el7.x86_64 libdb4-devel-4.8.30-13.el7.x86_64 info-5.1-5.el7.x86_64 ...... # 查出所有带有python关键字的软件包 [root@VM-0-9-centos ~]# rpm -qa | grep python python-2.7.5-90.el7.x86_64 abrt-python-2.1.11-60.el7.centos.x86_64 python-slip-dbus-0.4.0-4.el7.noarch newt-python-0.52.15-4.el7.x86_64 python-iniparse-0.4-9.el7.noarch python-configobj-4.7.2-7.el7.noarch python-jinja2-2.7.2-4.el7.noarch python-ipaddress-1.0.16-2.el7.noarch ....... # 查询已安装相关信息. [root@VM-0-9-centos ~]# rpm -qi python Name : python Version : 2.7.5 Release : 90.el7 Architecture: x86_64 Install Date: 2021年01月19日 星期二 18时23分40秒 Group : Development/Languages Size : 80835 License : Python Signature : RSA/SHA256, 2020年11月18日 星期三 22时19分50秒, Key ID 24c6a8a7f4a80eb5 Source RPM : python-2.7.5-90.el7.src.rpm Build Date : 2020年11月17日 星期二 06时47分32秒 Build Host : x86-01.bsys.centos.org Relocations : (not relocatable) Packager : CentOS BuildSystem <http://bugs.centos.org> Vendor : CentOS URL : http://www.python.org/ Summary : An interpreted, interactive, object-oriented programming language Description : Python is an interpreted, interactive, object-oriented programming language often compared to Tcl, Perl, Scheme or Java. Python includes modules, classes, exceptions, very high level dynamic data types and dynamic typing. Python supports interfaces to many system calls and libraries, as well as to various windowing systems (X11, Motif, Tk, Mac and MFC).
Programmers can write new built-in modules for Python in C or C++. Python can be used as an extension language for applications that need a programmable interface.
Note that documentation for Python is provided in the python-docs package.
This package provides the "python" executable; most of the actual implementation is within the "python-libs" package. # -p 查询未安装软件包信息 [root@VM-0-9-centos ~]# rpm -qip yum-cron-3.4.3-168.el7.centos.noarch.rpm Name : yum-cron Version : 3.4.3 Release : 168.el7.centos Architecture: noarch Install Date: (not installed) Group : System Environment/Base Size : 52190 License : GPLv2+ Signature : RSA/SHA256, 2020年10月15日 星期四 03时21分12秒, Key ID 24c6a8a7f4a80eb5 Source RPM : yum-3.4.3-168.el7.centos.src.rpm Build Date : 2020年10月02日 星期五 01时03分49秒 Build Host : x86-02.bsys.centos.org Relocations : (not relocatable) Packager : CentOS BuildSystem <http://bugs.centos.org> Vendor : CentOS URL : http://yum.baseurl.org/ Summary : Files needed to run yum updates as a cron job Description : These are the files needed to run yum updates as a cron job. Install this package if you want auto yum updates nightly via cron.
check 检查 RPM 数据库问题 check-update 检查是否有可用的软件包更新 clean 删除缓存数据 deplist 列出软件包的依赖关系 distribution-synchronization 已同步软件包到最新可用版本 downgrade 降级软件包 erase 从系统中移除一个或多个软件包 fs Acts on the filesystem data of the host, mainly for removing docs/lanuages for minimal hosts. fssnapshot Creates filesystem snapshots, or lists/deletes current snapshots. groups 显示或使用、组信息 help 显示用法提示 history 显示或使用事务历史 info 显示关于软件包或组的详细信息 install 向系统中安装一个或多个软件包 list 列出一个或一组软件包 load-transaction 从文件名中加载一个已存事务 makecache 创建元数据缓存 provides 查找提供指定内容的软件包 reinstall 覆盖安装软件包 repo-pkgs 将一个源当作一个软件包组,这样我们就可以一次性安装/移除全部软件包。 repolist 显示已配置的源 search 在软件包详细信息中搜索指定字符串 shell 运行交互式的 yum shell swap Simple way to swap packages, instead of using shell update 更新系统中的一个或多个软件包 update-minimal Works like upgrade, but goes to the 'newest' package match which fixes a problem that affects your system updateinfo Acts on repository update information upgrade 更新软件包同时考虑软件包取代关系 version 显示机器和/或可用的源版本。
Options: -h, --help 显示此帮助消息并退出 -t, --tolerant 忽略错误 -C, --cacheonly 完全从系统缓存运行,不升级缓存 -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] RPM 调试输出级别 -q, --quiet 静默执行 -v, --verbose 详尽的操作过程 -y, --assumeyes 回答全部问题为是 --assumeno 回答全部问题为否 --version 显示 Yum 版本然后退出 --installroot=[path] 设置安装根目录 --enablerepo=[repo] 启用一个或多个软件源(支持通配符) --disablerepo=[repo] 禁用一个或多个软件源(支持通配符) -x [package], --exclude=[package] 采用全名或通配符排除软件包 --disableexcludes=[repo] 禁止从主配置,从源或者从任何位置排除 --disableincludes=[repo] disable includepkgs for a repo or for everything --obsoletes 更新时处理软件包取代关系 --noplugins 禁用 Yum 插件 --nogpgcheck 禁用 GPG 签名检查 --disableplugin=[plugin] 禁用指定名称的插件 --enableplugin=[plugin] 启用指定名称的插件 --skip-broken 忽略存在依赖关系问题的软件包 --color=COLOR 配置是否使用颜色 --releasever=RELEASEVER 在 yum 配置和 repo 文件里设置 $releasever 的值 --downloadonly 仅下载而不更新 --downloaddir=DLDIR 指定一个其他文件夹用于保存软件包 --setopt=SETOPTS 设置任意配置和源选项 --bugfix Include bugfix relevant packages, in updates --security Include security relevant packages, in updates --advisory=ADVS, --advisories=ADVS Include packages needed to fix the given advisory, in updates --bzs=BZS Include packages needed to fix the given BZ, in updates --cves=CVES Include packages needed to fix the given CVE, in updates --sec-severity=SEVS, --secseverity=SEVS Include security relevant packages matching the severity, in updates # 未安装 [root@VM-0-9-centos ~]# yum -v -bash: yum: 未找到命令
# 查看配置文件 [root@bogon ~]# cat /etc/yum.repos.d/CentOS-Base.repo # CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # #
[base] # 容器名 name=CentOS-$releasever - Base mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 #released updates [updates] name=CentOS-$releasever - Updates mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 #additional packages that may be useful [extras] name=CentOS-$releasever - Extras mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
# 查询yum源可安装的软件包列表 $ yum list alsa-plugins-maemo.x86_64 1.1.6-1.el7 base alsa-plugins-oss.i686 1.1.6-1.el7 base alsa-plugins-oss.x86_64 1.1.6-1.el7 base alsa-plugins-pulseaudio.i686 1.1.6-1.el7 base alsa-plugins-pulseaudio.x86_64 1.1.6-1.el7 base alsa-plugins-samplerate.i686 1.1.6-1.el7 base alsa-plugins-samplerate.x86_64 1.1.6-1.el7 base .......
# 搜索软件包 [root@bogon ~]# yum search gcc 已加载插件:fastestmirror Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast Loading mirror speeds from cached hostfile * base: mirrors.bupt.edu.cn * extras: mirrors.bupt.edu.cn * updates: mirrors.neusoft.edu.cn =========================================== N/S matched: gcc =========================================== gcc-c++.x86_64 : C++ support for GCC gcc-gnat.x86_64 : Ada 95 support for GCC gcc-objc.x86_64 : Objective-C support for GCC gcc-objc++.x86_64 : Objective-C++ support for GCC gcc-plugin-devel.x86_64 : Support for compiling GCC plugins libgcc.i686 : GCC version 4.8 shared support library libgcc.x86_64 : GCC version 4.8 shared support library relaxngcc-javadoc.noarch : Javadoc for relaxngcc compat-gcc-44.x86_64 : Compatibility GNU Compiler Collection compat-gcc-44-c++.x86_64 : C++ support for compatibility compiler compat-gcc-44-gfortran.x86_64 : Fortran support for compatibility compiler gcc.x86_64 : Various compilers (C, C++, Objective-C, Java, ...) gcc-gfortran.x86_64 : Fortran support gcc-go.x86_64 : Go support libgomp.i686 : GCC OpenMP v3.0 shared support library libgomp.x86_64 : GCC OpenMP v3.0 shared support library libmudflap.i686 : GCC mudflap shared support library libmudflap.x86_64 : GCC mudflap shared support library libmudflap-devel.i686 : GCC mudflap support libmudflap-devel.x86_64 : GCC mudflap support libquadmath.i686 : GCC __float128 shared support library libquadmath.x86_64 : GCC __float128 shared support library libquadmath-devel.i686 : GCC __float128 support libquadmath-devel.x86_64 : GCC __float128 support relaxngcc.noarch : RELAX NG Compiler Compiler
======================================================================================================== Package 架构 版本 源 大小 ======================================================================================================== 正在安装: gcc x86_64 4.8.5-44.el7 base 16 M 为依赖而安装: cpp x86_64 4.8.5-44.el7 base 5.9 M glibc-devel x86_64 2.17-325.el7_9 updates 1.1 M glibc-headers x86_64 2.17-325.el7_9 updates 691 k kernel-headers x86_64 3.10.0-1160.49.1.el7 updates 9.0 M libmpc x86_64 1.0.1-3.el7 base 51 k mpfr x86_64 3.1.1-4.el7 base 203 k 为依赖而更新: glibc x86_64 2.17-325.el7_9 updates 3.6 M glibc-common x86_64 2.17-325.el7_9 updates 12 M
DESCRIPTION The passwd utility is used to update user's authentication token(s).
This task is achieved through calls to the Linux-PAM and Libuser API. Essentially, it ini‐ tializes itself as a "passwd" service with Linux-PAM and utilizes configured password modules to authenticate and then update a user's password.
A simple entry in the global Linux-PAM configuration file for this service would be: ......
[root@iZbp1244h71ferqzghq7m4Z ~]# type rm rm 是 `rm -i' 的别名 [root@iZbp1244h71ferqzghq7m4Z ~]# which rm alias rm='rm -i' /usr/bin/rm [root@iZbp1244h71ferqzghq7m4Z ~]# whatis rm rm (1) - remove files or directories [root@iZbp1244h71ferqzghq7m4Z ~]# man rm [root@iZbp1244h71ferqzghq7m4Z ~]# info rm [root@iZbp1244h71ferqzghq7m4Z ~]# apropos rm usermod (8) - 修改一个用户账户 hashkit_murmur (3) - libhashkit Documentation memrm (1) - libmemcached Documentation zip_source_stat (3) - get information about zip_source zip_stat (3) - get information about file zip_stat_index (3) - get information about file ...... [root@iZbp1244h71ferqzghq7m4Z ~]# rm --help 用法:rm [选项]... 文件... Remove (unlink) the FILE(s).
-f, --force ignore nonexistent files and arguments, never prompt -i prompt before every removal -I prompt once before removing more than three files, or when removing recursively; less intrusive than -i, while still giving protection against most mistakes --interactive[=WHEN] prompt according to WHEN: never, once (-I), or always (-i); without WHEN, prompt always --one-file-system 递归删除一个层级时,跳过所有不符合命令行参 数的文件系统上的文件 --no-preserve-root do not treat '/' specially --preserve-root do not remove '/' (default) -r, -R, --recursive remove directories and their contents recursively -d, --dir remove empty directories -v, --verbose explain what is being done --help 显示此帮助信息并退出 --version 显示版本信息并退出
GNU coreutils online help: <http://www.gnu.org/software/coreutils/> 请向<http://translationproject.org/team/zh_CN.html> 报告rm 的翻译错误 要获取完整文档,请运行:info coreutils 'rm invocation' [root@iZbp1244h71ferqzghq7m4Z ~]# help cd cd: cd [-L|[-P [-e]]] [dir] Change the shell working directory. Change the current directory to DIR. The default DIR is the value of the HOME shell variable. The variable CDPATH defines the search path for the directory containing DIR. Alternative directory names in CDPATH are separated by a colon (:). A null directory name is the same as the current directory. If DIR begins with a slash (/), then CDPATH is not used. If the directory is not found, and the shell option `cdable_vars' is set, the word is assumed to be a variable name. If that variable has a value, its value is used for DIR. Options: -L force symbolic links to be followed -P use the physical directory structure without following symbolic links -e if the -P option is supplied, and the current working directory cannot be determined successfully, exit with a non-zero status The default is to follow symbolic links, as if `-L' were specified. Exit Status: Returns 0 if the directory is changed, and if $PWD is set successfully when -P is used; non-zero otherwise.
# 将alias命令的输出内容存入 output.txt 的文件中. [root@iZbp1244h71ferqzghq7m4Z data]# alias > output.txt [root@iZbp1244h71ferqzghq7m4Z data]# ls mysql output.txt wwwlogs wwwroot [root@iZbp1244h71ferqzghq7m4Z data]# cat output.txt alias acme.sh='/root/.acme.sh/acme.sh' alias cp='cp -i' alias egrep='egrep --color' alias fgrep='fgrep --color' alias grep='grep --color' alias l='ls -AFhlt' alias l.='ls -d .* --color=auto' alias lh='l | head' alias ll='ls -l --color=auto' alias ls='ls --color=auto' alias mv='mv -i' alias rm='rm -i' alias vi='vim' alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde' # 以追加的方式添加到文件中, > 一个将会覆盖. [root@iZbp1244h71ferqzghq7m4Z data]# whatis rm >> output.txt [root@iZbp1244h71ferqzghq7m4Z data]# cat output.txt alias acme.sh='/root/.acme.sh/acme.sh' alias cp='cp -i' alias egrep='egrep --color' alias fgrep='fgrep --color' alias grep='grep --color' alias l='ls -AFhlt' alias l.='ls -d .* --color=auto' alias lh='l | head' alias ll='ls -l --color=auto' alias ls='ls --color=auto' alias mv='mv -i' alias rm='rm -i' alias vi='vim' alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde' rm (1) - remove files or directories [root@iZbp1244h71ferqzghq7m4Z data]# whatis rm rm (1) - remove files or directories