/
README
63 lines (47 loc) · 2.44 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
I wrote a wrapper script around nmcli because I found it horrible to use to actually connect to anything with.
It allows you to quickly search for and connect to a NetworkManager profile from the CLI without worrying about UUIDs or other assorted carp.
It's a huge time saver for me, and you don't have to be in X to use it.
You'll need Bash 4.0 or higher.
I must thank the ABS guide that I always find to be a tremendously useful reference while writing in bash: http://tldp.org/LDP/abs/html/abs-guide.html
Copyright 2011 Trevor Joynson
License: GPLv3
Installation:
1. Copy nmconnect and symlinks somewhere in your PATH.
$ cd "$HOME/.bin"
$ cp -av /path/to/this/folder/{nmconnect,vpn,lan,wlan} ./
What the commands do:
nmconnect - works on the full connection list
vpn - automatically adds type=vpn to the search, so "vpn AwesomeCo" is the same as running "nmconnect type=vpn AwesomeCo"
lan/wlan - same ideology as vpn
Examples:
## List all connections
$ nmconnect
[*]
0. "Auto eth0" (type="802-3-ethernet", uuid="guid-guid-guid-guid-guid")
1. "Auto ILoveSSIDBeacons" (type="802-11-wireless", uuid="guid-guid-guid-guid-guid")
3. "AwesomeCo" (type="vpn", uuid="guid-guid-guid-guid-guid")
## Search all connections for "auto" (search params are case insensitive)
$ nmconnect auto
[search=auto]
0. "Auto eth0" (type="802-3-ethernet", uuid="guid-guid-guid-guid-guid")
1. "Auto ILoveSSIDBeacons" (type="802-11-wireless", uuid="guid-guid-guid-guid-guid")
## The vpn/lan/wlan commands are merely shortcuts, as is shown by the search params (the first line it prints; in the [brackets])
## "vpn AwesomeCo" and "nmconnect type=vpn awesomeco" are synonymous.
$ vpn
[type=vpn] ## <-- SEARCH PARAMS
3. "AwesomeCo" (type="vpn", uuid="guid-guid-guid-guid-guid")
$ nmconnect type=vpn
[type=vpn]
3. "AwesomeCo" (type="vpn", uuid="guid-guid-guid-guid-guid")
## If you narrow it down to a single result, it asks you if you wish to connect to it.
## The default, as shown by the capital Y, is to connect, so just hit enter and it will connect you.
## If you don't wish to connect, either ctrl+c or type n<enter> and it won't.
$ vpn awesome
[type=vpn search=awesome]
3. "AwesomeCo" (type="vpn", uuid="guid-guid-guid-guid-guid")
--> Start connection to: "AwesomeCo"? [Y/n]
### Another example by narrowing down to the connection number
$ vpn 3
[type=vpn search=3]
3. "AWESOMEco" (type="vpn", uuid="guid-guid-guid-guid-guid")
--> Start connection to: "AwesomeCo"? [Y/n]