Page 1 of 7 123 ... LastLast
Results 1 to 10 of 61

Thread: Just found a handy command:

  1. #1
    Join Date
    Mar 2010
    Beans
    337
    Distro
    Ubuntu

    Just found a handy command:

    To remove all the unused Linux Kernel headers, images and modules, simply run this command: dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge
    This is Linux. It gives you a cute mascot and enough rope to hang yourself!

  2. #2
    Join Date
    Oct 2009
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Just found a handy command:

    Nice one. That's a bit easier then the way I was doing it.
    Come to #ubuntuforums! We have cookies! | Basic Ubuntu Security Guide

    Tomorrow's an illusion and yesterday's a dream, today is a solution...

  3. #3
    Join Date
    Mar 2010
    Beans
    337
    Distro
    Ubuntu

    Re: Just found a handy command:

    Lot of useful things here! http://www.webupd8.org/
    This is Linux. It gives you a cute mascot and enough rope to hang yourself!

  4. #4
    Join Date
    Mar 2006
    Location
    Williams Lake
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Just found a handy command:

    If you are running Natty, and are a synaptic user, it marks older kernels as obsolete the next time you run it after installing a new kernel and rebooting.

  5. #5
    Join Date
    Oct 2009
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Just found a handy command:

    Quote Originally Posted by cariboo907 View Post
    If you are running Natty, and are a synaptic user, it marks older kernels as obsolete the next time you run it after installing a new kernel and rebooting.
    Does that affect the way dpkg sees them?

    Just curious, as I haven't checked out Natty yet.
    Come to #ubuntuforums! We have cookies! | Basic Ubuntu Security Guide

    Tomorrow's an illusion and yesterday's a dream, today is a solution...

  6. #6
    Join Date
    Mar 2010
    Beans
    337
    Distro
    Ubuntu

    Re: Just found a handy command:

    I just might have to upgrade someday I guess Im still using and loving Karmic 9.10 but support is going to end soon. Im not sure if I like the new unity desktop I just love gnome and how easy and intuitive it is but will upgrade sooner or later maybe in April.
    This is Linux. It gives you a cute mascot and enough rope to hang yourself!

  7. #7
    wojox is offline I Ubuntu, Therefore, I Am
    Join Date
    Apr 2009
    Beans
    8,630

    Re: Just found a handy command:

    All but the current and second most run from the command line:

    Code:
    OLD=$(ls -tr /boot/vmlinuz-* | head -n -2 | cut -d- -f2- | \
        awk '"'"'{print "linux-image-" $0}'"'"' )
    if [ -n "$OLD" ]; then
        apt-get -qy remove --purge $OLD
    fi
    apt-get -qy autoremove --purge

  8. #8
    Join Date
    Oct 2007
    Location
    Kentucky, USA
    Beans
    731
    Distro
    Ubuntu

    Re: Just found a handy command:

    Awesome. I just lost 395 megs
    Which is more important in obtaining the truth, "what" or "why"? Trick question. They are of equal importance.
    Freely ye have received, freely give.

  9. #9
    Join Date
    May 2008
    Location
    Louisiana, USA
    Beans
    43

    Re: Just found a handy command:

    That is handy! In fact, I think I'll commit it to memory.

    ...

    As if.
    Game Coder Network Libre

    Keep rawkin' IT.

  10. #10
    Join Date
    Apr 2008
    Location
    California Republic
    Beans
    2,659

    Re: Just found a handy command:

    Quote Originally Posted by Timmer1240 View Post
    dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge
    is there a website that explains all the s/\(.*\)-\( stuff?

    i see it a lot and it is clearly powerful, flexible, and robust as hell, but i don't even know what it is called, so have no idea how to google it.
    Semper Fi

    My Non-Ubuntu Blog.
    All posts by me are Public Domain.

Page 1 of 7 123 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •