From the course: Learning Zsh
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
History shell variables
- [Instructor] The shell has some special variables that store information about its current state. And there's a few I'd like to show you here in the context of working with command history. To start, double exclamation mark refers to the previously run command. And exclamation mark asterisk is a special shell variable that refers to the arguments given to the previous command. Let's take a look at how they work. I'll run the ls command here with the var directory. Okay, that shows us the contents. And if I wanted to run it again, instead of pressing up and then enter, I could write exclamation mark exclamation mark, and the shell will run my previous command again. And if you look up here, the shell tells us what the command is when it runs. I find this especially useful if I write a command and forget that I need to use superuser privileges for it. So if I run something and then get that error, like touch…
Contents
-
-
-
-
Autocd and cd shorthand4m 15s
-
(Locked)
Directory stack and user dirs4m 17s
-
(Locked)
Finding files and commands3m 59s
-
(Locked)
Autocompletion4m 52s
-
(Locked)
Redirection and multios6m 14s
-
(Locked)
Command history4m 24s
-
(Locked)
History shell variables2m 11s
-
(Locked)
Expansions8m 20s
-
(Locked)
Renaming files with zmv7m 29s
-
(Locked)
Scripting5m 29s
-
-
-