function nuke() { if [ $(whoami) != "root" ] ; then for x in $@; do sudo apt-get autoremove --purge $x; done; else for x in $@; do apt-get autoremove --purge $x; done; fi }

Remove apps with style: nuke it from orbit

You can't stand programs x, y, and z. Remove all trace of their existence by adding this function to your config. It will remove the cruft, the settings, and such and such. This function doesn't even give a damn about you trying to remove programs that don't exist: it'll just for loop to the next one on your hit list.
Sample Output
hello@goodbye:~$ nuke amarok emacs vim
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Couldn't find package amarok
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Couldn't find package emacs
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Couldn't find package vim
hello@goodbye:~$

1
By: ruinbox
2009-03-25 23:21:21

These Might Interest You

  • Remove newlines from output. One character shorter than awk /./ filename and doesn't use a superfluous cat. To be fair though, I'm pretty sure fraktil was thinking being able to nuke newlines from any command is much more useful than just from one file.


    7
    grep . filename
    TheMightyBuzzard · 2009-08-09 05:33:58 2
  • Style analyses the surface characteristics of the writing style of a document. It prints various readability grades, length of words, sentences and paragraphs. It can further locate sentences with certain characteristics. If no files are given, the document is read from standard input. style is part of "diction" package Show Sample Output


    2
    style TEXT-FILE
    alperyilmaz · 2010-10-27 08:07:04 1
  • Middle click on titlebar to minimize apps


    2
    gconftool-2 --set "/apps/metacity/general/action_middle_click_titlebar" --type string "minimize"
    Bonster · 2011-03-31 07:38:05 1
  • This finds all the PowerPC apps recognized by OS X. A better version is: system_profiler SPApplicationsDataType 2> /dev/null | perl - wnl -e '$i=$j=$k=$p=0; @al=; $c=@al; while($j s[$i].=$al[$j]; $i++ if ($al[$j]) =~ /^\s\s\s\s\S.*:$/; $j++} while($k apps[$k++]; if (/Kind: PowerPC/s) {print; $p++;}} print "$i applications, $p P owerPC applications\n\n"' but that is more than 255 characters...


    0
    system_profiler SPApplicationsDataType | perl -nl -e '@al=<>; $c=@al; while($j<$c){ $apps[$i].=$al[$j]; $i++ if ($al[$j] ) =~ /^\s\s\s\s\S.*:$/; $j++} while($k<$i){ $_=$apps[$k++]; if (/Kind: PowerPC/s) {print;}}'
    drewk · 2009-09-06 20:56:48 0

  • 0
    heroku manager:apps --org org-name | xargs -I {} heroku apps:delete {} --confirm {}
    ericfode · 2012-12-20 07:42:24 0
  • the --time-style argument to 'ls' takes several possible modifiers: full-iso, long-iso, iso, locale, +FORMAT. The +FORMAT modifier uses the same syntax as date +FORMAT. --time-style=+"%Y-%m-%d %H:%M:%S" strikes a happy medium between accuracy and verbosity: ls -lart --time-style=long-iso doesn't show time down to the nearest second, ls -lart --time-style=full-iso displays time to 10E-9 second resolution, but with no significant digits past the full seconds, also showing the timezone: -rw-r--r-- 1 bchittenden bchittenden 0 2011-02-10 12:07:55.000000000 -0500 bar Show Sample Output


    4
    ls -l --time-style=+"%Y-%m-%d %H:%M:%S"
    bartonski · 2011-02-10 17:15:37 2

What Others Think

this can be shortened a lot. sudo aptitude purge $@ should accomplish the same thing. Aptitude throws an error on packages not found, as opposed to stopping like apt. Additionally, the default behaviour of aptitude is to autoremove packages, so that libraries installed for something you removed will go away.
clockworkavian · 477 weeks and 4 days ago
Wow thanks. I did not know that about aptitude. Well that settles it then. Move along, nothing to see here.
ruinbox · 477 weeks and 3 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: