Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

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.

share|improve this question
    
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
add comment

2 Answers

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.

share|improve this answer
    
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
show 3 more comments

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

share|improve this answer
    
nope! it crashed whole of unity! :( –  Nirmik Oct 27 '12 at 6:06
    
Unity crash ? hmm strange issue . hope some one will help you –  raaz Oct 27 '12 at 6:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.