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.

  • If the networking start answer makes stuff crash, it could be your delay script does something funky. Maybe you want to post the script, so we can see what you did ;)
    – Nanne
    Oct 28 '12 at 10:27

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

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.

  • nope...error is-----> start: Rejected send message, 1 matched rules; type="method_call", sender=":1.94" (uid=1000 pid=6820 comm="start network-manager ") interface="com.ubuntu.Upstart0_6.Job" member="Start" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init")
    – Nirmik
    Oct 27 '12 at 6:05
  • @Nirmik Sorry for this late reply, anyway.. Please have a look above I have updated the commands. You need to run it under elevated privileges.
    – Gufran
    Oct 28 '12 at 10:21
  • also, if you want to automate the script for sudo whick will not proceed without the admin password you can store the password in script file like this echo "p@$$w0rD" | sudo service network-manager start
    – Gufran
    Oct 28 '12 at 10:29
  • okay the sudo thing workd but the later part you said about 'echo "the password" | command' is not working as a command when i tried to test it in the commandline
    – Nirmik
    Oct 28 '12 at 14:05
  • Is there any specific error ? Can you post what exactly you run in terminal, just scribble your original password before posting ;)
    – Gufran
    Oct 28 '12 at 14:09

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}
  • Sometimes you need to start network-manager first, and then you can execute your command. To start networkmanager execute sudo service network-manager start
    – titusfx
    Feb 16 at 12:33

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


  • nope! it crashed whole of unity! :(
    – Nirmik
    Oct 27 '12 at 6:06
  • Unity crash ? hmm strange issue . hope some one will help you
    – rɑːdʒɑ
    Oct 27 '12 at 6:15

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.