linux常用网络命令

来源:互联网 发布:2015最好的网络机顶盒 编辑:程序博客网 时间:2024/06/16 13:27

write

命令名称:write
命令所在目录:/usr/bin/write
执行权限:所有用户
语法:write <用户>
功能描述:给用户发信息,以Ctrl + D保存结束
例如:

write stark_summer

wall

命令名称:wall
命令所在路径:/usr/bin/wall
执行权限:所有用户
语法:wall [message]
功能描述:发广播信息
例如:

wall stark_summer is stark and summer combanation

ping

命令名称:ping
命令所在路径:/bin/ping
执行权限:所有用户
语法:ping 选项 IP地址,-c 指定发送次数
功能描述:测试网络连通性
例如:

ping 127.0.0.1ping -c 10 127.0.0.1PING 127.0.0.1 (127.0.0.1): 56 data bytes64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.075 ms64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.116 ms64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.125 ms64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.134 ms64 bytes from 127.0.0.1: icmp_seq=4 ttl=64 time=0.159 ms64 bytes from 127.0.0.1: icmp_seq=5 ttl=64 time=0.077 ms64 bytes from 127.0.0.1: icmp_seq=6 ttl=64 time=0.126 ms64 bytes from 127.0.0.1: icmp_seq=7 ttl=64 time=0.173 ms64 bytes from 127.0.0.1: icmp_seq=8 ttl=64 time=0.122 ms64 bytes from 127.0.0.1: icmp_seq=9 ttl=64 time=0.127 ms--- 127.0.0.1 ping statistics ---10 packets transmitted, 10 packets received, 0.0% packet lossround-trip min/avg/max/stddev = 0.075/0.123/0.173/0.029 ms

ifconfig

命令名称:ifconfig
命令英文原意:interface configure
命令所在路径:/sbin/ifconfig
执行权限:root
语法:ifconfig 网卡名称 IP地址
功能描述:查看和设置网卡信息
例如:

查看网络信息:ifconfig更改网络IP:ifconfig eth0 192.168.8.250

mail

命令名称:mail
命令所在路径:/bin/mail
执行权限:所有用户
语法:mail [用户名]
功能描述:查看发送电子邮件
例如:

mail stark_summerSubject: testtest

last

命令名称:last
命令所在路径:/usr/bin/last
执行权限:所有用户
语法:last
功能描述:列出目前与过去登入系统的用户信息
例如:

lastwangyue   ttys001                   Tue Oct  6 10:12   still logged inwangyue   ttys001                   Tue Oct  6 10:10 - 10:11  (00:01)wangyue   ttys002                   Sat Oct  3 17:29 - 17:29  (00:00)wangyue   ttys001                   Sat Oct  3 17:21 - 10:10 (2+16:48)wangyue   ttys000                   Sat Oct  3 17:21   still logged inwangyue   console                   Sat Oct  3 17:21   still logged in

lastlog

命令名称:lastlog
命令所在路径:/usr/bin/lastlog
执行权限:所有用户
语法:lastlog
功能描述:检查某特定用户上次登录的时间
例如:

lastlog指定uid,只查看指定用户lastlog -u 502

traceroute

命令名称:traceroute
命令所在路径:/bin/traceroute
执行权限:所有用户
语法:traceroute
功能描述:显示数据包到主机间的路径
例如:

traceroute www.baidu.comtraceroute: Warning: www.baidu.com has multiple addresses; using 119.75.218.70traceroute to www.a.shifen.com (119.75.218.70), 64 hops max, 52 byte packets 1  192.168.168.1 (192.168.168.1)  30.140 ms  6.502 ms  28.006 ms 2  * * * 3  * * * 4  * * * 5  * * * 6  * * * 7  * * * 8  * * *

netstat

命令名称:netstat
命令所在路径:/bin/netstat
执行权限:所有用户
语法:netstat [选项],-t TCP协议,-u UDP协议,-l 监听,-r 路由,-n 显示ip地址和端口号
功能描述:显示网络相关信息
例如:

查看本机监听的端口netstat -tlun查看本机所有的网络连接:netstat -an查看本地路由表:netstat -rn

setup

命令名称:setup
命令所在路径:/usr/bin/setup
执行权限:所有用户
语法:setup
功能描述:配置网络,redhat自带设置网络服务,其他系统是不具有这个服务(centos貌似也有这个功能,原因你懂的)
例如:

setupDHCP:是自动获取ip地址,要保证dhcp server提供这项服务重启网络服务:service network restart

mount

命令名称:mount
命令所在路径:/bin/mount
执行权限:所有用户
语法:mount [-t 文件系统] 设备文件名 挂载点
功能描述:文件挂载
例如:

mkdir /mnt/cdrom/dev/cdrom == /dev/sr0mount -t iso9660 /dev/sr0 /mnt/cdromumount /dev/sr0

作者:stark_summer
出处:http://blog.csdn.net/stark_summer/article/details/48930197

0 0