How enter in folder with one command?

2

I work a lot in two folders:

/home/valter/Dropbox/Development/git/valter

/home/valter/Dropbox/Development/git/company

I would like to create command like:

$valter

and enter in /home/valter/Dropbox/Development/git/valter

and

$company

and enter in /home/valter/Dropbox/Development/git/company

/home/valter/Dropbox/Development/git/company

I tried create some alias in ~/.bashrc but nothing works so far.

alias valter="cd /home/valter/Dropbox/Development/git/valter/"

update

@mpy:

meniac chef: valter
No command 'valter' found, did you mean:
 Command 'qalter' from package 'torque-client' (universe)
 Command 'qalter' from package 'gridengine-client' (universe)
 Command 'qalter' from package 'torque-client-x11' (universe)
valter: command not found

Valter Silva

Posted 2013-05-10T14:09:25.163

Reputation: 1 331

The alias should work. Did you source ~/.bashrc? The $ in $company means this is the prompt?! You can also define a variable company=/home/valter/Dropbox/Development/git/company and the use cd $company or (what is a benefit compared to the alias) use cp something $company. – mpy – 2013-05-10T14:11:37.390

yes mpy, I did in my /home/valter/.bashrc – Valter Silva – 2013-05-10T14:12:47.853

What is the error when using the alias? – mpy – 2013-05-10T14:13:45.993

1@ValterHenrique Please try in a new window/session. – OmidTahouri – 2013-05-10T14:15:05.633

1it works Omid, please put this as answer so I can choose it! Thank you! – Valter Silva – 2013-05-10T14:17:11.547

Pinging @OmidTahouri – Valter Henrique, you always need to explicitly @-mention users in order for them to receive a reply. – slhck – 2013-05-10T14:18:27.990

Answers

4

As requested, I'll post an answer, but @mpy's suggestion would've also done the job.

You'll have to re-source your ~/.bashrc using source ~/.bashrc or establish a new session (which would source that for you).

OmidTahouri

Posted 2013-05-10T14:09:25.163

Reputation: 711

Not sure how to mention/tag in an answer, so: @mpy – OmidTahouri – 2013-05-10T14:21:42.683

3+1: I appreciate. Your merit is, that you formulated it more understandable ;) – mpy – 2013-05-10T14:24:56.510

Credit where credit is due :) – OmidTahouri – 2013-05-10T14:26:34.253

1

Try replacing "'s (quote) with ''s (single-quote) instead.

Also, make sure you reload your .bashrc either by starting a new terminal emulator window, or by doing . .bashrc in your home folder.

user183714

Posted 2013-05-10T14:09:25.163

Reputation: