帐号   密码      自动登录 找回密码 加入我们
    

中国诗人论坛|永远年轻的诗歌论坛|中诗网|中国诗人网|中国网络诗歌的源头

搜索
查看: 138|回复: 0

许三多

[复制链接]
发表于 2021-8-9 11:39:24 | 显示全部楼层 |阅读模式
《许三多》

Linux有三多
一是命令和子命令多
二是命令选项多
三是拥有的相关(帮助)文档多
所以,我严重怀疑Linux
姓许不姓李

一、命令多

linux上大概有多少个命令呢?我们来统计一下:
~]# compgen -c | wc -l
2949
哦,大概有三四千个

【1】命令多

>>> 三问
~]# whoami                    <<< 我是谁
~]# who
~]# w

~]# pwd                    <<< 我在哪
~]# ls

~]# date                    <<< 现在是什么时间


>>> 开关机
CentOS6
~]# shutdown -h now
~]# shutdown -r now
~]# halt
~]# poweroff
~]# reboot




>>> 帮助
~]# enable
~]# enable -n
~]# echo $PATH
~]# echo $SHELL
~]# echo $LANG
~]# locale -a
~]# env
~]# declare -x
~]# export
~]# type CMD
~]# help CMD
~]# hash
~]# man CMD
~]# info CMD
~]# CMD --help

>>> 常用命令
~]# tty
~]# ls
~]# alias
~]# vim /etc/profile
~]# reset
~]# init 6
~]# clear
~]# history
~]# runlevel
~]# service xxx restart
~]# chkconfig --list xxx

>>> bash特性
~]# history
~]# !num
~]# !str..
~]# alias cdnet='cd /etc/sysconfig/network-scripts/'
~]# unalias cdnet
~]# hash -r
~]# ctrl-e, ctrl-a, ctrl-l, ctrl-u, ctrl-k
~]#

>>> 文件目录

~]# pwd
~]# cd /path/to/somewhere
~]# cd ~
~]# cd -
~]# cd
~]# ls
~]# ls -lh
~]# ls -dh
~]# dirs
~]# mkdir -pv /x/y/z
~]# rmdir /to/some/dir
~]# touch a.txt
~]# file <FILE>
~]# cp [-r] SRC DIST
~]# mv SRC DIST
~]# rm [-fr] /path/to/
~]# stat <FILE>
~]# vi/vim [+num]<FILE>
~]# nano <FILE>

>>> 查看
~]# cat/tac [-n] <FILE>
~]# more/less <FILE>
~]# head/tail <FILE>

>>> 用户与组
~]# useradd uNAME
~]# adduser uNAME
~]# passwd uNAME
~]# usermod [option] uNAME
~]# echo "PASSWORD" | passwd --stdin uNAME
~]# userdel uNAME
~]# groupadd gNAME
~]# groupmod [option] gNAME
~]# groupdel gNAME
~]# gpasswd
~]# id uNAME
~]# su -l uNAME
~]# groups
~]# chage
~]# chsh
~]# ...

>>> 权限
~]# chmod u/g/o+|-r/w/x <FILE>
~]# umask
~]# umask xxxx
~]# chmod -m u+|-s <FILE>
~]# chmod -m g+|-s <FILE>
~]# chmod -t o+|-t <FILE>
~]# getfacl <FILE>
~]# setfack <FILE>

>>> 管道,重定向,文本处理
~]# CMD1 | CMD2 | ...
~]# >, >>
~]# <, <<
~]# tee
~]# tr
~]# wc -l <FILE>
~]# cut
~]# sort
~]# unique
~]# diff
~]# patch
~]#

>>> 磁盘
~]# fdisk
~]# mkfs
~]# tune2fs
~]# blkid
~]# ln
~]# mount
~]# umount
~]# vim /etc/fstab
~]#
~]# swapon
~]# swapoff

>>> 网络
CentOS
~]# ifconfig
~]# ifup
~]# ifdown
~]# route
~]# service network start|stop|restart|status
~]# netstat -tunlp
~]# dig -t A www.baidu.com
~]# ping -c 4 www.baidu.com
~]# ip addr list
~]# ss -tunlp
~]# setup
~]# nmcli
~]#  

>>> 解压缩
~]# tar zxvf xxx.gz
~]# dd

>>> 任务计划
~]# mail
~]# at
~]# crontab

>>> 包管理
~]# rpm -q xxx
~]# rpm -qa xxx*
~]# rpm -qa | grep xxx
~]# rpm -qi xxx
~]# rpm -qc xxx

~]# yum instal xxx -y
~]# yum clean all
~]# yum makecache
~]# yum list installed | grep xxx
~]# yum provides
~]# yum update
~]# yum repolist

~]# ./configure --prefix=xxx ...
~]# make & make install

>>> 进程
~]# pstree
~]# ps -ef | grep xxx
~]# ps aux
~]# top
~]# htop
~]# vmstat
~]# free -h
~]# ping
~]# nice
~]# renice
~]# kill -l
~]# killall
~]# pkill
~]# jobs
~]# fg
~]# bg
~]#

>>> 系统
~]# init
~]# grub
~]# lsmod
~]# modprobe
~]# insmod
~]# rmmod
~]# ldd

>>> SELinux
~]# getenforce
~]# setenforce

>>> openssl & ssl/tls
~]# openssl

>>> OpenSSH
~]# ssh USERNAME@IP
~]# ssh-keygen -t rsa
~]# ssh-copy-id
【2】子命令多

以例yum命令为例

command is one of:
        * install package1 [package2] [...]
        * update [package1] [package2] [...]
        * update-to [package1] [package2] [...]
        * check-update
        * upgrade [package1] [package2] [...]
        * upgrade-to [package1] [package2] [...]
        * distribution-synchronization [package1] [package2] [...]
        * remove | erase package1 [package2] [...]
        * list [...]
        * info [...]
        * provides | whatprovides feature1 [feature2] [...]
        * clean [ packages | metadata | expire-cache | rpmdb | plugins | all ]
        * makecache
        * groupinstall group1 [group2] [...]
        * groupupdate group1 [group2] [...]
        * grouplist [hidden] [groupwildcard] [...]

        * groupremove group1 [group2] [...]
        * groupinfo group1 [...]
        * search string1 [string2] [...]
        * shell [filename]
        * resolvedep dep1 [dep2] [...]
        * localinstall rpmfile1 [rpmfile2] [...]
           (maintained for legacy reasons only - use install)
        * localupdate rpmfile1 [rpmfile2] [...]
           (maintained for legacy reasons only - use update)
        * reinstall package1 [package2] [...]
        * downgrade package1 [package2] [...]
        * deplist package1 [package2] [...]
        * repolist [all|enabled|disabled]
        * version [ all | installed | available | group-* | nogroups* | grouplist | groupinfo ]
        * history [info|list|packages-list|packages-info|summary|addon-info|redo|undo|rollback|new|sync|stats]
        * load-transaction [txfile]
        * check
        * help [command]


一个yum命令,就这么多子命

还有像什么ip命令,docker命令子类的,都是一大堆子命令



二、选项多

事实上,通常linux命令都有一大堆选项,这不是个例或个别现象,而几乎是普遍事实。

当然,像rpm这样的重量级的命令,自然选项就非常多了。

Usage: rpm [OPTION...]
  --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 <package>
                                   (normally an error is generated if
                                   <package> specified multiple packages)
  --badreloc                       relocate files in non-relocatable package
  -e, --erase=<package>+           erase (uninstall) package
  --excludedocs                    do not install documentation
  --excludepath=<path>             skip files with leading component <path>
  --fileconflicts                  detect file conflicts between packages
  --force                          short hand for --replacepkgs --replacefiles
  -F, --freshen=<packagefile>+     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=<dir>                   relocate the package to <dir>, if
                                   relocatable
  --relocate=<old>=<new>           relocate files from path <old> to <new>
  --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=<packagefile>+     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=<FILE:...>              read <FILE:...> instead of default file(s)
  --nodigest                       don't verify package digest(s)
  --nosignature                    don't verify package signature(s)
  --rcfile=<FILE:...>              read <FILE:...> 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


  -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 --help的这个--help选项查看的,
如果要看详细的,我们可以使用man rpm,如果要看更详细的,我们可以使用info rpm命令
都说 候门一入深如海,从此萧朗是路人,linux命令比侯门还侯门,深得很,像大海,也像矿山


三、相关文档多
我们学linux,入门一个man bash命令,出来的文档就有上百页

我们学习ftp,我们可以看一下vsftpd提供了多少文档

~]# rpm -ql vsftpd  | less
...
/usr/share/doc/vsftpd-2.2.2
/usr/share/doc/vsftpd-2.2.2/AUDIT
/usr/share/doc/vsftpd-2.2.2/BENCHMARKS
/usr/share/doc/vsftpd-2.2.2/BUGS
/usr/share/doc/vsftpd-2.2.2/COPYING
/usr/share/doc/vsftpd-2.2.2/Changelog
/usr/share/doc/vsftpd-2.2.2/EXAMPLE
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE/README
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE/README.configuration
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE/vsftpd.conf
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE/vsftpd.xinetd
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE_NOINETD
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE_NOINETD/README
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE_NOINETD/README.configuration
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE_NOINETD/vsftpd.conf
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/PER_IP_CONFIG
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/PER_IP_CONFIG/README
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/PER_IP_CONFIG/README.configuration
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/PER_IP_CONFIG/hosts.allow
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/README
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_HOSTS
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_HOSTS/README
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS/README

/usr/share/doc/vsftpd-2.2.2/EXAMPLE/PER_IP_CONFIG/README
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/PER_IP_CONFIG/README.configuration
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/PER_IP_CONFIG/hosts.allow
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/README
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_HOSTS
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_HOSTS/README
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS/README
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS/README.configuration
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS/logins.txt
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS/vsftpd.conf
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS/vsftpd.pam
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS_2
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS_2/README
/usr/share/doc/vsftpd-2.2.2/FAQ
/usr/share/doc/vsftpd-2.2.2/INSTALL
/usr/share/doc/vsftpd-2.2.2/LICENSE
/usr/share/doc/vsftpd-2.2.2/README
/usr/share/doc/vsftpd-2.2.2/README.security
/usr/share/doc/vsftpd-2.2.2/REWARD
/usr/share/doc/vsftpd-2.2.2/SECURITY
/usr/share/doc/vsftpd-2.2.2/SECURITY/DESIGN
/usr/share/doc/vsftpd-2.2.2/SECURITY/IMPLEMENTATION
/usr/share/doc/vsftpd-2.2.2/SECURITY/OVERVIEW
/usr/share/doc/vsftpd-2.2.2/SECURITY/TRUST
/usr/share/doc/vsftpd-2.2.2/SIZE
/usr/share/doc/vsftpd-2.2.2/SPEED
/usr/share/doc/vsftpd-2.2.2/TODO
/usr/share/doc/vsftpd-2.2.2/TUNING
/usr/share/doc/vsftpd-2.2.2/vsftpd.xinetd
/usr/share/man/man5/vsftpd.conf.5.gz
/usr/share/man/man8/vsftpd.8.gz


真要看吗 真心看不完啊








您需要登录后才可以回帖 登录 | 加入我们

本版积分规则

闽公网安备 35020302001206号

[中国诗人论坛] ( 豫ICP备11003363号-2

GMT+8, 2024-9-21 19:42 , Processed in 0.261375 second(s), 11 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2011 Comsenz Inc.

返回顶部