Avatar

vampatori

vampatori@feddit.uk
Joined
1 posts • 2 comments
Direct message

Which follows the similar functionality used by the cd - command to switch to the previous directory you were in. Very handy!

permalink
report
reply

There’s more! Well, it’s more a bash thing than a cd thing… in bash the variable $_ refers to the last argument to the previous command. So you can do the following:

> mkdir -p my/nested/dir
> cd $_
> pwd
/home/user/my/nested/dir

It’s handy for a whole host of things, like piping/touching then opening a file, chown then chmod, etc.

permalink
report
parent
reply