20个对Linux专家非常有用命令(1)
20个对Linux专家非常有用命令(1)
谢谢你你给了我们在这篇文章前两个部分的喜欢,美言和支持。在第一部分文章中我们讨论了那些都只是切换到 Linux 和linux新手所需的必要知识的用户的命令。
对 Linux 新手非常有用的 20 个命令
第二篇文章中我们讨论了中级用户管理自己的系统所需要的命令。
对中级 Linux 用户非常有用的 20 个命令
接下来呢?在这篇文章中我将解释管理 Linux 服务器所需的一些命令。
1. 命令: ifconfig
ifconfig用来配置常驻内核的网络接口信息。在系统启动必要时用来设置网络适配器的信息。之后,它通常是只需要在调试时或当系统需要调整时使用。
检查活动网络适配器
- [avishek@tecmint ~]$ ifconfig
- eth0 Link encap:Ethernet HWaddr 40:2C:F4:EA:CF:0E
- inet addr:192.168.1.3 Bcast:192.168.1.255 Mask:255.255.255.0
- inet6 addr: fe80::422c:f4ff:feea:cf0e/64 Scope:Link
- UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
- RX packets:163843 errors:0 dropped:0 overruns:0 frame:0
- TX packets:124990 errors:0 dropped:0 overruns:0 carrier:0
- collisions:0 txqueuelen:1000
- RX bytes:154389832 (147.2 MiB) TX bytes:65085817 (62.0 MiB)
- Interrupt:20 Memory:f7100000-f7120000
- lo Link encap:Local Loopback
- inet addr:127.0.0.1 Mask:255.0.0.0
- inet6 addr: ::1/128 Scope:Host
- UP LOOPBACK RUNNING MTU:16436 Metric:1
- RX packets:78 errors:0 dropped:0 overruns:0 frame:0
- TX packets:78 errors:0 dropped:0 overruns:0 carrier:0
- collisions:0 txqueuelen:0
- RX bytes:4186 (4.0 KiB) TX bytes:4186 (4.0 KiB)
检查所有的网络适配器
“-a”参数用来显示所有网络适配器(网卡)的详细信息,包括那些停用的适配器。
- [avishek@tecmint ~]$ ifconfig -a
- eth0 Link encap:Ethernet HWaddr 40:2C:F4:EA:CF:0E
- inet addr:192.168.1.3 Bcast:192.168.1.255 Mask:255.255.255.0
- inet6 addr: fe80::422c:f4ff:feea:cf0e/64 Scope:Link
- UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
- RX packets:163843 errors:0 dropped:0 overruns:0 frame:0
- TX packets:124990 errors:0 dropped:0 overruns:0 carrier:0
- collisions:0 txqueuelen:1000
- RX bytes:154389832 (147.2 MiB) TX bytes:65085817 (62.0 MiB)
- Interrupt:20 Memory:f7100000-f7120000
- lo Link encap:Local Loopback
- inet addr:127.0.0.1 Mask:255.0.0.0
- inet6 addr: ::1/128 Scope:Host
- UP LOOPBACK RUNNING MTU:16436 Metric:1
- RX packets:78 errors:0 dropped:0 overruns:0 frame:0
- TX packets:78 errors:0 dropped:0 overruns:0 carrier:0
- collisions:0 txqueuelen:0
- RX bytes:4186 (4.0 KiB) TX bytes:4186 (4.0 KiB)
- virbr0 Link encap:Ethernet HWaddr 0e:30:a3:3a:bf:03
- inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0
- UP BROADCAST MULTICAST MTU:1500 Metric:1
- RX packets:0 errors:0 dropped:0 overruns:0 frame:0
- TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
- collisions:0 txqueuelen:0
- RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
停用网络适配器
- [avishek@tecmint ~]$ ifconfig eth0 down
启用网络适配器
- [avishek@tecmint ~]$ ifconfig eth0 up
指定IP地址到网络适配器
为网络适配器eth0设定IP地址“192.168.1.12”.
- [avishek@tecmint ~]$ ifconfig eth0 192.168.1.12
更改网络适配器eth0的子网掩码:
- [avishek@tecmint ~]$ ifconfig eth0 netmask 255.255.255.
更改网络适配器eth0的广播地址:
- [avishek@tecmint ~]$ ifconfig eth0 broadcast 192.168.1.255
为网络适配器eth0指定IP地址,子网掩码,广播地址:
- [avishek@tecmint ~]$ ifconfig eth0 192.168.1.12 netmask 255.255.255.0 broadcast 192.168.1.255
注Note: 如果你设置一块无线网卡的信息,你可以使用的命令是“iwconfig”.欲知更多ifconfig命令的例子和使用方法,读“15个有用的ifconfig 命令”。
评论暂时关闭