srdusr
aboutsummaryrefslogtreecommitdiffstats
path: root/linux/linux-commands.md
diff options
context:
space:
mode:
authorsrdusr <[email protected]>2023-02-17 23:45:55 +0200
committersrdusr <[email protected]>2023-02-17 23:45:55 +0200
commit231b346395ec77f3f7f5655ebab7aee4dd5dd1ce (patch)
tree99e97927e7894df1b8c6b76ae8fa20a0b971dd07 /linux/linux-commands.md
parent2264cc243a156f8d4d90d1c3b809e496a48149a7 (diff)
downloadnotes-231b346395ec77f3f7f5655ebab7aee4dd5dd1ce.tar.gz
notes-231b346395ec77f3f7f5655ebab7aee4dd5dd1ce.zip
Add more information about recalling previous commands
Diffstat (limited to 'linux/linux-commands.md')
-rw-r--r--linux/linux-commands.md13
1 files changed, 13 insertions, 0 deletions
diff --git a/linux/linux-commands.md b/linux/linux-commands.md
index 14539a0..3ae5235 100644
--- a/linux/linux-commands.md
+++ b/linux/linux-commands.md
@@ -39,6 +39,19 @@ NOTE: `.` can also be used but is limited
$ ls -l /opt/myFile.txt
-rw-r--r-- 1 root root 0 Dec 21 16:20 /opt/file.txt
```
+
+ `!!:n` where n is the 0-based position of the argument you want.
+The ! prefix is used to access previous commands.
+
+- Other useful commands:
+
+ `!$` - last argument from previous command
+ `!^` - first argument (after the program/built-in/script) from previous command
+ `!*` - all arguments from previous command
+ `!!` - previous command (often pronounced "bang bang")
+ `!n` - command number n from history
+ `!pattern` - most recent command matching pattern
+ `!!:s/find/replace` - last command, substitute find with replace
- - -
#### Getting information about a window