Adding or removing apps pinned to the Unity launcher in Ubuntu isn't a big deal - just do a right click and select the relevant option to remove an app icon from there, and drag and drop an icon on the launcher to add it there.
But do you know how to do all this from the command line? No? Don't worry, as in this article, we will be discussing exactly this. But before we do that, it's worth mentioning that all the instructions mentioned in this tutorial have been tested on Ubuntu 16.04 LTS.
Add/remove Unity launcher icons through command line
Sadly, there's no built-in tool to do this. But the good thing is that there exists a third-party script that can do this work for you. It's basically a Python script that you can install on your system by running the following commands:
sudo git clone https://github.com/SergKolo/sergrep.git ~/bin/sergrep echo "PATH=$PATH:$HOME/bin/sergrep" >> ~/.bashrc source ~/.bashrc
Once this is done, you can run the script in the following way:
launcherctl.py [options]
This is what the tool's help page says:
So, to list all the items that are currently there in my launcher, you can run the following command:
launcherctl.py -l
here's the output in my case:
To remove an entry, use the -r command line option followed by the -f option that expects the entry name. For example, I removed the GIMP icon from my launcher using the following command:
launcherctl.py -r -f gimp.desktop
Similarly, to add an app icon, use -a instead of -r. For more information on Unity launcher and its pinned icons, head here.
on 18.04 it invocation causes a core dump