zkab
March 12th, 2015, 11:29 AM
I used a script from a Linux article to remove old Linux kernels from my systems.
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
But I get an error - E: Can not write log (Is stdout a terminal?) - tcgetattr (25: Inappropriate ioctl for device)
Also the directory with the old modules is not removed - /lib/modules/3.19.0-7-generic not empty
How can that be fixed - I am not so familiar with 'sed'
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
But I get an error - E: Can not write log (Is stdout a terminal?) - tcgetattr (25: Inappropriate ioctl for device)
Also the directory with the old modules is not removed - /lib/modules/3.19.0-7-generic not empty
How can that be fixed - I am not so familiar with 'sed'