commit 06777bbb1efb4701dae54e8237f04beadb3de4f6
parent e846df30bdd5f90c743a6ecc997860f371accc6a
Author: pyratebeard <root@pyratebeard.net>
Date: Thu, 22 Dec 2022 13:33:45 +0000
a_mark_of_ecphoneme
Diffstat:
1 file changed, 26 insertions(+), 0 deletions(-)
diff --git a/entry/a_mark_of_ecphoneme.md b/entry/a_mark_of_ecphoneme.md
@@ -0,0 +1,26 @@
+Have you ever created a directory in a long file path, then have to type out the long file path again with `cd`? Well no more!
+```
+mkdir /a/super/long/file/path/to/my/new/directory/
+cd !$
+```
+
+In shells the exclamation mark (!) can be used as an event designator to reference the command history. A lot of users have probably come across this for running the last command again, maybe if they forgot to use `sudo`
+```
+ ──── ─ pacman -Syu
+error: you cannot perform this operation unless you are root.
+ ──── ─ sudo !!
+```
+
+It can also be used with a number to run that command from the history, for example to run the very first command in your history incant
+```
+!1
+```
+
+Something I use quite a lot is the ability to reference a field from the last command, mostly the last field `$`. As shown above you can use it to navigate to a directory you have just created, or repeat a username
+```
+
+```
+
+
+
+These event designators are quite extensive so check the manpages for more information.