I want to use gnome-terminal to set the directory to a different one than the home folder and also execute a program in that directory.

The program I would like to run is Foremost.

atm I have the command:

gnome-terminal  --working-directory="/usr/local/bin/" --execute="foremost -h" --title="Foremost"

But it doesn't seem to want to work. Can anyone help me out here.


  • Do you get any errors from the command? Does it just not operate? Can we get more details from you? – Thomas Ward Mar 17 '11 at 17:49
  • Well it said there was no child process called foremost -h, I then changed the --execute to -x "foremost -h" and it told me the option is not valid. So I don't know what to do. – Sandeep Bansal Mar 17 '11 at 18:14
  • Well i've noticed a few issues with your process of accessing this... you okay if I propose a different method (but one that I'm not sure will work completely)? – Thomas Ward Mar 17 '11 at 18:19

Out of curiosity, why do you not write a shell script that changes the directory to the directory its located at, then does the command? And execute that shell script from your home directory or something?

Sorta like this (with this being stored in a file, such as execute-foremost.sh, set to be executable, and stored wherever):

/usr/local/bin/foremost -h

That should accomplish the same thing, assuming you execute the script from the command line. Although the title might not be what you want it to be, it'll get most of what you need done.

I've edited the script to use the path to foremost rather than changing directories to the location that foremost is stored in. This should then spit you back out to wherever you stored the shell script.

  • I would like to use it as a launcher, a way to actually execute other commands on foremost rather than for it to execute the shell script and then bring me back to the working directory that the shell script was on. – Sandeep Bansal Mar 17 '11 at 18:37
  • ah, well i'm not sure exactly how you'd do that, because even with your command that you wrote, it still wouldn't be able to accept additional commands (to my knowledge). – Thomas Ward Mar 17 '11 at 18:41
  • My command does work, it's just the executing foremost part. I guess I could just be a little less lazy and enter foremost -h myself or even enter /usr/local/bin in the PATH. I will accept yours as the answer since it is a workaround. Thanks. – Sandeep Bansal Mar 17 '11 at 18:49

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.