command line 'last directory' button?
hi, I'm a linux-cli-newby
in the command line there's a button (tab) for autocompleting commands and I'm pretty sure linux has a button that prints the last directory I used/typed whatever? |
Code:
!! |
Pressing the up arrow on the keypad should display last command entered.
As Bratmon states, "!!" will also, but that would require more than one keystroke or "button". To actually cd to the last directory: Code:
cd - |
yeah, going to the last directory would be
Code:
cd - For example: Code:
pushd ~ #sends your home dir to the dir stack |
hang on a minute, I need to stipulate the usage ::
(I'm 'sure' that I stumbled on this some time in the past) ls /etc/rc* cat /etc/rc4.d/K74bluetooth | less mv [button for- ] /etc/rc4.d/K74bluetooth [button again] /etc/rc4.d/K74bluetooth[type].old do you see what I mean to use this button for here? |
There's the $_ variable to return the last argument or the combination Esc+.
As it prints the last argument of the previous command line, it would only work as long as you get rid of | less. HTH |
[edit] haha yeah bratmon's totally correct! ("I'm really happy I asked and I just used it further!"
$ls -R !!/plugins)[edit] okeydoke - I've stumbled on it again yay! it is alt-.(alt->) and it doesn't work too long into bash history but in the example: $ls /usr/lib/mozilla $ls -R (Alt-. equals)/usr/lib/mozilla it works a treat in typing the address rather than the last command, i just wish that i could make this kind of "address type-shortcut" stay there longer! |
All times are GMT -5. The time now is 07:19 AM. |