Command for enabling networking?

Are you looking for sudo service networking start ?

I believe network-manager handles the networking and interface on Ubuntu 12.04 so it should be like:

sudo service network-manager start

[EDIT]
Just an update in support of my comment below, for automating SUDO when piping the password to it from external source use:

echo "password" | sudo -S service network-manager start

Which will not ask for the password interactively.

-S Switch here make sudo to read the password from standard input and not from terminal.


When using NetworkManager (its service running) there is no need for sudo to enable/disable networking.

Use nmcli:

nmcli networking {on | off | connectivity}

connectivity get network connectivity state (full/none...).

Just for WiFi:

nmcli radio wifi {on | off}