EMBED YOUR TERMINAL RECORDINGS ONLINE

Cd -

DATE: 2011-09-11
AUTHOR: Ben Hosmer
AUTHOR WWW: http://radarearth.com
RELATED ARTICLE: none

Related recordings:

THE UNIX TREE COMMAND
tags: unix console tree bash directory listing
NOTITLE
tags: bash variable search replace
CONDITIONAL CRON USING DATE %A
tags: cron shellscript conditional bash schedule
CUT TEXT FROM CONSOLE OUTPUT
tags: cut manipulate text bash shellscript
AIRCRACK-NG - MODE MONITOR
tags: aircrack-ng monitor mode bash
VIM MAPPINGMANAGER PLUGIN
tags: vim editor text vi bash keyboard shortcut mapping
BASH EVENT DESIGNATOR
tags: bash history events designator trick shortcut
OUTPUT INTO SHELLSCRIPT VARIABLE
tags: bash output shellscript redirect into variable
IF THEN ELSE PING BASH
tags: bash if then else ping
IF THEN ELSE
tags: bash if then else





EMBED THIS RECORDING:
<div><script id="playterm-MjAxMS0wOS9zZWVkZWVkYXNodHR5LTEzMTU3NzgwMzh8ODB4MjQ=" type="text/javascript" src="https://playterm.org/js/?hash=MjAxMS0wOS9zZWVkZWVkYXNodHR5LTEzMTU3NzgwMzh8ODB4MjQ=" class="size:80x24"></script></div>

Henry said

wow 'cd -' is a neat trick!..its like windows alt-tab but between directories instead of windows.

nyymi said

You forgot to type just "cd" to get back to your home directory. So the "cd ~"
includes redundant part.

Mestalla said

I always knew you could do something like this, but I could never remember how. Perhaps next time
I'll remember :)

Adrian C said

You can use minus in other commands directly by prefixing with tilda e.g.
echo ~-
ls -l ~-

Adrian C said

You can use minus in other commands directly by prefixing with tilda e.g.
echo ~-
ls -l ~-

John W said

For more control, you can try pushd/popd/dirs

Leon said

nice! I even found out the following :)
Did you know you can also use this for copying files?
$ cd /var/srv/http/projects/foo/
$ ls
.htaccess foo
$ cd ~/www
$ ls
bar
$ cp ~-/.htaccess .
$ ls
.htaccess foo

 

Name   
Email (never shown)  
Comment