SUSE root Logo

 Home -> SUSE Linux Adventures -> Load at Startup
 Main Menu
 Recent Blog Posts

NetIQ Video

Treo 700p Tether with Linux

SUSE 10.2 on Dell Optiplex 320

SUSE 10.2

...the blog

 Loading Applications at Startup

In the course of learning more about SUSE and Linux you will be adding and removing applications. You may find that you want a certain program to start automatically whenever you boot. This is a fairly simple task and caries a low risk of you breaking anything on your machine. If you are interested in having applications launch when you boot, you are likely to have enough knowledge to be able to complete this process.

Say you wanted SETI@home, superkaramba, a web browser, and/or nearly any other application to load and be waiting for you when you log in. Probably the most flexible and global way to do this is to create or modify your .xinitrc. This is a script that is executed when X is started and is located in your home folder, so regardless of which desktop environment you use (KDE, GNOME, Fluxbox, etc.), the application will be launched.

Unless you have set up a .xinitrc file, it is unlikely that one already exists. However, recent versions of SUSE include a .xinitrc.template file in your home folder when a user is created. If, for whatever reason, you do not have this file, you can see mine here; this is from a SUSE 9.1 box, but I imagine it will be very similar, if not the same, for other recent versions of SUSE. Just copy it, paste it into a text editor, and save it as .xinitrc.template. We can copy this file, modify it, and rename it to .xinitrc. Keep in mind that the "." in front of the file name makes it "hidden", you'll need to adjust your file browser settings to ensure you can view hidden files.

Konqueror File BrowserFirst, open your file browser (konqueror for KDE, Nautilus for GNOME, etc.) and navigate to your home folder (you'll likely be there automatically). Then right-click on .xinitrc.template and open it with your editor of choice (Kate, KWrite, etc.). Then save it as ".xinitrc"; go back to the file browser, right-click on .xinitrc, go to properties, select the "Permissions" tab, and check the "is executable" box. You now have a script that will execute whenever you start X.

Now to modify it so it starts the application of your choice. Scroll down near the bottom of the file and find a line similar to

# Add your own lines here...

Below this hash mark is where we will add our applications. Assume you wanted to launch an xterm window at startup, you would add the line xterm &; the "&" makes the application load in the background so the rest of the script can continue to execute.

If you wanted ksetispy to launch, you would add ksetispy & as a new line. So if you wanted both to launch, you'd have a section of code that now looks like this:

# Add your own lines here...
xterm &
ksetispy &

We used xterm and ksetispy as examples, but you can do this with nearly any application. If you are not sure what command is used to launch your application, go to edit the KMenu (instructions found here in the "KMenu" section.), navigate to the application you want launched, click on it and whatever is in the "Command" field is what you want to use.

Now that you've modified your .xinitrc, save it and close all your applications. We're going to restart the X server to make sure it works. Just to be clear: You're about to end your session, anything you're working on is about to be closed. Push Ctrl+Alt+Backspace and the X server will restart. This should put you back at the log in screen. Log in, and if you're lucky all the applications you just added will be opening while your window manager is loading.

If it didn't work, it's Google time. If something catastrophic happened, just delete the .xinitrc file you created and all should be well.

SiteMap © 2004 by Damian Smith. Trademark and copyleft information is covered on the About SUSEroot page. Contact me at