Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Objective

I am looking for an easy way to consistently run a terminal that automatically opens to a specific directory. Is there a way to do that without changing the default directory?

Preferably I just click on a 'shortcut' link and it opens that customized terminal to that directory or maybe runs the CD command for me.

Full Story

Currently, when I open the terminal (via the Linux Mint GUI menu) it by default 'takes' me to the home directory. This is a fine default choice for the majority of times.

However, there are instances where I wish it would open elsewhere. I don't wish typing the CD command every time, for example:

cd Dropbox/GTD

Since I go to work on the files located on that specific directory every now and then (enough to be a pain), I am hoping someone can point a way so all I do is ideally

  1. Click on a desktop shortcut (script or whatever mechanism)
  2. Terminal opens under that specific directory without me typing any commands.
  3. I can instantly work on the files located there.
  4. If I open another terminal outside that 'shortcut', the terminal opens to the default home directory like usual.

I have a basic understanding working with the command line and Linux in general but am not advanced. Hopefully, you can dumb it down a bit ^_^

Oh and thanks in advance for any tidbits that can help point me in the right direction.

share|improve this question
    
What's wrong with using the plugin for your file manager that does this? –  Ignacio Vazquez-Abrams Jan 22 '13 at 18:46
    
Which terminal program are you used to (xterm, urxvt, gnome-terminal, etc)? –  user1146332 Jan 22 '13 at 19:10
1  
@user1146332 think it's gnome-terminal. The one found on Linux Mint Menu called 'terminal' (similar to the Windows XP start menu) –  damx Jan 22 '13 at 19:16
    
@IgnacioVazquez-Abrams Not sure what you mean by "plugin for your file manager" but if you mean going to the specifici folder/directory via Thunar (think that's what it's called), right clicking and clicking on "open terminal here", then it requires too many clicks. I would rather just type the CD commands from the terminal. I am just looking for a faster way so I click a button/shortcut from the desktop, it automatically opens a terminal and takes me to a specific directory. Trying to stay in the ternminal environment since I run some commands –  damx Jan 22 '13 at 19:24
add comment

1 Answer 1

up vote 3 down vote accepted

Most terminal programs like xterm, urxvt, gnome-terminal have an option to change the starting working directory of the shell.

If you are using gnome-terminal there is a special command line switch you have to provide to start the shell in a user defined directory. The command line switch i'm talking about is

--working-directory=DIRNAME

You should take a look at the manual pages of gnome-terminal to verify this.

So if you want to make a desktop shortcut the command you have to enter would be

gnome-terminal --working-directory=/home/you_username/Dropbox/GTD

Beforehand feel free to test the command in your current terminal session.


For users on Linux Mint, follow these instructions

  1. Right click on the Desktop
  2. Select "Create Launcher"
  3. Name this shortcut with whatever name you want
  4. In the Command field, enter gnome-terminal --working-directory=XXX. Make sure to replace XXX with the directory you want it to go to (see the example above)
share|improve this answer
    
Where do I enter that command? Rather, how do I create a desktop shortcut? –  damx Jan 22 '13 at 19:40
    
I don't use mint nor i use gnome currently. But i remember that you have to right click on the desktop and create a launcher. A window with several entries pop's up. There must be one entrybox in that window where you have to put the command. –  user1146332 Jan 22 '13 at 19:49
1  
Wow, it works perfectly! ^^)/ yatta! Thanks user1146332. Hope you don't mind me revising your answer a bit and adding the specific steps I took in case others might find useful. Thanks again. –  damx Jan 22 '13 at 19:53
    
I'm glad to see that it's working for you. Feel free to revise my answer (but maybe your reputation count isn't sufficient for this yet) –  user1146332 Jan 22 '13 at 19:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.