2

Sometimes I need to do some operational work in text mode and I need to setup internet connection from command line (without any networkmanager applet).

(Please note: that when I run Window Manager, I have network connection immediately, thanks to NetworkManager applet.)

When I list my connections and look for wired one:

# nmcli con | grep Wired
New Wired Connection      b15ffacf-a5c58-44af-b755-b30c6d52e53e   802-3-ethernet    Thu Dec 27 21:31:21 2012  

I get uuid and with it it's easy:

nmcli con up uuid b15ffacf-a5c58-44af-b755-b30c6d52e53e eth0

If someone wants to automate stuff, it goes like this:

nmcli con up uuid "$( nmcli con | awk '/Wired/ {print $4}' )" eth0

It's correct and working solution, but I have a feeling that there must be more elegant way to "up" this "Wired" device.

Could you suggest more elegant way ?

4
  • 2
    You don't need grep with awk: awk '/Wired/ {print $4}' will suffice...
    – jasonwryan
    Dec 27, 2012 at 22:23
  • Ok, I improved command according to your suggestion, but still it's not final solution, I am looking for. Dec 29, 2012 at 21:46
  • nm-online should connect you to the available network(s).
    – vonbrand
    Jan 22, 2013 at 1:11
  • surprisingly nm-online does not connect me to wired connection... only to wifi, when it's available. Aug 13, 2013 at 18:33

0

You must log in to answer this question.

Browse other questions tagged .