0

I recently installed silversearcher-ag with sudo and uninstalled it as it required sudo to run the command every single time.

The command I used to install and uninstall this package respectively:

# installation sudo apt install silversearcher-ag 
# uninstallation sudo apt remove silversearcher-ag sudo apt autoremove 

As mentioned by the comment, here's the output for type -a ag:

ag is aliased to `apt-get update;apt-get dist-upgrade' 

After uninstallation, I found that if I do sudo ag, the command would correctly fail due to command not found; however, if I simply do a ag as user, I was still able to run the command ( although the command actually failed due to lack of permission, i.e., it has to be run with sudo every single time).

I've looked at places like /usr/bin/, /usr/local/bin, /usr/sbin/, /usr/local/sbin, sbin/, bin/, the ag command didn't reside in any of them.

whereis, locate returned no matching results.

I've also tried

sudo apt purge silversearcher-agsudo apt purge silversearcher-ag*

The first command actually removed some additional affliations, the second simply removed none. After these two commands the ag was still there.

What do I need to do to completely remove this package?

I am running MX Linux 23-ahs, based on Debian 12 bookworm.

5
  • @terdon Is there a way to locate the apt aliases? or where does apt store all its aliases on system?
    – stucash
    CommentedOct 16, 2024 at 17:11
  • What are apt aliases? Sounds like that should be a separate question.
    – terdon
    CommentedOct 16, 2024 at 17:44
  • Oh, sorry, I just saw you had that aliased to an apt command. That's almost certainly something you did and forgot. Try grep 'apt-get update;apt-get dist-upgrade' ~/.bashrc or, if it isn't in ~/.bashrc try grep 'apt-get update;apt-get dist-upgrade' ~/.bashrc ~/.profile ~/.bash_profile ~/bash.login ~/.bash_aliases /etc/bash.bashrc /etc/profile /etc/profile.d/ /etc/environment 2> /dev/null it should be in one of those.
    – terdon
    CommentedOct 16, 2024 at 17:47
  • @terdon yes I found it in /etc/bash.bashrc; which to my knowledge very peculiar. I almost never touch that file. Anyway, we know what caused this now!
    – stucash
    CommentedOct 16, 2024 at 18:14
  • @stucash it is possible that MX Linux ships with that alias defined.
    – terdon
    CommentedOct 16, 2024 at 18:19

1 Answer 1

2

The best way to find what you are actually executing when you run a command is type -a. For example:

$ type -a ls ls is aliased to `ls --color=tty' ls is /sbin/ls ls is /usr/sbin/ls ls is /usr/bin/ls ls is /usr/bin/ls ls is /bin/ls ls is /sbin/ls ls is /bin/ls 

As you can see above, that finds the various ls executables I have (I'm running Arch, those are all symlinks to /usr/bin/ls), and also an alias. Chances are, you have some unrelated command or alias with that name and that's what you see running.

In your case, you had ag aliased to apt-get update;apt-get dist-upgrade, two commands that require root, hence the error about needing to run as root.

    You must log in to answer this question.

    Start asking to get answers

    Find the answer to your question by asking.

    Ask question

    Explore related questions

    See similar questions with these tags.