Groups | Search | Server Info | Login | Register
Groups > alt.os.linux.mint > #47454
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Lawrence D’Oliveiro <ldo@nz.invalid> |
| Newsgroups | alt.os.linux.mint |
| Subject | Re: Deleting old Kernels. |
| Date | Sun, 10 May 2026 04:36:27 -0000 (UTC) |
| Organization | A noiseless patient Spider |
| Lines | 35 |
| Message-ID | <10tp20a$4vrm$1@dont-email.me> (permalink) |
| References | <10tlnbe$388pq$1@dont-email.me> <10tlpft$12ob4$1@paganini.bofh.team> <10tm2vj$3b5db$1@dont-email.me> <10tmdbl$3dibl$1@dont-email.me> <10tn1mb$3ijna$2@dont-email.me> |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 8bit |
| Injection-Date | Sun, 10 May 2026 04:36:27 +0000 (UTC) |
| Injection-Info | dont-email.me; logging-data="163702"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18hfr+5axco7j+DRlv/AFU6"; posting-host="d0440d15af103125b89cd250f7ef66f0" |
| User-Agent | Pan/0.165 (Kostiantynivka) |
| Cancel-Lock | sha1:aO6FwNgRWk8MxVBehZ0t5jN/YAM= sha256:O3RJ8XhnFZDlZ761r7J8usbAnLU7IYcdcdGIMlT0RK4= sha1:Tj8JhvDTsMXzOgWZ1FMrEkzlG4k= |
| Xref | csiph.com alt.os.linux.mint:47454 |
Show key headers only | View raw
On Sat, 9 May 2026 12:18:51 +0200, jjb wrote:
> #1. Find all installed kernels
> @lines = `dpkg --list | grep -i 'linux-image'`;
> foreach (@lines) {
> if (/^ii\s+linux-image-(\d[\S]+)/) {
> push (@kernels, $1);
> }
> }
OK, I didn’t notice you were specifically checking for packages with
status = installed. Here’s an update to my code that includes such a
check:
import subprocess
kernel_list = list \
(
n
for s, n in
(l.split("\t", 1)
for l in
subprocess.check_output
(
args = ("dpkg-query", "-f" "${Status;-1}\t${Package}\n", "-W", "*linux-image*"),
text = True
).split("\n")
if l != ""
)
if s == "i"
)
print(kernel_list)
The output list is much shorter. ;)
Back to alt.os.linux.mint | Previous | Next — Previous in thread | Next in thread | Find similar
Deleting old Kernels. "Alan K." <alan@invalid.com> - 2026-05-08 18:16 -0400
Re: Deleting old Kernels. George <Invalid@invalid.invalid> - 2026-05-08 23:45 +0100
Re: Deleting old Kernels. "Alan K." <alan@invalid.com> - 2026-05-08 21:34 -0400
Re: Deleting old Kernels. Paul <nospam@needed.invalid> - 2026-05-09 00:31 -0400
Re: Deleting old Kernels. jjb <jjb@invalid.invalid> - 2026-05-09 12:18 +0200
Re: Deleting old Kernels. Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-05-10 03:36 +0000
Re: Deleting old Kernels. Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-05-10 04:36 +0000
Re: Deleting old Kernels. jjb <jjb@invalid.invalid> - 2026-05-10 12:11 +0200
Re: Deleting old Kernels. RonB <ronb02NOSPAM@gmail.com> - 2026-05-09 11:06 +0000
Re: Deleting old Kernels. "Alan K." <alan@invalid.com> - 2026-05-09 09:03 -0400
Re: Deleting old Kernels. german newsgroups <usualsuspectrider@gmail.com> - 2026-05-09 08:18 +0200
csiph-web