@@ -10,19 +10,21 @@ The most used key by far. I probably use this between every 5 other keystrokes o
10
10
good measure. It never hurts, sometimes does nothing, mostly helps.
11
11
12
12
- Completes file paths
13
+ - Completes environment variable names
13
14
- Completes commands and command arguments (if this doesn't work, make sure you have the
14
15
bash-completion package installed).
15
16
16
17
!!! tip
17
18
18
19
It is possible to create custom completion files for your custom scripts
19
20
21
+
20
22
++alt+period++
21
23
22
24
Probably my second most used combination. It inserts ** the last argument in the previous command** .
23
25
24
- This sounds obscure, but is surprisingly good in many cases, because of how arguments in the CLI
25
- is usually structured (e.g. filename goes last)
26
+ This might sound obscure, but is surprisingly good in many cases, because of how arguments in the
27
+ CLI is usually structured (e.g. filename goes last)
26
28
27
29
``` bash
28
30
mkdir -p my_directory/with_the/longest-name_possible
@@ -39,22 +41,35 @@ git add [alt+.] # To stage it with version control
39
41
40
42
The list goes on.
41
43
42
- ++alt+0++
44
+ !!! tip
45
+
46
+ ++alt+0++
47
+
48
+ A variation of the previous hotkey. Will paste the first argument of the previous command (which is
49
+ actually the base command itself)
50
+
51
+ Useful when you have a difficult-to-write command like `firewall-cmd --add-port=123/udp` then
52
+ `firewall-cmd --reload`, or something else where you want to repeat the command multiple times.
43
53
44
- A variation of the previous hotkey. Will paste the first argument of the previous command (which is
45
- actually the base command itself)
54
+ Also useful when you want to use the man page for the previous command, like `man [alt+0]`
46
55
47
- Useful when you have a difficult-to-write command like ` firewall-cmd --add-port=123/udp ` then
48
- ` firewall-cmd --reload ` , or something else where you want to repeat the command multiple times.
49
56
50
- ++ctrl+r++
57
+ ### ++ctrl+r++
51
58
52
59
Reverse command search. You know what your command is, but you don't feel like typing it all.
53
60
Just use ++ctrl+r++, then search for something unique to your command. Didn't find it on the first
54
61
try? Just run ++ctrl+r++ again for the next result. Mistyped? Use ++ctrl+c++ and try again.
55
62
56
63
` !! `
57
64
65
+ This basically just means "the entire last command". I've found about 2 uses for it, but I use them
66
+ often:
67
+
68
+ ` sudo !! ` - Repeat the last command, but with sudo
69
+
70
+ ` watch !! ` - Run the last command over and over.
71
+
72
+
58
73
++ctrl+u++ and ++ctrl+y++
59
74
60
75
++ctrl+a++ and ++ctrl+e++
0 commit comments