How to find out the connected interface using linux command Rumi, October 26, 2020 Method 1 To find out the connected state of a network cable in Linux, just run: $ cat /sys/class/net/enp5s0/carrier Sample output: 1 If you got output as “1” (Number one), It means that the network cable is connected with the network card. Also, you can do this with the following command too: $ cat /sys/class/net/enp5s0/operstate Sample output: up Method 2: In case the above commands doesn’t help, there is another tool called “ethtool” to help you. ethtool is used to query and control network device driver and hardware settings, particularly for wired Ethernet devices. Run the following command to find out the connected state of a network cable: $ sudo ethtool enp5s0 Sample output: Settings for enp5s0: Supported ports: [ TP MII ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full Supported pause frame use: No Supports auto-negotiation: Yes Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full Advertised pause frame use: Symmetric Receive-only Advertised auto-negotiation: Yes Link partner advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full Link partner advertised pause frame use: Transmit-only Link partner advertised auto-negotiation: Yes Speed: 100Mb/s Duplex: Full Port: MII PHYAD: 0 Transceiver: internal Auto-negotiation: on Supports Wake-on: pumbg Wake-on: g Current message level: 0x00000033 (51) drv probe ifdown ifup Link detected: yes To find out the state of wireless network card: $ sudo ethtool wlp9s0 Sample output: Settings for wlp9s0: Link detected: yes Let us disconnect the cable, and see what happens. $ sudo ethtool enp5s0 Sample output: Settings for enp5s0: Supported ports: [ TP MII ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full Supported pause frame use: No Supports auto-negotiation: Yes Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full Advertised pause frame use: Symmetric Receive-only Advertised auto-negotiation: Yes Link partner advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full Link partner advertised pause frame use: Transmit-only Link partner advertised auto-negotiation: Yes Speed: 100Mb/s Duplex: Full Port: MII PHYAD: 0 Transceiver: internal Auto-negotiation: on Supports Wake-on: pumbg Wake-on: g Current message level: 0x00000033 (51) drv probe ifdown ifup Link detected: no Src: https://ostechnix.com/how-to-find-out-the-connected-state-of-a-network-cable-in-linux/ Related Administrations Collected Articles Ethtool
Insall cache only powerdns server September 4, 2011 I decided to install another caching dns server , after some research I found PowerDNS. it uses MySQL for storing its zones , but hopefully its caching component doesnt need mysql , so great , lets go and install it. My favourite OS is debian lenny , so I ran… Read More
Reset root Password for Redhat/CentOS/Sl Linux 5.x November 1, 2012November 1, 2012 You can log in using single-user mode and create a new root password. To enter single-user mode, reboot your computer. If you use the default boot loader, GRUB, you can enter single user mode by performing the following: At the boot loader menu, use the arrow keys to highlight the… Read More
Convert squid timestamps July 27, 2017 When you work with a squid access log file you sometimes want to know when a site or resource was accessed. Squid does not store the date and time information for that in a human readable format. It is stored as <unix timestamp>.<centisecond> so you can use a command like… Read More