Whenever we want to access our favorite Ubuntu applications, we can add them to the Activities or Dock panel so that we can use them very frequently. It is very simple to add an application to the Activities panel; you can right-click the application and select the Add to Favorites option from the menu. But how do we add the Trashcan to our favorites since it exists mostly on our Desktop rather than in the Applications listing?

This article explains a step by step procedure to solve this small issue. First, we will write a bash script that will add the Trashcan to the Applications list and then add it to our favorites, which will also add it to the system Dock. We will also enable our system to run the script every time we boot out Ubuntu system. This way you can have the Trashcan available through one click, all the time on your Ubuntu desktop.

We have run the commands and procedures mentioned in this article on an Ubuntu 18.04 LTS system.

Step 1: Open the Terminal application

We will be using the Ubuntu command line, the Terminal, to write a script that will be used to add the Trashcan to the Applications list. You can open the Terminal either through the system Dash or the Ctrl+Alt+T shortcut.

Step 2: Create a Script File to put Trashcan to the Applications list

Once the Terminal is open, you can create a script .sh file through any one of your favorite text editors. In this article, we will be using the gedit editor to create a file by the name trashcan.sh.

You can also create a similar file by using the following command.

$ gedit ~/Documents/trashcan.sh

Create trashcan.sh file

When the empty script file is opened, please copy the following bash script and paste it in the newly created file.


while getopts "red" opt; do
 case $opt in
  if [ "$(gio list trash://)" ]; then
   echo -e '[Desktop Entry]\nType=Application\nName=Trash\nComment=Trash\nIcon=user-trash-full\nExec=nautilus trash://\nCategories=Utility;\nActions=trash;\n\n[Desktop Action trash]\nName=Empty Trash\nExec='$HOME/Documents/trashcan.sh -e'\n' > $icon
  gio trash --empty && echo -e '[Desktop Entry]\nType=Application\nName=Trash\nComment=Trash\nIcon=user-trash\nExec=nautilus trash://\nCategories=Utility;\nActions=trash;\n\n[Desktop Action trash]\nName=Empty Trash\nExec='$HOME/Documents/trashcan.sh -e'\n' > $icon
  while sleep 5; do ($HOME/Documents/trashcan.sh -r &) ; done

Then save the file either through Ctrl+S or by clicking the Save button.

trashcan.sh script

Step 3: Execute and Run the bash script

Use the following command in order to make the recently created bash script executable:

$ chmod +x ~/Documents/trashcan.sh

chmod on trashcan script

You can now run the script through the following command:

$ ./Documents/trash.sh -e

Run the script

As soon as the bash script is executed, the Trashcan will be added to the Applications list. You can either search for it through the system Dash or locate it manually in the Applications list.

Trash shown in applications list

Step 4: Add the Trashcan to the Activities panel/Dock

Once the Trashcan is added to the Applications list, it is very simple to add it to the Activities panel or system Dock, that is usually located at the left side of your Ubuntu Desktop.

In the Applications list, right-click the Trashcan icon and select Add to Favorites from the menu.

Add to favorites

Now you will be able to see the Trashcan icon in the activities list. However, you will notice that the Trashcan icon is displayed as empty even if the Trashcan is actually not empty. The article will later explain how to fix the issue.

Trash in Sidebar

Step 5: Add the Trashcan bash script program to the Startup Applications

The Trashcan now appears in the Applications list because we have run the bash script to do so. If you want to see the Trashcan in the Applications every time you boot the system, it is best to add the bash script in the Startup Applications.

Open the Startup Applications utility either by locating it in the Applications list or simply by searching for it through the system Dash.

Search startup app

When the Startup Applications utility opens, click the Add button to add a new program to startup.

In the Add Startup Program dialog, enter the following information:

Name: Trashcan Icon (or any name for the startup program)

Command: /home/[username]/Documents/[script_filename.sh] -d


/home/sane/Documents/trashcan.sh -d

Comment: Adds trashcan to applications list (or any other relevant comment)

Edit startup program

Now click the Save button. Every time you boot the system, this program will run the trashcan.sh script and add the Trashcan to the Applications list.

Step 6: Reboot your Ubuntu system

You will observe that the Trashcan icon added to the Activities panel/Dock will be displayed as empty even if the Trashcan contains come files. Simply reboot your Ubuntu system and when you login back, you will see that the Trashcan icon now displays the actual status of the Trash folder.

Reboot the system

After following the steps explained in this article, you can very easily add the Trashcan to the Activities panel and access it quickly. You do not even need to be a Linux guru to do so, the script that we mentioned in this article is all you need to solve the little problem at hand.

How to Add the TrashCan to Ubuntu Activities Panel/Dock