Xarrus
Xarrus

Reputation: 85

How to uninstall several applications?

Is there a way to uninstall several applications using command in the BASH? I would like to uninstall all applications based on emacs. More precisely. There are several applications whose name is something like emacsX, with X being some number or letter. Is there a way to uninstall all applications of these kind, without using the command sudo apt-get remove emacsX ten times?

Upvotes: 0

Views: 80

Answers (1)

wvinyl
wvinyl

Reputation: 84

apt-cache search --names-only '^emacs*' | awk '{print $1}' | xargs -L1 sudo apt-get -y remove

Explained:

  1. The first pipe finds the emacs packages that you have installed.
  2. Next we use awk to get only the first column of the data that exists
  3. Lastly we use good old xargs to apply the package remove command to each row.

Upvotes: 1

Related Questions