this post was submitted on 10 Jul 2023
57 points (100.0% liked)
Git
2910 readers
1 users here now
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
Resources
Rules
- Follow programming.dev rules
- Be excellent to each other, no hostility towards users for any reason
- No spam of tools/companies/advertisements. It’s OK to post your own stuff part of the time, but the primary use of the community should not be self-promotion.
Git Logo by Jason Long is licensed under the Creative Commons Attribution 3.0 Unported License.
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
You can do what 👀
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:It's handy for a whole host of things, like piping/touching then opening a file, chown then chmod, etc.
On many terminal emulators you can also use Alt-. to search through your history of previous arguments, so
mkdir foo
followed bycd [Alt-.]
will populate your command line withcd foo
for example. If you have some other command in between you can just hit Alt-. repeatedlyOr ESC followed by "." Repeating it works too.
This is amazing ♥️
That's incredible, I never knew that. Thank you!
There's also
pushd
andpopd
so that you canpushd
into one directory, move around as much as you want and then go back to before thepushd
withpopd