If not yet done by default install gnome-startup-applications
Search and open "Startup Applications"
click add to enter the command including options of your application as you would run it from terminal (you may have to give in the full path if it runs from a non-standard location)
This will add a .desktop file in your ~/.config/autostart
14.04 and later
Open the Dash and search for "Startup Applications"
Now click on Add and give in the command to run the application. This can be found in Main Menu if installed (see below)
Using Main Menu (alacarte) to find the terminal command to run a given program:
Firstly open the program 'Main Menu' (type Menu in the Dash)
Now select the program which you want to add to startup and click on properties .
Now note the command for that program .
Non GUI approach
Advanced users may want to manually put a .desktop file in ~/.config/autostart to run applications after a user login. This may have following content:
[Desktop Entry]
Type=Application
Name=<Name of application as displayed>
Exec=<command to execute>
Icon=<full path to icon>
Comment=<optinal comments>
X-GNOME-Autostart-enabled=true
You may have to give this file execute permission.
For older versions: If the program you wish to run on startup is in the Applications menu, you can drag-and-drop it into the Startup Applications window to add it to the list.
Type the name of the program, browse to the command, and then click add.
Addition: Here is a sample that I use to autostart Guake (the Gnome version of Yakuake):
Put this in the 'command' box.
sh -c "sleep 120s; guake"
This starts guake automatically, but waits 2 mins before doing so. You can change the 120 to whatever you wish.
For 14.04 and 16.04
Type Startup in Dash, and run Startup Application form there
And then just follow the rest of the steps.
Please note that, if you are using Ubuntu in another language, "startup" might not find the correct program. Try another search that is in your language.
If the GUI is not what you want, and you want is more advance control, then you can put .desktop files in the ~/.config/autostart/ directory for Xfce4, and a .desktop file in ~/.config/autostart for Unity to run applications after a user login.
Check this question to get more help on creating .desktop files:
Also note if you want a startup application to start only in XFCE, but not in Unity, you have to put the line OnlyShowIn=XFCE in the .desktop file. It is OnlyShowIn=Unity for a Unity only application.
To do this with a command that requires sudo is a bit tricky.
In my case, I wanted to disable the PSMOUSE driver using the command sudo rmmod psmouse to prevent a mouse click problem that randomly manifests itself. See Dealing with Mouse and Touchpad Freezes in Linux for more info on this problem. I got tired of entering it on every boot.
On my install, the ~/.config folder did not have an autostart sub-folder, so I created one. This enabled my Startup Applications Preferences settings to be saved.
In order to toggle visibility of hidden startup applications, you can use the following commands.
To show them :
sudo sed -i 's/NoDisplay=true/NoDisplay=false/g' /etc/xdg/autostart/*.desktop
To hide them :
sudo sed -i 's/NoDisplay=false/NoDisplay=true/g' /etc/xdg/autostart/*.desktop
Configure your command as per above posts in the Startup Applications Perferences window.
Then you have to edit the /etc/sudoers file using sudo visudo.
Add a line that contains the following info:
username ALL=(ALL) NOPASSWD: /sbin/rmmod
You must enter this line below the line which starts with %admin. I added my line to the end of the file.
It is IMPORTANT to use sudo visudo to edit this file as making a mistake will prevent you from being able to do any sudo commands at all. If that happens, boot in recovery mode and undo your edits, then try using sudo visudo.
Note:
Initially I tried using a bash script to run my the command indirectly, but this didn't work. I had to put sudo rmmod psmouse directly in the Edit Startup Program window.
Launch Startup Application from the top right menu
Without clicking on Add, open Dash and type the application you want running at startup e.g. Skype
Drag the application to the Startup application window. If Dash windows is too big that you can't drag your app outside, use the restore window button (shown in the previous image) at the top left corner. Final list looks like this:
Also to put a BATCH FILE into start up applications to run after user login....
type at the command line in start up applications in the field Command:
gnome-terminal -e "/batch-path/batch-name.sh"
gnome-terminal: open the terminal after user login with current user privileges
-e: set the terminal to execute the batch file
/batch-path/batch-name.sh: is the batch full path and full name
Remember than the file batch permissions to set the flag Allow executing file as a program to ON.
20.04 and later
If not yet done by default install
gnome-startup-applications
Search and open "Startup Applications"
click add to enter the command including options of your application as you would run it from terminal (you may have to give in the full path if it runs from a non-standard location)
This will add a
.desktop
file in your ~/.config/autostart14.04 and later
Open the Dash and search for "Startup Applications"
Now click on Add and give in the command to run the application. This can be found in Main Menu if installed (see below)
Using Main Menu (alacarte) to find the terminal command to run a given program:
Firstly open the program 'Main Menu' (type
Menu
in the Dash)Now select the program which you want to add to startup and click on properties .
Now note the command for that program .
Non GUI approach
Advanced users may want to manually put a
.desktop
file in~/.config/autostart
to run applications after a user login. This may have following content:You may have to give this file execute permission.
For 11.04 and newer see here: How do I start applications automatically on login?
For older versions: If the program you wish to run on startup is in the Applications menu, you can drag-and-drop it into the Startup Applications window to add it to the list.
Launch Startup applications from Dash
Click on Startup Applications
And then click on add
Type the name of the program, browse to the command, and then click add.
Addition: Here is a sample that I use to autostart Guake (the Gnome version of Yakuake):
Put this in the 'command' box.
This starts guake automatically, but waits 2 mins before doing so. You can change the 120 to whatever you wish.
For 14.04 and 16.04
Type Startup in Dash, and run Startup Application form there
And then just follow the rest of the steps.
Please note that, if you are using Ubuntu in another language, "startup" might not find the correct program. Try another search that is in your language.
Both Unity and Xfce4 have GUI programs that allow you to control startup applications.
For Unity:
For Xfce4 Startup tool is available in Settings > Session and Startup
Image courtesy of Xubuntu Geek xubuntugeek
If the GUI is not what you want, and you want is more advance control, then you can put
.desktop
files in the~/.config/autostart/
directory for Xfce4, and a.desktop
file in~/.config/autostart
for Unity to run applications after a user login.Check this question to get more help on creating
.desktop
files:Also note if you want a startup application to start only in XFCE, but not in Unity, you have to put the line
OnlyShowIn=XFCE
in the.desktop
file. It isOnlyShowIn=Unity
for a Unity only application.You might want to start it from a CLI via:
(just in case you're not running GNOME ;))
Take a look at $XDG_CONFIG_DIRS/autostart directory:
which says there are 3 directories in this example. I wanted to prune the nautilus entry
otherwise if you can add it, create a Desktop entry file:
sudo touch /etc/xdg/autostart/my-shell-autostart.desktop
add these contents:You can use GNOME Startup Application.
Click the Add button and then add the full command to open the application you want. If you don't know the path of the command you can do
Ubuntu 13.10 with UNITY Instructions
To do this with a command that requires
sudo
is a bit tricky.In my case, I wanted to disable the PSMOUSE driver using the command
sudo rmmod psmouse
to prevent a mouse click problem that randomly manifests itself. See Dealing with Mouse and Touchpad Freezes in Linux for more info on this problem. I got tired of entering it on every boot.On my install, the
~/.config
folder did not have an autostart sub-folder, so I created one. This enabled my Startup Applications Preferences settings to be saved.In order to toggle visibility of hidden startup applications, you can use the following commands.
To show them :
To hide them :
Configure your command as per above posts in the Startup Applications Perferences window.
Then you have to edit the /etc/sudoers file using
sudo visudo
. Add a line that contains the following info:You must enter this line below the line which starts with %admin. I added my line to the end of the file. It is IMPORTANT to use
sudo visudo
to edit this file as making a mistake will prevent you from being able to do anysudo
commands at all. If that happens, boot in recovery mode and undo your edits, then try usingsudo visudo
.Note:
Initially I tried using a bash script to run my the command indirectly, but this didn't work. I had to put
sudo rmmod psmouse
directly in the Edit Startup Program window.For Ubuntu 12.04,
Launch Startup Application from the top right menu
Without clicking on Add, open Dash and type the application you want running at startup e.g. Skype
Drag the application to the Startup application window. If Dash windows is too big that you can't drag your app outside, use the restore window button (shown in the previous image) at the top left corner. Final list looks like this:
Also to put a BATCH FILE into start up applications to run after user login.... type at the command line in start up applications in the field Command:
gnome-terminal
: open the terminal after user login with current user privileges-e
: set the terminal to execute the batch file/batch-path/batch-name.sh
: is the batch full path and full nameRemember than the file batch permissions to set the flag Allow executing file as a program to ON.