'How to connect wired Ethernet in terminal?

Normal way

As we all know, we can connect wired Ethernet by this way. When there is no Ubuntu desktop GUI, however, i have found no way to connect or disconnect that wired Ethernet.

Moreover, i am using campus network. That means what should i do is click "Turn Off" or "Turn On",and i don't have to enter a broadband account and password.

So are there any terminal commands can realize the clicking of "Turn Off" or "Turn On" ?



Solution 1:[1]

Yes you can but using the ifconfig command

Assuming that this is your only port then it will have the tag of eth0

Which will mean the command is

sudo ifconfig eth0 down 

Down switches the port off, if I want to turn it on the command is

 sudo ifconfig eth0 up

Handy guide for some Linux Terminal commands to do with ifconfig https://www.tecmint.com/ifconfig-command-examples/#:~:text=The%20“down”%20or%20“ifdown,is%20in%20an%20inactive%20state.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 WillBrobin