Sublime Forum

Locate sublime_text issue

#1

Since Package Installtion error in installing color scheme in Ubuntu 18.04 LTS. I use the following commands to remove Sublime Text 3.

Remove sublime-text:

$ sudo dpkg -r sublime-text

check the rest of the paths:

$ sudo find / -name sublime*

remove the rest of the paths.
$ sudo rm -r…

Afterwards, use the following command to check uninstallation of Sublime Text 3. It is interesting to have the following results.

Query 1:

$ ls sublime*
ls: can not access ‘sublime*’: No such file or directory.

Query 2:

$ locate sublime_text
/home/user/Desktop/sublime_text.desktop
/usr/share/applications/sublime_text.desktop

$ sudo find / -name sublime*
The terminal shows the message as follows.
find: ‘run/user/1000/gvfs’: Permission denied.

As a matter of fact, I remove all of the files and paths of sublime text 3. But the terminal shows the above-mentioned inconsistent messages. Because I need to reinstall Sublime Text 3 again. To avoid any conflict issues, I need to get to know what happens. Please help give an answer.

Notes;

Sublime Text 3 is very easily uninstalled in Mac Computer. But it is a little confusing to uninstall in Ubuntu 18.04 LTS. In addition, it frequently have errors in installing packages such as color scheme in Sublime Text 3 in Ubuntu 18.04.

Thanks in advance.

Mike

0 Likes

#2

Potential reasons why locate shows you files and find doesn’t find them:

  1. The locate command uses a database of files for speed, so it’s possible to delete a file physically without it being removed from locatedb, in which case the locate command would still tell you it exists even though it doesn’t. If that’s the case, then sudo updatedb would update the database (usually there’s a cron job that runs to do this sort of thing for you).

    Standard locate doesn’t check for the existence of a file before it tells you it exists, it just uses the database. Some systems use gnu slocate in place of locate. slocate is different in that it will hide from you any files that it doesn’t think you have permission to see or execute. In that case the locatedb contains the names of files, but not permissions.

    That would presume that slocate needs to first use the database to find files, then access them to see what their permissions are, so in that case I would assume that it would in fact notice that the file doesn’t exist and not display anything.

    You may be able to determine if that’s the case via one of these commands:

    man locate
    ls -alF `which locate`
    

    In the first case the man page may specifically state that it’s actually slocate, while in the second case you can see if the result is a symlink to slocate.

  2. Executing find / sublime* may not find files because when you execute the command that way, the shell expands the * character wildcard in the argument list before it invokes find, which doesn’t give it the argument that you think it does. You generally want something like find / sublime\* instead (i.e. quote the * so that the shell leaves it alone and passes it to find for find to handle.

    That said, I would expect that if there were no files whose name starts with sublime in the current folder when you run the command, the expansion would fail and you’d see a find error message. Similarly if there was more than one file it would get mad at you because it would expand to multiple files, and if there was exactly one file it should look for and find exactly that one file. So seeing an error wherein it is clearly searching but not finding anything is a bit of a puzzler without more details.

0 Likes