Is there a way to create a file to be stored on the desktop - which when clicked will startup lxterminal in a specific directory?

I have four programs I am running in lxterminal and want to be able to click on four files on the desktop which will startup an instance of lxterminal in a specific directory without having to do

cd /home 
cd xxx

You need to use the --working-directory option. So

lxterminal --working-directory=/path/to/dir

will open the terminal with the current directory set to/path/to/dir.

Regarding having clickable files the open lxterminal in different working directories, create four different (executable) scripts, which open lxterminal in the required directories and save them to your desktop. So

lxterminal terminal --working-directory=/path/to/dir1


lxterminal terminal --working-directory=/path/to/dir2

and so on.

See the the lxterminal man page.

To make the script executable, there is no need for a specific file extension, although .sh is sometimes used1. Use the command chmod. Run chmod 755 <scriptname>, or chmod +x <scriptname> on the scripts. So, if the path to your script is /home/pi/Desktop/myscript run

chmod +x /home/pi/Desktop/myscript

1 Note that the extension .sh will not make the file excutable, it is merely a sometimes used convention, to denote that the file contains a (sh) script.

  • what file name extension would I save the file as for it to be recognized as an executable? – Tinkerer Jul 19 '15 at 16:37
  • --working-directory seems to only work with absolute path. So, use --working-directory=/home/your_username/path/to/dir but not --working-directory=~/path/to/dir. – Olexiy Oct 28 '17 at 6:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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