Can anybody help me to how can I enable and disable network card through terminal?

  • if you want to disable for example the eth0 (ethernet port), you can sudo ifconfig eth0 down which will disable (down) the port. changing down to up will re-enable it. use ifconfig to view your ports. this works on a port basis; so a nic (network interface card) with four ports will require each port to be disabled individually.
    – guiverc
    Oct 16, 2017 at 9:25
  • @chrisguiver That sounds like an answer. Would you be willing to post it (or something like it) as one? Oct 16, 2017 at 10:06

3 Answers 3


Since ifconfig has been deprecated for many years now, you should probably use the ip command :

To list the interfaces:

ip link

or with the ip addresses:

ip a

To take one down:

sudo ip link set $if down
  • 2
    or for enabling use sudo ip link set eth0 up
    – Adam
    Jul 2, 2020 at 22:01
  • How does one keep it down after reboot?
    – Teekin
    Jan 28 at 21:05

use ifconfig to view your ethernet or NIC ports (to get port names; eg. eth0 was the first port on my machine, next was eth1 etc)

to disable say port named eth0 use

sudo ifconfig eth0 down

to re-enable the port use

sudo ifconfig eth0 up

note: this disables (down) and enables (up) each port individually. if for example a NIC (network interface card) has four ports on a card, you need to enable/disable each port individually.

  • 2
    Is this permanent?
    – chris
    Jun 14, 2019 at 8:53
  • It pulls the interface down/up as the machine is running, but on reboot, or a restart of networking [service] the NIC status will return to default.
    – guiverc
    Jun 14, 2019 at 9:01
  • What do you mean by "port"? I don't see any port number specified in your commands. May 23, 2020 at 9:58
  • The port used in that example was eth0, for my current workstation there is no eth0, but it would be enp0s25 (I'm using a later kernel which uses a different naming technique)
    – guiverc
    May 23, 2020 at 10:13
  • There must be another command to toggle the wifi card with fn+f8 - network symbol on my laptop. This is also possible from cmd. The cmd is something with list.
    – Timo
    Apr 28 at 18:53

To see list of network cards:

lshw -C network

You will see all the network cards. Attention to logical name example:

logical name: wlp6s0
logical name: enp7s0

So just use ifconfig to enable or disable it.


  • Enable sudo ifconfig wlp6s0 up
  • Disable: sudo ifconfig enp7s0 down
  • 1
    I don't see any logical name while running "lshw -C network". Do we have way to find location name?
    – Tectrendz
    Mar 27, 2019 at 19:47
  • does not do anything on Ubuntu 18.04 Sep 23, 2020 at 5:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.