For those of you using a Linux OS, you might have wanted to start a particular program or application at start up – when you login.

Windows has a StartUp folder, and placing a shortcut there does the job. What about Linux?

This is something I have done on my setup – Ubuntu Feisty Fawn. But I am sure that it is available in other Linux distribution, because it is a reminiscent of Unix.

Here is what you need to do. Go to the home folder, and edit your login’s .profile file. In Ubuntu, the steps would be as follows:

(There is a easy way in Ubuntu. Skip the steps and read the end of the post).

  1. Application > Accessories > Terminal
  2. Open the file in VI Editor.
    vi .profile
    You can use any editor that you are comfortable with.
  3. Go to the end of the file.
    [Shift]+g
    If the .profile was never changed after the install, then just follow these steps. But if you had edited it, then you know what we are doing. We are just going to the end of the file where all the environment setups are completed.
  4. Enter the command-line syntax of the application. Every Linux application has one. For me, I wanted to fire up the IM client.
    gaim &
    That fires up the GAIM. The ‘&’ is to specify it to make it a background process.
  5. Save it.
    [Esc]
    :wq
    [Enter]

    That is it. Next time you login, the application you specified would have started up. You can choose any application you want and if you have more than one application to be put on startup, put them on separate lines.

In Ubuntu, there is a simpler way. Go to System > Preferences > Sessions. Then, with the ‘Startup Programs’ as the selected tab, click on Add. Give the name and command, and hit OK. You are done.

So, why do we need to know the hard way when there is a simpler solution? Well, the GUI setup does not have facility to order startups of more than one application. By working with the .profile, you have much more programmatic control over it.

Update :  Andy has shared with us the tip to do the above mentioned task (i.e. configuring startup programs) in Kubuntu and most likely these steps will work with any KDE. Here are the steps mentioned by Andy.

PS: To find more posts by Vyoma, visit Splat and KalaaLog.com.


Other Important Articles
Posted by Vyoma | Categories: Blogging Tips |

Share with others

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

29 Responses so far | Have Your Say!

  1. Michael Magua
    August 12th, 2007 at 4:14 am #

    The influx of ubuntu idiots posting guides which in reality are not ubuntu specific yet in the topic it states “do xyz on ubuntu” is rather worrying and quite frankly im getting sick of it.

  2. TipsoSaurus
    August 12th, 2007 at 5:03 am #

    @ Michael : I guess you didn’t read the whole post properly. In the end of the post, it has the easy way. The above steps is the way you can do it in any linux distro.

  3. Michael Magua
    August 12th, 2007 at 5:08 am #

    @author: Exactly, and a ~/.profile file is not Ubuntu specific. Many Linux distributions come with a ~/.profile file. Your topic says “… in Ubuntu”.

    A good read: http://www.thejemreport.com/mambo/content/view/340/

  4. Michael Magua
    August 12th, 2007 at 5:14 am #

    And regarding what you say about the easy way:

    “In Ubuntu, there is a simpler way. Go to System > Preferences > Sessions. Then, with the ‘Startup Programs’ as the selected tab, click on Add. Give the name and command, and hit OK. You are done.”

    -sigh

  5. Vyoma
    August 12th, 2007 at 9:07 am #

    Michael, yes – .profile is not specific to Ubuntu. It is something that was designed for Unix.

    If you had read the full article before passing judgment, you would have seen that I tried to explain why I went on to explain the general way.

    As far as the ‘good read link’ you had pointed to, I cannot agree with it. The tech writers need to see who the audience are. It is not about dumbing down the instruction, but it is about targeting audience.

    I have met enough people who have been bred on pirated copies of Windows. When I explain that there are other options available, they are unable to work for more than a day or two, because they are pretty used to what Windows was.

    It is the arrogance of this nature where we refuse to explain in detail to someone not versed in Linux, that is being a hurdle for the wide acceptance.

  6. Michael Magua
    August 12th, 2007 at 9:19 am #

    Dude you are totally missing the point and it shows how completely arrogant you are. Why does your topic mention Ubuntu? None of this has to do with Ubuntu? Many Linux distributions do this and the menu way of doing it is neither Ubtuntu specific but Gnome specific.

    You keep saying “maybe if you had the read the article …” well I have. And all you talk about is DOING XYZ IN UBUNTU!

    I guess these days posting about Ubuntu generates traffic and add revenue. I’m so sorry.

  7. Vyoma
    August 12th, 2007 at 9:27 am #

    I am sorry if it came out offensively, when I said taking such a stance is arrogant.

    As far as why it is mentioned as Ubuntu – I have not used any other distributions to that extent. Hence, I cannot talk about them definitively. I worked on Ubuntu, and I am sharing that experience.

    On the next point of if the article is necessary or not – you mentioned that posting on Ubuntu generates traffic. Which means, there are people searching for these things out there. If such posts are unnecessary, then there would be no traffic. Just the demand would take care of what is supplied.

    Hence, I have to disagree with you on the style of presentation.

  8. Jeff
    August 13th, 2007 at 9:12 pm #

    I’d just like to say, I’m a new Feisty Fawn user (from WinXP), and I used this entry to set up a few startup programs. The fact that the solution may be portable to other distros does not in any way hinder its usefulness as an Ubuntu solution. Indeed, I appreciated the generic/technical explanation, as it provides a programmatic alternative that is both useful in Ubuntu and portable to other distributions, which I will consider invaluable if I choose to experiment with them.

    Michael Magua needs to take a few deep breaths and some Zoloft.

  9. Vyoma
    August 13th, 2007 at 9:28 pm #

    Glad that you stopped by Jeff. It feels good that the effort was useful to one other person.

    By the by, let me know if you would like to know something else. I too am learning – and I would love to share.

  10. Andy Goss
    August 14th, 2007 at 1:46 am #

    This is useful. I tried a GUI way once in SUSE 10.1 I think and it didn’t work, thanks for giving the easy, but limited, way for Ubuntu AND the generic, less limited way.
    I run Kubuntu 6.06, and there appears to be a different, and better, GUI way of doing it. Control Centre > KDE Components > Session Manager. This gives you the option of starting from a manually saved session. Select and apply the option, then, with your chosen set of apps running, save the sesssion. When you set the Session Manager, a Save Session entry appears on the K Menu below Switch User.
    From memory I think I used this before on a KDE desktop, maybe FC4, so it ought to apply to any KDE desktop.

  11. TipsoSaurus
    August 14th, 2007 at 3:07 am #

    @ Andy : Thanks for your visit, I’m glad that the tip by Vyoma helped you. And sharing the steps of doing the same thing in Kubuntu. I’ll update the post just now to include these steps too.

    Hope to see you as a regular visitor :)

  12. Vyoma
    August 14th, 2007 at 6:37 am #

    Andy, thanks for dropping by and sharing the KDE tip. :) On a side note, Ubuntu is a GNOME desktop, is it not? (I am not sure).

    Mayank, I see that you have updated the post. :)

  13. Andy Goss
    August 14th, 2007 at 5:15 pm #

    Yes, Ubuntu is GNOME, Kubuntu is KDE. If you have Ubuntu you can also install Kubuntu. Then you will find options under “session” in the login screen to select your desktop. See:
    http://www.kubuntu.org/faq.php#installfromubuntu
    Most if not all distros have KDE available in a similar fashion. I have used it in FC4, SUSE 10.1, and CentOS 5. KDE has a more comprehensive application set, many of them KDE specific, and I find it altogether more functional than GNOME.
    If you are trying KDE, the Quicklauncher applet will save you space on the panel, by giving you a double row of tiny icons instead of the huge blobs that come as standard.

  14. nf
    August 17th, 2007 at 9:37 pm #

    I found this useful and exactly what i was looking for.
    Thanks.

  15. TipsoSaurus
    August 18th, 2007 at 12:12 am #

    @ Andy : Thanks for the link and explaining that how one can install KDE in ubuntu.

    @ nf : I’m glad that you found it useful. Vyoma and me will be posting more tips n tricks on ubuntu, soon.

  16. doron
    September 6th, 2007 at 1:11 pm #

    Andy, how can i save my session in kubuntu??

    thanks

  17. Andy Goss
    September 11th, 2007 at 1:48 am #

    Saving a KDE session.

    This is how it works with Kubuntu 6.06, so I assume it will be much the same for any KDE.

    1) Open the Control Centre or the System Settings.

    2) Click on “KDE components”.

    3) Click on “Session Manager”.

    4) There is a set of radio buttons called “On Login”, click the “Restore Manually Saved Session” button, then click “Apply”, and close the Control Centre or System Settings.

    5) Set up everything just the way you want it to appear on login, even the window order is remembered. Some programs, such as Open Office, may not open with any specific file, others, such as Kate, that are KDE tools, will open with the file that was open when you saved the session.

    6) Saving the session (at last!)
    Click on the K button. My menu reads, from the bottom, “Log Out”, “Lock Session”, “Save Session”, “Switch User”. Click on the “Save Session” button. Next time you log in your session will be restored as at that click.

    NOTE that the “Save Session” button will only appear on the K menu after you have set Session Manager to “Restore Manually Saved Session”.

    Any time you want to change your saved session, just set things up the way you want them and click the “Saved Session” button again.

  18. Stop whining
    September 18th, 2007 at 5:57 am #

    Michael Magua wrote:
    > The influx of ubuntu idiots posting guides which in reality are not ubuntu specific yet in the topic it states “do xyz on ubuntu� is rather worrying and quite frankly im getting sick of it.

    Dear Michael,

    Please get a life. I, for one, am sick of elitists. If you want people to use Linux – and you should – then why the hell do you insult them when they make an effort to do so? Idiot.

    I for one found the tip helpful and informative.

    Regards,
    A Reformed Windows User

  19. Orgrimdoom
    September 18th, 2007 at 4:45 pm #

    Thx, very nice guide ^^

  20. jarelkamar
    October 30th, 2007 at 10:29 pm #

    this may look retarded , but how to get the command of a program I want to add to startups ?

    thx in advance

  21. Vyoma
    November 5th, 2007 at 7:15 pm #

    Well, that would depend on the program. The easiest way to find out the command and command line options for any program is to search the net. :)

  22. learner
    December 17th, 2007 at 9:12 pm #

    Its a cooool article, I don’t care about what people say …………. for me the article did a great job. The linuxbug is catching on me. I don’t like this distro specific stuff anyways.

    Bunch of Thanks for the tip. Please keep writing such tips don’t ever be discouraged by comments of certain people.

  23. TipsoSaurus
    December 19th, 2007 at 2:57 am #

    @ learner : Thanks for the feedback. I’ll try and write more and more tips like these and will ensure that the blog will be helpful for everyone.

  24. benji
    February 22nd, 2008 at 4:38 pm #

    I found this to be a very helpful tip. It’s nice to know the easy way as well. I probably wouldn’t have thought to look under sessions. I kept thinking it must be in boot start-up or something like that. I like Ubuntu a lot. The ease of use is nice.

  25. lavan
    July 14th, 2008 at 1:16 pm #

    This is why Linux will never replace Microsoft’s OS as the defacto desktop operating system.

    The Michael Magua’s of the world just put people off.

  26. Frank
    September 11th, 2008 at 2:46 pm #

    All I needed! Helped me ;-)
    Though with the title place the easy way at the top and then the advanced, would have saved a lot of discussion.

    But still very helpfull! Cheers

  27. Chris K
    November 26th, 2008 at 4:28 am #

    Great tip, its nice to see more than just the System > Preferences > Sessions solution which is all over the net already I just had one more specific question, .profile will run even if i login with my windows manager disabled (ie. directly into a consol) right? is there a variable or function i can put into an 'if' statement to keep GUI based apps from running if i'm not running a GUI?

    /Chris
    PS vi is for chumps, emacs forevah! =P

  28. Omar
    January 18th, 2009 at 9:01 am #

    in Ubuntu linux you can press on System-> Preferences -> Sessions

  29. Carrot
    April 18th, 2009 at 2:17 pm #

    Why the hell doesnt Ubuntu add a right click start on bootup option like in Linux Mint? Too damn easy!

Leave a Feedback

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>