• 1 Post
  • 2 Comments
Joined 1 year ago
cake
Cake day: June 24th, 2023

help-circle
  • 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.