From 231b346395ec77f3f7f5655ebab7aee4dd5dd1ce Mon Sep 17 00:00:00 2001 From: srdusr Date: Fri, 17 Feb 2023 23:45:55 +0200 Subject: Add more information about recalling previous commands --- linux/linux-commands.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 -- cgit v1.2.3