Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a perl script that runs from the terminal on Linux. I would like to be able to boot up, and when my desktop environment starts it will automatically open my terminal, and pass in the arguments to star this program, which are ./ttytter.txt -ansi -mentions -vcheck.

How can I go about doing this?

share|improve this question

Sometimes we do need to run programs in a terminal, can do like this:

xterm -e "sh -c './ttytter.txt -ansi -mentions -vcheck ; read"

The final "read" waits for you to press enter, to close the terminal.

You can use a different terminal program, and instead of "read" at the end you can run a shell, e.g.:

gnome-terminal -e "sh -c './ttytter.txt -ansi -mentions -vcheck ; exec bash'"

For some terminals (xterm) you might not need the sh -c '' wrapper; for some (gnome-terminal) we apparently do need that.

You can put such a command in .xinitrc, .xsession, or type it into a "run at startup" dialog.

You can also I think do this with a freedesktop .desktop file / shortcut, if you select "run in terminal", not sure how off the top of my head. That would be a much user friendly way to do it! See if you can figure that out...

Now, if you want to do it in general for any shell command, need to worry about shell escaping - and it becomes more difficult! Or, can put your command into a script and run the script.

It might also be helpful to see the command's exit status, like echo $? where 0 means success.

Sorry for over-complex answer, I hope it can help.

share|improve this answer
Complex is great! Ill give it a shot – Simon Sheehan Jan 7 '13 at 11:47

You don't need to explicitly start a terminal. Just add your Perl script to ~/.xsession, any commands in that file will be run following a graphical login.

share|improve this answer
I need to open the terminal to see the output though. – Simon Sheehan Jan 6 '13 at 17:20
Redirect the output to a file ( > filename) and then add gedit filename to your .xsession file. – terdon Jan 6 '13 at 21:50

Your Answer


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.