yum使用
[root@78e61c06ef3e ~]# yum --help
Loaded plugins: fastestmirror
Usage: yum [options] COMMAND
List of Commands:
check Check for problems in the rpmdb
check-update Check for available package updates
clean Remove cached data
deplist List a package's dependencies
distribution-synchronization Synchronize installed packages to the latest available versions
downgrade downgrade a package
erase Remove a package or packages from your system
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 Display, or use, the groups information
help Display a helpful usage message
history Display, or use, the transaction history
info Display details about a package or group of packages
install Install a package or packages on your system
list List a package or groups of packages
load-transaction load a saved transaction from filename
makecache Generate the metadata cache
provides Find what package provides the given value
reinstall reinstall a package
repo-pkgs Treat a repo. as a group of packages, so we can install/remove all of them
repolist Display the configured software repositories
search Search package details for the given string
shell Run an interactive yum shell
swap Simple way to swap packages, instead of using shell
update Update a package or packages on your system
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 Update packages taking obsoletes into account
version Display a version for the machine and/or available repos.
Options:
-h, --help show this help message and exit
-t, --tolerant be tolerant of errors
-C, --cacheonly run entirely from system cache, don't update cache
-c [config file], --config=[config file]
config file location
-R [minutes], --randomwait=[minutes]
maximum command wait time
-d [debug level], --debuglevel=[debug level]
debugging output level
--showduplicates show duplicates, in repos, in list/search commands
-e [error level], --errorlevel=[error level]
error output level
--rpmverbosity=[debug level name]
debugging output level for rpm
-q, --quiet quiet operation
-v, --verbose verbose operation
-y, --assumeyes answer yes for all questions
--assumeno answer no for all questions
--version show Yum version and exit
--installroot=[path] set install root
--enablerepo=[repo] enable one or more repositories (wildcards allowed)
--disablerepo=[repo] disable one or more repositories (wildcards allowed)
-x [package], --exclude=[package]
exclude package(s) by name or glob
--disableexcludes=[repo]
disable exclude from main, for a repo or for
everything
--disableincludes=[repo]
disable includepkgs for a repo or for everything
--obsoletes enable obsoletes processing during updates
--noplugins disable Yum plugins
--nogpgcheck disable gpg signature checking
--disableplugin=[plugin]
disable plugins by name
--enableplugin=[plugin]
enable plugins by name
--skip-broken skip packages with depsolving problems
--color=COLOR control whether color is used
--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
--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
Plugin Options:
[root@78e61c06ef3e ~]# yum --help | grep provides
provides Find what package provides the given value
使用yum查找软件是哪个包的
yum provides */nslookup
[root@78e61c06ef3e ~]# yum provides */nslookup
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centos.quelquesmots.fr
* epel: mirror.in2p3.fr
* extras: centos.mirrors.proxad.net
* updates: centos.mirror.fr.planethoster.net
base/7/x86_64/filelists_db | 7.2 MB 00:00:00
epel/x86_64/filelists_db | 12 MB 00:00:05
extras/7/x86_64/filelists_db | 231 kB 00:00:00
updates/7/x86_64/filelists_db | 4.7 MB 00:00:02
1:bash-completion-extras-2.1-11.el7.noarch : Additional programmable completions for Bash
Repo : epel
Matched from:
Filename : /usr/share/bash-completion/completions/nslookup
32:bind-utils-9.11.4-26.P2.el7.x86_64 : Utilities for querying DNS name servers
Repo : base
Matched from:
Filename : /usr/bin/nslookup
32:bind-utils-9.11.4-26.P2.el7_9.2.x86_64 : Utilities for querying DNS name servers
Repo : updates
Matched from:
Filename : /usr/bin/nslookup
32:bind-utils-9.11.4-26.P2.el7_9.3.x86_64 : Utilities for querying DNS name servers
Repo : updates
Matched from:
Filename : /usr/bin/nslookup
32:bind-utils-9.11.4-26.P2.el7_9.4.x86_64 : Utilities for querying DNS name servers
Repo : updates
Matched from:
Filename : /usr/bin/nslookup
32:bind-utils-9.11.4-26.P2.el7_9.5.x86_64 : Utilities for querying DNS name servers
Repo : updates
Matched from:
Filename : /usr/bin/nslookup
zsh-5.0.2-34.el7_8.2.x86_64 : Powerful interactive shell
Repo : base
Matched from:
Filename : /usr/share/zsh/5.0.2/functions/nslookup
1、nslookup
dns正解析和反解析
windows自带这个命令,linux在bind-utils包里面
2、hostname
3、ifconfig
在net-tools包里面
[root@78e61c06ef3e ~]# ifconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.20.0.1 netmask 255.255.0.0 broadcast 0.0.0.0
ether 02:42:e1:38:c4:06 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.17.0.51 netmask 255.255.0.0 broadcast 172.17.255.255
inet6 fe80::42:acff:fe11:33 prefixlen 64 scopeid 0x20<link>
ether 02:42:ac:11:00:33 txqueuelen 1000 (Ethernet)
RX packets 23437 bytes 54210471 (51.6 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 10201 bytes 1023541 (999.5 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 4 bytes 196 (196.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4 bytes 196 (196.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
4、finger 查看用户信息。显示用户的登录名字、真实名字以及登录终端的名字和登录权限。这是 unix 一个很老的命令,现在已很少使用了。
补充:另外用 who -a 命令也可以查看用户信息。
[root@78e61c06ef3e ~]# who -a
system boot 2021-04-30 12:50
LOGIN ttyS0 2021-04-30 12:50 465 id=tyS0
LOGIN tty1 2021-04-30 12:50 467 id=tty1
run-level 3 2021-04-30 12:51
root + pts/0 2021-04-30 14:12 . 6507 (172.17.0.165)
[root@78e61c06ef3e ~]#
[root@78e61c06ef3e ~]# finger
-bash: finger: command not found
[root@78e61c06ef3e ~]#
[root@78e61c06ef3e ~]#
5、telnet
应用层协议
使用 telnet ip port 表示可以连通
windows里面自带,linux在telnet包里面,需要注意的是telnet还有一个服务端telnet-server
程序
6、ethtool
7、dig
8、ifup
9、ifdown
10、route
11、arp
12、netstat
13、nmap
network mapper
Downloading packages:
(1/3): libpcap-1.5.3-12.el7.x86_64.rpm | 139 kB 00:00:00
(2/3): nmap-ncat-6.40-19.el7.x86_64.rpm | 206 kB 00:00:00
(3/3): nmap-6.40-19.el7.x86_64.rpm | 3.9 MB 00:00:00
https://www.linuxprobe.com/10-nmap.html
https://blog.csdn.net/yunweimao/article/details/105697760
1) 获取远程主机的系统类型及开放端口
[root@78e61c06ef3e ~]# nmap -sS -P0 -sV -O localhost
-sS: TCP SYN 扫描 (又称半开放,或隐身扫描)
-P0: 允许你关闭 ICMP pings.
-sV: 打开系统版本检测
-O: 尝试识别远程操作系统
-A: 同时打开操作系统指纹和版本检测
-v: 详细输出扫描情况.
Starting Nmap 6.40 ( http://nmap.org ) at 2021-04-30 14:55 UTC
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000015s latency).
Other addresses for localhost (not scanned): 127.0.0.1
Not shown: 998 closed ports
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 7.4 (protocol 2.0)
9000/tcp open cslistener?
Device type: general purpose
Running: Linux 3.X
OS CPE: cpe:/o:linux:linux_kernel:3
OS details: Linux 3.7 - 3.9
Network Distance: 0 hops
OS and Service detection performed. Please report any incorrect results at http://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 15.40 seconds
扫描出其对外开放的服务
[root@redis-120-20 ~]# nmap 172.17.120.11
Starting Nmap 6.40 ( http://nmap.org ) at 2020-03-2621:35 CST
Nmap scan report forelasticsearch-01.crawler-beta (172.17.120.11)
Host is up (0.00019s latency).
Not shown: 998closed ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
MAC Address: 02:00:1F:B5:00:6B (Unknown)
Nmap done: 1IP address (1 host up) scanned in11.16 seconds
# 可以看出只开放了22端口和80端口
nmap -p 端口 IP(域名),判断ip是否开放指定端口
[root@redis-120-20 ~]# nmap -p 80 172.17.120.11
Starting Nmap 6.40 ( http://nmap.org ) at 2020-03-2621:37 CST
Nmap scan report forelasticsearch-01.crawler-beta (172.17.120.11)
Host is up (0.00037s latency).
PORT STATE SERVICE
80/tcp open http
MAC Address: 02:00:1F:B5:00:6B (Unknown)
Nmap done: 1IP address (1 host up) scanned in11.09 seconds
----------------------------------------------------------------------------------------
[root@redis-120-20 ~]# nmap -p 8080 172.17.120.11
Starting Nmap 6.40 ( http://nmap.org ) at 2020-03-2621:38 CST
Nmap scan report forelasticsearch-01.crawler-beta (172.17.120.11)
Host is up (0.00039s latency).
PORT STATE SERVICE
8080/tcp closed http-proxy
MAC Address: 02:00:1F:B5:00:6B (Unknown)
Nmap done: 1IP address (1 host up) scanned in11.10 seconds
# 可以看出80端口开放,8080端口没有开放
14、ss
http://www.ttlsa.com/linux-command/ss-replace-netstat/
https://www.cnblogs.com/ftl1012/p/ss.html
ss是Socket Statistics的缩写。顾名思义,ss命令可以用来获取socket统计信息,它可以显示和netstat类似的内容。ss的优势在于它能够显示更多更详细的有关TCP和连接状态的信息,而且比netstat更快速更高效。
当服务器的socket连接数量变得非常大时,无论是使用netstat命令还是直接cat /proc/net/tcp,执行速度都会很慢。
ss快的秘诀在于,它利用到了TCP协议栈中tcp_diag。tcp_diag是一个用于分析统计的模块,可以获得Linux 内核中第一手的信息,这就确保了ss的快捷高效。
15、lsof
16、traceroute
tracert