Live data from Hacker News

Don't waste your time by cd-ing in the terminal

huyng.com

11–20 of 124 posts

Re: Don't waste your time by cd-ing in the terminal

#12
post #7
post #2

I've also wondered to myself why there isn't a terminal program with a directory tree by the side so you could just click on the directory that you want to be in, instead of ls -cd-tab-blah-^H-tab-^M. It would also a have a list of favorite and most-recently-used directories. A weekend project, perhaps...

Because that would require a mouse, and that would require an X server, etc...

GPM?

Re: Don't waste your time by cd-ing in the terminal

#13
No mention of ZSH directory stacks yet? http://www.acm.uiuc.edu/workshops/zsh/dir_stack.html

Some helpful aliases to manage them:

alias 1='cd -1'

alias 2='cd -2'

alias 3='cd -3'

alias 4='cd -4'

alias 5='cd -5'

alias 6='cd -6'

alias 7='cd -7'

alias d='dirs -v'

alias h='history'

alias j='jobs'

Just one of the many reasons to use ZSH.

Re: Don't waste your time by cd-ing in the terminal

#15
post #2

I've also wondered to myself why there isn't a terminal program with a directory tree by the side so you could just click on the directory that you want to be in, instead of ls -cd-tab-blah-^H-tab-^M. It would also a have a list of favorite and most-recently-used directories. A weekend project, perhaps...

Because clicking a mouse takes you away from the keyboard .. a context switch if you like, which added up over time slow you down when you have work to do.

Re: Don't waste your time by cd-ing in the terminal

#16
post #15
post #2

I've also wondered to myself why there isn't a terminal program with a directory tree by the side so you could just click on the directory that you want to be in, instead of ls -cd-tab-blah-^H-tab-^M. It would also a have a list of favorite and most-recently-used directories. A weekend project, perhaps...

Because clicking a mouse takes you away from the keyboard .. a context switch if you like, which added up over time slow you down when you have work to do.

Perhaps, but it'd be less of a context switch than remembering what directory I'm in and where it was that I wanted to go. It may be that I'm growing old and dull, but I'm better at clicking on things than remembering them.

Re: Don't waste your time by cd-ing in the terminal

#18
post #4

There's also the pushd and popd commands which are part of bash already. And there's a wikipedia entry for this even: http://en.wikipedia.org/wiki/Pushd_and_popd

You can also use the "dirs" command (I think part of bash as well) that tells you the state of the stack. If you set the -v option, you can get the depth of different directories, and you can just do pushd +N to jump to the specific directory.

Re: Don't waste your time by cd-ing in the terminal

#19
post #5

Don't waste your time bookmarking directories, jump right to them ;) https://github.com/rupa/z `z` tracks your most used directories. After a short learning phase, it will take you to the directory, based on its usage frequency and a hint you give it on the command line. Say I am often cd'ing into /var/www - then after a while I can just type `z ww`.

z is great. I don't know how I lived without it.

It's become so ingrained in my fingers that whenever I switch to a new shell it's the first thing I port over:

https://github.com/sjl/z-zsh

https://github.com/sjl/z-fish

Re: Don't waste your time by cd-ing in the terminal

#20

No mention of ZSH directory stacks yet? http://www.acm.uiuc.edu/workshops/zsh/dir_stack.html Some helpful aliases to manage them: alias 1='cd -1' alias 2='cd -2' alias 3='cd -3' alias 4='cd -4' alias 5='cd -5' alias 6='cd -6' alias 7='cd -7' alias d='dirs -v' alias h='history' alias j='jobs' Just one of the many reasons to use ZSH.

Just one of the many reasons to use ZSH.

What shell doesn't have a directory stack?

Post reply on HN