zlsh00 2020-02-19
命令名称:write 命令所在路径:/usr/bin/write 执行权限:所有用户 功能描述:给用户发信息,以Ctrl+D保存结束
write <用户名>
# 给eternity发送信息 write eternity [ ~]# write eternity write: eternity is logged in more than once; writing to pts/4 hello eternity!!! [ ~]$ Message from on pts/0 at 15:32 ... hello eternity!!!EOF
命令名称:wall 命令英文原意:write all 命令所在路径:/usr/bin/wall 执行权限:所有用户 功能描述:发广播信息
vall [message]
# 发送广播信息(自己也会收到,当前用户才能收到) wall eternity is a good man! [ ~]# wall eternity is a good man! [ ~]# Broadcast message from (pts/0) (Thu Dec 5 15:36:18 2019): eternity is a good man! [ ~]$ Broadcast message from (pts/0) (Thu Dec 5 15:36:18 2019): eternity is a good man!
命令名称:write 命令所在路径:/bin/ping 执行权限:所有用户 功能描述:测试网络连通性
ping 选项 IP地址 -c 指定发送次数
# ping 118.190.208.1(会一直ping,按ctrl+c结束) ping 118.190.208.1 [ ~]# ping 118.190.208.1 PING 118.190.208.1 (118.190.208.1) 56(84) bytes of data. 64 bytes from 118.190.208.1: icmp_seq=1 ttl=64 time=0.201 ms 64 bytes from 118.190.208.1: icmp_seq=2 ttl=64 time=0.207 ms 64 bytes from 118.190.208.1: icmp_seq=3 ttl=64 time=0.161 ms 64 bytes from 118.190.208.1: icmp_seq=4 ttl=64 time=0.197 ms --- 118.190.208.1 ping statistics --- 8 packets transmitted, 8 received, 0% packet loss, time 7032ms rtt min/avg/max/mdev = 0.161/0.189/0.218/0.023 ms # # ping -c 4 118.190.208.1(ping 4次结束) ping 118.190.208.1
命令名称:ifconfig 命令所在路径:/sbin/ifconfig 执行权限:root 功能描述:查看和设置网卡信息
ifconfig 网卡名称 IP地址
# 查看当前计算机网卡信息 ifconfig # 临时更改ip地址 ifconfig eth0 192.168.1.1
命令名称:mail 命令所在路径:/bin/mail 执行权限:所有用户 功能描述:查看发送电子邮件
mail [用户名]
yum -y install mailx sendmail
# 给root发送邮件(ctrl+D发送邮件) mail root [ ~]# mail root Subject: test hello root!!!! EOT # 查看邮件 mail
命令名称:mail 命令所在路径:/usr/bin/last 执行权限:所有用户 功能描述:列出目前与过去登录系统的用户信息
last
# 列出登录信息 last [ ~]# last eternity pts/5 123.235.166.172 Thu Dec 5 15:32 still logged in eternity pts/4 123.235.166.172 Thu Dec 5 15:32 still logged in root pts/3 123.235.166.172 Thu Dec 5 15:32 still logged in root pts/2 123.235.166.172 Thu Dec 5 15:32 still logged in root pts/3 123.235.166.172 Thu Dec 5 15:32 - 15:32 (00:00) root pts/2 123.235.166.172 Thu Dec 5 15:32 - 15:32 (00:00)
命令名称:lastlog 命令所在路径:/usr/bin/lastlog 执行权限:所有用户 功能描述:检查某特定用户上次登录的时间
lastlog 选项[-u] [uid] -u 用户的uid
# 查看上次登录时间 lastlog [ ~]# lastlog Username Port From Latest root pts/3 123.235.166.172 Thu Dec 5 15:32:14 +0800 2019 bin **Never logged in** daemon **Never logged in** adm **Never logged in** lp **Never logged in** sync **Never logged in** shutdown **Never logged in** halt **Never logged in** mail **Never logged in** operator **Never logged in** games **Never logged in** ftp **Never logged in** nobody **Never logged in** systemd-network **Never logged in** dbus **Never logged in** polkitd **Never logged in** postfix **Never logged in** chrony **Never logged in** sshd **Never logged in** ntp **Never logged in** tcpdump **Never logged in** nscd **Never logged in** mysql **Never logged in** www **Never logged in** rabbitmq **Never logged in** eternity pts/5 123.235.166.172 Thu Dec 5 15:32:17 +0800 2019 saslauth **Never logged in** mailnull **Never logged in** smmsp **Never logged in** # 查看指定用户最后一次访问 lastlog -u 502
命令名称:mail 命令所在路径:/bin/traceroute 执行权限:所有用户 功能描述:显示数据包到主机间的路径
traceroute
yum -y install traceroute
# 探测到达www.baidu.com的路径 traceroute www.baidu.com [ ~]# traceroute www.baidu.com traceroute to www.baidu.com (180.101.49.11), 30 hops max, 60 byte packets * * * 11.219.4.81 (11.219.4.81) 5.632 ms 5.931 ms 6.313 ms 11.219.4.62 (11.219.4.62) 4.164 ms * 11.219.4.54 (11.219.4.54) 4.114 ms 11.219.68.2 (11.219.68.2) 4.848 ms 11.219.68.18 (11.219.68.18) 4.849 ms 11.219.68.2 (11.219.68.2) 4.853 ms 103.52.86.106 (103.52.86.106) 1.139 ms 103.52.86.118 (103.52.86.118) 0.536 ms 103.41.143.65 (103.41.143.65) 1.240 ms 103.41.143.118 (103.41.143.118) 1.165 ms 116.251.113.221 (116.251.113.221) 0.961 ms 103.41.143.58 (103.41.143.58) 0.963 ms 150.138.130.121 (150.138.130.121) 1.618 ms 150.138.130.117 (150.138.130.117) 0.947 ms 0.641 ms 150.138.128.161 (150.138.128.161) 8.503 ms 150.138.128.41 (150.138.128.41) 1.928 ms 150.138.128.157 (150.138.128.157) 1.594 ms 202.97.19.137 (202.97.19.137) 15.099 ms 202.97.30.129 (202.97.30.129) 13.069 ms 202.97.96.205 (202.97.96.205) 16.943 ms 58.213.94.102 (58.213.94.102) 18.576 ms 58.213.94.98 (58.213.94.98) 17.861 ms 58.213.95.102 (58.213.95.102) 17.436 ms * * 58.213.94.86 (58.213.94.86) 18.402 ms 58.213.96.94 (58.213.96.94) 21.612 ms 58.213.96.78 (58.213.96.78) 17.852 ms 58.213.96.94 (58.213.96.94) 22.174 ms * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
命令名称:netstat 命令所在路径:/bin/netstat 执行权限:所有用户 功能描述:显示网络相关信息
netstat [选项] -t TCP协议(传输控制协议) -u UDP协议(用户数据报协议) -l 监听 -r 路由 -n 显示IP地址和端口号
# 查看本机监听的端口 netstat -tlun # 查看本机所有的网络连接 netstat -an # 查看本机路由表 netstat -rn
命令名称:setup 命令所在路径:/usr/bin/setup 执行权限:所有用户 功能描述:配置网络
setup
只有redhat系列的才有 设置永久生效
命令名称:mount 命令所在路径:/bin/mount 执行权限:所有用户 功能描述:挂载命令
mount [-t 文件系统] 设备文件名 挂载点
# 先创建挂载目录 mkdir /mnt/cdrom # 挂载光盘 mount -t ios9660 /dev/sr0 /mnt/cdrom -t ios9660 光盘文件系统(固定的,可省略) /dev/sr0 设备文件名称(固定的,系统指定的) /mnt/cdrom 挂载点(挂载目录) # 省略 -t ios9660 也是可以的 mount /dev/sr0 /mnt/cdrom # 访问光盘下的数据(就是挂载目录) cd /mnt/cdrom ls # 卸载光盘(必须在光盘挂载目录之外才可以卸载) umount /dev/sr0 [ ~]# ll /dev/cdrom lrwxrwxrwx 1 root root 3 Aug 14 2018 /dev/cdrom -> sr0 /dev/cdrom是软链接指向的是sr0
最简单的用法就是查询域名与IP地址的对应。并可以看到本机使用的DNS服务器IP和名字。tracertIP:就可以知道本机到目的IP所经过的具体路径了。arp-sIPMAC:绑定IP和MAC,使其为静态