Can anybody help me to how can I enable and disable network card through terminal?
ifconfig has been deprecated for many years now, you should probably use the
ip command :
To list the interfaces:
or with the ip addresses:
To take one down:
if=eth0 sudo ip link set $if down
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.