Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a ubuntu running in vmware, and the folder is mnt/hgfs/somefolder (shared folder from VMWARE).

How can i create a shortcut to open a terminal with this path (mnt/hgfs/somefolder) without need to type everytime cd mnt/hgfs/somefolder?

on windows I use a file somefile.bat with this code:

@cd /d "z:\somefolder\subfolder" 
@cmd.exe /K

It is possible to add some arguments to open in root mode?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

The command to open a terminal in a specific folder is

gnome-terminal --working-directory=/path/to/folder

One can create a .desktop file containing the following details to have a shortcut for this,

[Desktop Entry]
Name=MyTerminal
Comment=open terminal in /mnt/hgfs/somefolder
Icon=utilities-terminal
Exec=gnome-terminal --working-directory=/mnt/hgfs/somefolder
Terminal=false
Type=Application

Give it execution permission, as

chmod +x /path/to/MyTerminal.desktop

It will create a shortcut named MyTerminal, now double click on it to open a terminal in your desired location.

share|improve this answer
    
To be root at that location use sudo su in the terminal. –  souravc Feb 11 at 14:24

Open the .bashrc file ,

gedit .bashrc

Add the below line at the bottom of the file and then save it,

cd /mnt/hgfs/somefolder

Then source the .bashrc file to work,

source .bashrc

Now whenever you open the terminal,it directly cd(goes) into the /mnt/hgfs/somefolder directory.

share|improve this answer

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.