Tag Info

New answers tagged

1

There are previous answers that suggest you to use $_ and !$. While this works, I find it quite dangerous as they are not expanded and you cannot see their value before pressing enter and executing the command. Imagine using rm $_ without being sure what you're going to delete! If you're using bash (probably with readlines's emacs mode, which is the ...


2

When working interactively, you can use history expansion for this: mkdir /Some/really/long/path/to/a/directory/ cd !$ There are loads of variants to this which allow you to access other parameters from the previous command or any other command in your history. See Bash, insert last used argument of current command for details...


2

In bash (and some other shells, like zsh), you can use $_, which contains the last argument to the previous command: mkdir /path/to/file cd "$_"



Top 50 recent answers are included