2

I am new to Linux, trying to clean my system after deleting a package 'thunderbird'.

I use command sudo ls -lRa . | grep thunderbird to find all the remaining config files and other leftover files to remove them from my system.

This command is very useful and helps me a lot to locate the files related to a specific package. I have already deleted all the directories related to thunderbird, but when I run sudo ls -lRa . | grep thunderbird command, this is what I am seeing now:

-rw-rw-r-- 1 kao kao 75786 bal.  16 01:26 appimagekit_206c725ecb426eabc4dcda2a204bf247_thunderbird.png
-rw-------  1 kao kao  140 bal.  17 16:48 thunderbird[2].desktop
-rw-------  1 kao kao  140 bal.  17 16:48 thunderbird[3].desktop
-rw-------  1 kao kao  140 bal.  17 16:50 thunderbird[4].desktop
-rw-------  1 kao kao  140 bal.  17 16:53 thunderbird[5].desktop
-rw-------  1 kao kao  140 bal.  17 16:53 thunderbird[6].desktop
-rw-------  1 kao kao  140 bal.  17 16:29 thunderbird.desktop

What are those files, how to locate them and remove them?

m27
  • 427
  • 1
  • 5
  • 16
  • find . -name '*thunderbird*' would likely be a better way to find the files – steeldriver Apr 17 '20 at 14:21
  • Please clarify: is cleaning config + leftovers the goal ? Or just context to the question how to find and remove specific files ? [Edit] title to describe the actual problem – hc_dev Apr 17 '20 at 22:48

4 Answers4

3

how to locate them and remove them?

One way to do it would be using the command find

sudo find / -iname '*thunderbird*'

Like this you will parse all the file system and will see every element that contains the expression "thunderbird"

Alternativly we have fd-find in our repositroy which is faster then find (because it uses multithread) It is not installed by default, you can install it with apt

sudo apt install fd-find

Syntax is lighter and output is colorized

fd thunderbird /

You can also use locate

locate thunderbird

To remove a file use the rm command

Gryu
  • 7,559
  • 9
  • 33
  • 52
kcdtv
  • 2,325
  • 3
  • 16
  • 22
  • Thanks!

    sudo find / -iname '*thunderbird*' is a really strong command!

    why do I get different results with

    sudo find / -iname '*thunderbird*'

    and

    locate thunderbird

    – m27 Apr 17 '20 at 15:04
  • Hi, @shiu'sho, why you need sudo for this operation? – pa4080 Apr 18 '20 at 12:43
  • Hi, @kcdtv, we can pipe the output of find to xargs ... rm, or we can add to find the options -delete or -exec rm {} + in order to delete all files found. – pa4080 Apr 18 '20 at 12:46
  • @ shiu'sho: locate works diferently, it parses a data base created on system startup while find realy parse the system in the moment you execute it. That why you may have some elements not found by locate @ pa4080: if you don't use sudo you won't get the pathes outside your user file system. Thanks for the tips to do everything at once. – kcdtv Apr 20 '20 at 12:47
1

You generally don't need to do it by hand. Package manager will take care of removing system-wide configs of given package using purge action or when providing --purge for remove action

sudo apt purge thunderbird

From apt-get(8):

purge: purge is identical to remove except that packages are removed and purged (any configuration files are deleted too).

--purge: Use purge instead of remove for anything that would be removed. An asterisk ("*") will be displayed next to packages which are scheduled to be purged. remove --purge is equivalent to the purge command. Configuration Item: APT::Get::Purge.

If you still feel like looking up file by somehow matching with name use find as suggested in other answers; it will output full path of the matched file.

dav23r
  • 17
  • 1
    As I read OPs question, you sensed the issue incl. suitable solution Could the purge also be done way after apt remove ? – hc_dev Apr 17 '20 at 22:43
  • 1
    @hc_dev Yes, there's a separate package state called config-files in dpkg: https://manpages.debian.org/stretch/dpkg/dpkg.1.en.html. Also, I was not right about user configs, they are not deleted by apt as explained here: https://askubuntu.com/questions/151941/how-can-you-completely-remove-a-package, only system-wide configuration is purged, so editing that part. (The .desktop files OP mentions probably will be handled by purge) – dav23r Apr 18 '20 at 12:33
0

Desktop files are analog to Start Menu shortcuts in Windows. Those files register some command or application in the system. Those files define the inicialization parameters of a application or command.

They are stored in /usr/share/applications to every user or ~/.local/share/applications if its only acessible to one user.

Exemple:

[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=Nome do aplicativo de exemplo
Comment=Um aplicativo de exemplo
Exec=aplicativo
Icon=aplicativo.png
Terminal=false

[Desktop Entry]

First line and header of the file. 

Type=Application

Tells the enviroment that this desktop file belongs to a application. May also be a Link or Directory.

Encoding=UTF-8

Describe the coding of the file.

Name=Example Name

Application names for the menu and any launcher.

Comment=A exemple of an app

Describe the  application ("tooltip").

Exec=aplicativo

The shell command that start the application. 
May have arguments.

Icon=application.png

Icon's file.

Terminal=false

Describe if the application must beexecuted ina terminal.

Souce: https://developer.gnome.org/integration-guide/stable/desktop-files.html.pt_BR

0

When you want to remove user specific configuration files and application data:

Your configuration files are located in the ~/.thunderbird folder, where ~ means your home folder.

You can remove with the following command:

rm -fr ~/.thunderbird
GuBo
  • 1