7

What is the command for enabling networking and wireless using command line?

I have made a script that delays the startup apps for quicker boot times.

I have learned that disabling networking also helps in a quicker boot time.

I would like to add a command that shall enable networking and wireless in the shell script.

Pablo Bianchi
  • 17,371
Nirmik
  • 7,938

3 Answers3

5

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.

Pablo Bianchi
  • 17,371
Gufran
  • 1,736
  • 12
  • 13
4

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}
Pablo Bianchi
  • 17,371
1

to start network

sudo /etc/init.d/networking start

to stop

sudo /etc/init.d/networking stop

to restart

sudo /etc/init.d/networking restart

Source

Raja G
  • 105,327
  • 107
  • 262
  • 331