Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

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 this python script that connects my desktop to the internet. there is not much text in it only a few messages about current status and time. So it would be really nice if i can open it (.sh file that opens the .py file) in a terminal that has a particular profile (with short frame size and dark background etc.)

share|improve this question
up vote 2 down vote accepted

Put following script at the end of ~/.bashrc:

if [ x$DISPLAY != x ] ; then
    gnome-terminal --save-config=/tmp/prof
    PROFILE=$(grep 'ProfileID=' /tmp/prof | sed 's/ProfileID=//g' | tail -1)
    if [ "$PROFILE" == "Profile1" ] ; then
        # run your script here

First if statement checks if you are running GNOME terminal, not a virtual console one. Then configuration of profile is saved into /tmp/prof. Third line reads profile name from that file. Inner if statement checks if it's a profile in which you want to call your script.

To list names of your profiles run:

$ gconftool-2 --get /apps/gnome-terminal/global/profile_list
share|improve this answer
It worked! yay. Thankyou for the well written answer. – Python Student Jun 14 '13 at 18:30

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.