现在的位置: 首页 > Linux > Linux基础 > 正文
Linux网络操作命令
2013年01月18日 Linux基础 ⁄ 共 2438字 评论数 4 ⁄ 被围观 5,075 views+

Linux 系统常用的网络操作命令包括netstat、nslookup、 host finger 和ping。

netstat 命令的功能是显示网络连接、路由表和网络接口信息,可以让用户得知目前都有哪些网络连接正在运作。nslookup 命令的功能是查询一台机器的IP地址和其对应的域名。它通常需要一台域名服务器来提供域名服务,如果用户已经设置好域名服务器,就可以用这个命令查看不同主机的IP 地址对应的域名。host 命令可根据主机名查询主机的IP 地址或根据主机IP 地址查询主机名;finger 命令的功能是查询用户的信息,通常会显示系统中某个用户的用户名、主目录、停滞时间、登录时间、登录shell 等信息。ping 命令用于查看网络上的主机是否在工作。

netstat

netstat 命令的语法为:

netstat [选项]

netstat的常用参数说明如下:

-a 显示所有 socket 包括正在监听的

-c 每隔 1 秒就重新显示一遍直到用户中断它

-i 显示所有网络接口的信息格式同 “ifconfig –e”

-n 以网络 IP 地址代替名称显示出网络连接情形

-r 显示核心路由表格式同 “route –e”

-t 显示 TCP 协议的连接情况

-u 显示 UDP 协议的连接情况

-v 显示正在进行的工作

示例:

1 )在本机使用 netstat 命令,其输出为如下

Active Internet connections (w/o servers)

Proto Recv-Q Send-Q Local Address Foreign Address State

tcp 0 256 10.153.89.66:ssh 10.153.21.168:1054 ESTABLISHED

tcp 0 0 10.153.89.66:ssh 10.153.21.166:1222 ESTABLISHED

tcp 0 0 10.153.89.66:1521 10.153.21.166:2625 ESTABLISHED

tcp 0 0 10.153.89.66:1521 10.153.21.166:2623 ESTABLISHED

……
Active UNIX domain sockets (w/o servers)

Proto RefCnt Flags Type State I-Node Path

unix 9 [ ] DGRAM 919 /dev/log

unix 2 [ ] STREAM CONNECTED 50246124

unix 3 [ ] STREAM CONNECTED 3914245

/tmp/.ICE-unix/dcop18694-1074144356

unix 3 [ ] STREAM CONNECTED 3914244

unix 3 [ ] STREAM CONNECTED 3914127 /tmp/.X11-unix/X0
…..

nslookup

nslookup 命令的功能是查询一台机器的IP 地址和其对应的域名。它通常需要一台域名服务器来提供域名服务。如果用户已经设置好域名服务器,就可以用这个命令查看不同主机的IP 地址对应的域名。命令的语法为:

nslookup [IP 地址/域名]

示例:

在本机执行 nslookup 命令

Default Server: name.tlc.com.cn

Address: 192.168.1.99

>
在符号“ >” 后面输入要查询的IP 地址或域名并回车即可。如果要退出该命令,输入exit 并回车即可。

host命令

host 命令的功能基本与nslookup 相。同命令的语法为:

host [选项] [IP 地址/域名/主机名]

host 的常用参数如下:

-a 显示所查域名或IP 地址、域名或主机名的相关信息。

示例:

[root]# host huawei-3com.com

huawei-3com.com has address 172.19.1.228

finger

finger 命令的功能是查询用户的信息,通常会显示系统中某个用户的用户名、主目录、停滞时间、登录时间、登录shell 等信息。如果要查询远程机上的用户信息,需要在用户名后面接“@主机名”采用[用户名@主机名]的格式,不过要查询的网络主机需要运行finger 守护进程。该命令的一般格式为:

finger [选项] [使用者] [用户@主机]

finger 的常用参数如下:

-s 显示用户的注册名、实际姓名、终端名称、写状态、停滞时间、登录时间等信息。

-l 除了用-s 选项显示的信息外,还显示用户主目录、登录shell、 邮件状态等信息,以及用户主目录下的.plan 、project 和.forward 文件的内容

-p 除了不显示.plan 文件和.project 文件以外与-l 选项相同

示例:

1 )显示用户 orcale 的信息

finger oracle

其显示结果为

Login: oracle Name: (null)

Directory: /home/oracle Shell: /bin/bash

On since Fri Feb 6 16:26 (CST) on pts/1 from 10.153.21.166 33 seconds idle

On since Wed Feb 4 20:10 (CST) on pts/2 from 10.153.21.166 1 second idle

No mail.

No Plan.

Ping 命令

ping 命令用于查看网络上的主机是否在工作,它向该主机发送ICMPECHO_REQUEST 包。有时我们想从网络上的某台主机上下载文件,可是又不知道那台主机是否开着,就需要使用ping 命令查看。该命令的一般格式为:

ping [选项] [主机名/IP地址]

ping 的常用参数如下:

-c 数目 在发送指定数目的包后停止

-d 设定 SO_DEBUG 的选项

-f 大量且快速地送网络封包给一台机器看它的回应

-I 秒数 设定间隔几秒送一个网络封包给一台机器预设值是一秒送一次

-l 次数 在指定次数内以最快的方式送封包数据到指定机器 (只有超级用户可以使用此选项)

-q 不显示任何传送封包的信息只显示最后的结果

-r 不经由网关而直接送封包到一台机器通常是查看本机的网络接口是否有问题

-s 字节数 指定发送的数据字节数, 预设值是56, 加上8 字节的ICMP头,一共是64ICMP 数据字节

目前有 4 条留言 其中:访客:4 条, 博主:0 条

  1. DAN ANTON: BACKLINKSVAULT and BrandlinksRank : 2017年05月20日12:35:50  -49楼 @回复 回复

    Executive pleading poverty after $44M judgment Symons and family ordered to pay $34.2 million in fraud case Alan Symons In the United States Court of Appeals Arie Abekasis Diditan Financial ARIE ABEKASIS DIDITAN FINANCIAL DIDITAN GROUP ARIE ABEKASIS OF DIDITAN Richard Ellenbogen – Beverly Hills Body Richard Ellenbogen – Beverly Hills Body – Babak Dadvand Beverly Hills Body Plastic Surgeons – Richard Ellenbogen MD Richard Ellenbogen And Babak Dadvand Plastic Surgeons Of Beverly Hills Richard Ellenbogen Plastic Surgeon And Babak Dadvand Richard Ellenbogen Md Plastic Surgery Rhinoplasty Nose Job Richard Ellenbogen Beverly Hills Body Cosmetic Plastic And Reconstructive Surgeon Richard Ellenbogen Plastic Surgeon – Babak Dadvand Richard Ellenbogen Beverly Hills Body And Babak Dadvand Richard Ellenbogen – Beverly Hills Body BRIAN WILLIS Brockstar DAN ANTON: BACKLINKSVAULT and BrandlinksRank dan anton Kotton Grammer OMG Machines SCAM Don Tigert granger whitelaw Richard Cosentino John Schmutzer Exotic Images LLC CMC Choppers Jim Haszinger COSENTINO N Ripoff Reports Complaints Reviews Scams Lawsuits and Frauds Reported Jim Haszinger KaonSoftwares Kaon Softwares Emergency Vehicle Lights Light bars Sirens LED Outfitters Lise Winicki LuxSauna Auto Connection Manassas Complaint Review: Poggi Michael Michael Poggi Poggi’s Animal House Complaint Review: Michael Poggi Poggisanimalhouse 9547089441 Complaint Review: Mountain Business Center LLC Rebecca Bextel SwiftUnlocks Elite Client Services Complaint Review: Naushad Noordin Velani Complaint Review: Trey Knight Trey Knight trey night Haskel Grant Knight Haskel G Knight FHTM LIMU Danger Trey Knight Uses fake social security numbers Trey Knight Atlantic Beach, Florida Trey Knight is a Scammer LA Laser Center Gerardo Cornejo Velez 多伦多中医吴冠英 Conslines.com

  2. Lise Winicki : 2017年05月20日12:37:02  -48楼 @回复 回复

    Executive pleading poverty after $44M judgment Symons and family ordered to pay $34.2 million in fraud case Alan Symons In the United States Court of Appeals Arie Abekasis Diditan Financial ARIE ABEKASIS DIDITAN FINANCIAL DIDITAN GROUP ARIE ABEKASIS OF DIDITAN Richard Ellenbogen – Beverly Hills Body Richard Ellenbogen – Beverly Hills Body – Babak Dadvand Beverly Hills Body Plastic Surgeons – Richard Ellenbogen MD Richard Ellenbogen And Babak Dadvand Plastic Surgeons Of Beverly Hills Richard Ellenbogen Plastic Surgeon And Babak Dadvand Richard Ellenbogen Md Plastic Surgery Rhinoplasty Nose Job Richard Ellenbogen Beverly Hills Body Cosmetic Plastic And Reconstructive Surgeon Richard Ellenbogen Plastic Surgeon – Babak Dadvand Richard Ellenbogen Beverly Hills Body And Babak Dadvand Richard Ellenbogen – Beverly Hills Body BRIAN WILLIS Brockstar DAN ANTON: BACKLINKSVAULT and BrandlinksRank dan anton Kotton Grammer OMG Machines SCAM Don Tigert granger whitelaw Richard Cosentino John Schmutzer Exotic Images LLC CMC Choppers Jim Haszinger COSENTINO N Ripoff Reports Complaints Reviews Scams Lawsuits and Frauds Reported Jim Haszinger KaonSoftwares Kaon Softwares Emergency Vehicle Lights Light bars Sirens LED Outfitters Lise Winicki LuxSauna Auto Connection Manassas Complaint Review: Poggi Michael Michael Poggi Poggi’s Animal House Complaint Review: Michael Poggi Poggisanimalhouse 9547089441 Complaint Review: Mountain Business Center LLC Rebecca Bextel SwiftUnlocks Elite Client Services Complaint Review: Naushad Noordin Velani Complaint Review: Trey Knight Trey Knight trey night Haskel Grant Knight Haskel G Knight FHTM LIMU Danger Trey Knight Uses fake social security numbers Trey Knight Atlantic Beach, Florida Trey Knight is a Scammer LA Laser Center Gerardo Cornejo Velez 多伦多中医吴冠英 Conslines.com

  3. Cmc Choppers : 2017年05月20日12:40:03  -47楼 @回复 回复

    Executive pleading poverty after $44M judgment Symons and family ordered to pay $34.2 million in fraud case Alan Symons In the United States Court of Appeals Arie Abekasis Diditan Financial ARIE ABEKASIS DIDITAN FINANCIAL DIDITAN GROUP ARIE ABEKASIS OF DIDITAN Richard Ellenbogen – Beverly Hills Body Richard Ellenbogen – Beverly Hills Body – Babak Dadvand Beverly Hills Body Plastic Surgeons – Richard Ellenbogen MD Richard Ellenbogen And Babak Dadvand Plastic Surgeons Of Beverly Hills Richard Ellenbogen Plastic Surgeon And Babak Dadvand Richard Ellenbogen Md Plastic Surgery Rhinoplasty Nose Job Richard Ellenbogen Beverly Hills Body Cosmetic Plastic And Reconstructive Surgeon Richard Ellenbogen Plastic Surgeon – Babak Dadvand Richard Ellenbogen Beverly Hills Body And Babak Dadvand Richard Ellenbogen – Beverly Hills Body BRIAN WILLIS Brockstar DAN ANTON: BACKLINKSVAULT and BrandlinksRank dan anton Kotton Grammer OMG Machines SCAM Don Tigert granger whitelaw Richard Cosentino John Schmutzer Exotic Images LLC CMC Choppers Jim Haszinger COSENTINO N Ripoff Reports Complaints Reviews Scams Lawsuits and Frauds Reported Jim Haszinger KaonSoftwares Kaon Softwares Emergency Vehicle Lights Light bars Sirens LED Outfitters Lise Winicki LuxSauna Auto Connection Manassas Complaint Review: Poggi Michael Michael Poggi Poggi’s Animal House Complaint Review: Michael Poggi Poggisanimalhouse 9547089441 Complaint Review: Mountain Business Center LLC Rebecca Bextel SwiftUnlocks Elite Client Services Complaint Review: Naushad Noordin Velani Complaint Review: Trey Knight Trey Knight trey night Haskel Grant Knight Haskel G Knight FHTM LIMU Danger Trey Knight Uses fake social security numbers Trey Knight Atlantic Beach, Florida Trey Knight is a Scammer LA Laser Center Gerardo Cornejo Velez 多伦多中医吴冠英 Conslines.com

  4. Exotic Images LLC : 2017年05月20日12:40:18  -46楼 @回复 回复

    Executive pleading poverty after $44M judgment Symons and family ordered to pay $34.2 million in fraud case Alan Symons In the United States Court of Appeals Arie Abekasis Diditan Financial ARIE ABEKASIS DIDITAN FINANCIAL DIDITAN GROUP ARIE ABEKASIS OF DIDITAN Richard Ellenbogen – Beverly Hills Body Richard Ellenbogen – Beverly Hills Body – Babak Dadvand Beverly Hills Body Plastic Surgeons – Richard Ellenbogen MD Richard Ellenbogen And Babak Dadvand Plastic Surgeons Of Beverly Hills Richard Ellenbogen Plastic Surgeon And Babak Dadvand Richard Ellenbogen Md Plastic Surgery Rhinoplasty Nose Job Richard Ellenbogen Beverly Hills Body Cosmetic Plastic And Reconstructive Surgeon Richard Ellenbogen Plastic Surgeon – Babak Dadvand Richard Ellenbogen Beverly Hills Body And Babak Dadvand Richard Ellenbogen – Beverly Hills Body BRIAN WILLIS Brockstar DAN ANTON: BACKLINKSVAULT and BrandlinksRank dan anton Kotton Grammer OMG Machines SCAM Don Tigert granger whitelaw Richard Cosentino John Schmutzer Exotic Images LLC CMC Choppers Jim Haszinger COSENTINO N Ripoff Reports Complaints Reviews Scams Lawsuits and Frauds Reported Jim Haszinger KaonSoftwares Kaon Softwares Emergency Vehicle Lights Light bars Sirens LED Outfitters Lise Winicki LuxSauna Auto Connection Manassas Complaint Review: Poggi Michael Michael Poggi Poggi’s Animal House Complaint Review: Michael Poggi Poggisanimalhouse 9547089441 Complaint Review: Mountain Business Center LLC Rebecca Bextel SwiftUnlocks Elite Client Services Complaint Review: Naushad Noordin Velani Complaint Review: Trey Knight Trey Knight trey night Haskel Grant Knight Haskel G Knight FHTM LIMU Danger Trey Knight Uses fake social security numbers Trey Knight Atlantic Beach, Florida Trey Knight is a Scammer LA Laser Center Gerardo Cornejo Velez 多伦多中医吴冠英 Conslines.com

给我留言

留言无头像?


×