linux如何查看本机ip地址

如题所述

1.修改/etc/profile文件,注释掉if语句即可
把下面的if语句注释掉:
# Path manipulation
if [ "$EUID" = "0" ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
fi
修改为
# Path manipulation
# if [ "$EUID" = "0" ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
#fi
2.可以使用ln 命令连接
下图是操作详细过程
[Blinux@bogon ~]$ ifconfigbash: ifconfig: command not found

[Blinux@bogon ~]$ ln -s /sbin/ifconfig /bin/ifconfigln: 正在创建指向“/sbin/ifconfig”的符号链接“/bin/ifconfig”: 权限不够
[Blinux@bogon ~]$ su
口令:
[root@bogon Blinux]# ln -s /sbin/ifconfig /bin/ifconfig[root@bogon Blinux]# su Blinux[Blinux@bogon ~]$ ifconfigeth0 Link encap:Ethernet HWaddr 00:0C:29:D4:AD:D6
inet addr:192.168.13.132 Bcast:192.168.13.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fed4:add6/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:254 errors:0 dropped:0 overruns:0 frame:0
TX packets:193 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:28648 (27.9 KiB) TX bytes:20650 (20.1 KiB)
Interrupt:67 Base address:0x2000

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:2471 errors:0 dropped:0 overruns:0 frame:0
TX packets:2471 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:4570048 (4.3 MiB) TX bytes:4570048 (4.3 MiB)

3.用su – root方法
[Blinux@bogon ~]$ ifconfig
bash: ifconfig: command not found
[Blinux@bogon ~]$ su - root
口令:
[root@bogon ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:D4:AD:D6
inet addr:192.168.13.132 Bcast:192.168.13.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fed4:add6/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:292 errors:0 dropped:0 overruns:0 frame:0
TX packets:228 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:32842 (32.0 KiB) TX bytes:24487 (23.9 KiB)
Interrupt:67 Base address:0x2000

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:2471 errors:0 dropped:0 overruns:0 frame:0
TX packets:2471 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:4570048 (4.3 MiB) TX bytes:4570048 (4.3 MiB)
温馨提示:答案为网友推荐,仅供参考

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网