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

History shell variables - Unix Tutorial

From the course: Learning Zsh

Start my 1-month free trial

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