linux查看ip命令

linux查看ip命令,第1张

linux查看ip命令:

Linux查看IP地址命令--ifconfig

ifconfig命令用于查看和更改网络接口的地址和参数

$ifconfig -a

lo0: flags=849 mtu 8232

inet 127.0.0.1 netmask ff000000

hme0: flags=863 mtu 1500

inet 211.101.149.11 netmask ffffff00 broadcast 211.101.149.255

linux命令

是对Linux系统进行管理的命令。对于Linux系统来说,无论是中央处理器、内存、磁盘驱动器、键盘、鼠标,还是用户等都是文件,Linux系统管理的命令是它正常运行的核心,与之前的DOS命令类似。linux命令在系统中有两种类型:内置Shell命令和Linux命令。

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

loLink 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

loLink 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)

Linux下默认可以通过2个命令查看IP地址: ifconfig,在终端(Terminal)中,输入ifconfig后回车,可查看到IP地址 ip addr,在终端中,输入ip addr后回车,同样可看到IP地址。


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/yw/9015312.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-24
下一篇2023-04-24

发表评论

登录后才能评论

评论列表(0条)

    保存