Working with Ruby
Hi, I am Jan. This is my old Ruby blog. I still post about Ruby, but I now do it on idiosyncratic-ruby.com. You should also install Irbtools to improve your IRB.

6 basic cd tricks you should know and use!

And you’ll never want to miss them again!

1) cd without arguments

cd # brings you to your home dir, no need to do `cd ~`

2) cd -

cd - # goes back to the previous directory

3) cd ~username

cd ~git # goes to the homedir of the user "git"

4) $CDPATH

You can set a path in this variable in your .bashrc / .zshrc just like you do it with $PATH (separate multiple dirs with :). You can then cd into these paths from everywhere! Even the auto-completion works properly.

5) Dot Aliases

Put these into your .bashrc / .zshrc to quickly navigate through parent directories:

alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'

6) cdargs

cdargs is a little collection of tools to quickly go to your favorite dirs. On ubuntu, you can install it using:

sudo apt-get install cdargs

Then add the following to your .bashrc / .zshrc:

source /usr/share/doc/cdargs/examples/cdargs-bash.sh

After that (and opening a new terminal), you can bookmark your current dir by typing:

ca some_name

You can jump to your bookmarked dir from everywhere by using:

cv some_name

cv without an argument returns a list of all bookmarks… It’s really easy, isn’t it ;)?

Creative Commons License

anthony | October 03, 2012

alias vlc='vlc -I rc'

$ vlc no_surprises.mp3

I like it because I use a lot of computers with no GUI.

another one I use is

$ cat | bash

and I can enter any number of commands I want and they won't be entered into .bashrc.

$ exit

To leave "cat | bash"

That's all I can remember right now.