Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 ?

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

Your Answer


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

Browse other questions tagged or ask your own question.