![]() ![]() If you want to put a little more effort in, and parse more data out, I recommend using the -online argument to the ip command, which will let you treat every line as a new device: $ ip -o linkġ: lo: mtu 16436 qdisc noqueue \ link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00Ģ: eth0: mtu 1500 qdisc pfifo_fast qlen 1000\ link/ether 00:0c:29:30:21:48 brd ff:ff:ff:ff:ff:ffģ: eth1: mtu 1500 qdisc pfifo_fast qlen 1000\ link/ether 00:0c:29:30:21:52 brd ff:ff:ff:ff:ff:ffĤ: tun0: mtu 1500 qdisc pfifo_fast qlen 100\ link/ĥ: sit0: mtu 1480 qdisc noop \ link/sit 0.0.0.0 brd 0.0.0. Execute the command ifconfig to see all available network interfaces in system. ![]() You can trivially get the mac address from this output with awk: $ ip link show eth0 | awk '/ether/ ' Its important to know the network interface you are working with. Typically, eth0 is for Ethernet connection, and wlp2s0 for Wireless connection.I like using /sbin/ip for these kind of tasks, because it is far easier to parse: $ ip link show eth0Ģ: eth0: mtu 1500 qdisc pfifo_fast qlen 1000 Inet6 1:2:00:33:333/64 scope global mngtmpaddr noprefixroute dynamic Valid_lft 548176sec preferred_lft 61403sec ![]() Inet6 AB:AD:AK:AI/64 scope global temporary dynamic Valid_lft 61791sec preferred_lft 61791sec How to use FTP by command-line in Ubuntu 1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000.Top reasons why systemd is a practical tool for sysadmins.How to move files and directories in Linux. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |