The officially official Devuan Forum!

You are not logged in.

#1 2019-12-17 01:05:02

bgstack15
Member
Registered: 2018-02-04
Posts: 159  

[SOLVED] Apt-get show one package per line?

In Fedora, dnf lists packages one per line, like this:

Installing:
 kernel                  x86_64 5.3.15-200.fc30     updates   21 k
 kernel-core             x86_64 5.3.15-200.fc30     updates   30 M
 kernel-modules          x86_64 5.3.15-200.fc30     updates   28 M
 kernel-modules-extra    x86_64 5.3.15-200.fc30     updates  1.9 M
Upgrading:
 ImageMagick             x86_64 1:6.9.10.75-1.fc30  updates  163 k
 ImageMagick-libs        x86_64 1:6.9.10.75-1.fc30  updates  2.3 M
 Thunar                  x86_64 1.8.11-1.fc30       updates  1.6 M

How can I get apt-get (or apt if I have to) to list packages one per line? I am disappointed by the "wall of text" that tends to make it difficult to read what will be upgraded.

The following packages have been kept back:
  cpp-8 cpp-9 elogind gcc-8-base gcc-8-base:i386 gcc-9-base gcc-9-base:i386 libatomic1 libatomic1:i386 libblkid1:i386 libc6 libc6:i386 libelogind0 libgcc1
  libgcc1:i386 libgfortran5 libgomp1 libgomp1:i386 liblouisutdml-bin liblouisutdml9 libmariadb3:i386 libmount1:i386 libpam-elogind libquadmath0 libreoffice
  libreoffice-base libreoffice-base-core libreoffice-base-drivers libreoffice-calc libreoffice-common libreoffice-core libreoffice-draw libreoffice-gtk2
  libreoffice-help-common libreoffice-help-en-us libreoffice-impress libreoffice-java-common libreoffice-math libreoffice-report-builder
  libreoffice-report-builder-bin libreoffice-script-provider-bsh libreoffice-script-provider-js libreoffice-script-provider-python libreoffice-sdbc-firebird
  libreoffice-sdbc-hsqldb libreoffice-sdbc-mysql libreoffice-sdbc-postgresql libreoffice-style-colibre libreoffice-style-tango libreoffice-writer libstdc++6
  libstdc++6:i386 libuuid1:i386 linux-image-amd64 oddjob-mkhomedir openssh-client openssh-server openssh-sftp-server procps python3-gst-1.0 python3-louis
  python3-uno task-desktop task-english task-laptop task-ssh-server tasksel tasksel-data usb-modeswitch util-linux-locales xfce4
The following packages will be upgraded:
  avahi-autoipd avahi-daemon binutils binutils-common binutils-x86-64-linux-gnu cups-browsed cups-filters cups-filters-core-drivers curl debianutils
  espeak-ng-data firebird3.0-common firebird3.0-common-doc firebird3.0-server-core firebird3.0-utils firefox-esr fonts-opensymbol
  gir1.2-gst-plugins-base-1.0 gir1.2-gstreamer-1.0 gir1.2-rsvg-2.0 git git-man gnome-desktop3-data gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-libav
  gstreamer1.0-plugins-bad gstreamer1.0-plugins-base gstreamer1.0-plugins-base:i386 gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly
  gstreamer1.0-pulseaudio gstreamer1.0-x iptables irqbalance iw keepassxc libatk-adaptor libatk-bridge2.0-0 libatk-bridge2.0-0:i386 libatlas3-base
  libavahi-client3 libavahi-client3:i386 libavahi-common-data libavahi-common-data:i386 libavahi-common3 libavahi-common3:i386 libavahi-core7 libavahi-glib1
  libavahi-gobject0 libbinutils libboost-atomic1.67.0 libboost-chrono1.67.0 libboost-date-time1.67.0 libboost-filesystem1.67.0 libboost-iostreams1.67.0
  libboost-locale1.67.0 libboost-system1.67.0 libboost-thread1.67.0 libbrlapi0.7 libburn4 libc-bin libc-l10n libcupsfilters1 libcurl3-gnutls libcurl3-nss
  libcurl4 libdbus-glib-1-2 libde265-0 libegl-mesa0 libegl1-mesa libespeak-ng1 libfbclient2 libfontembed1 libgbm1 libgif7 libgif7:i386 libgl1-mesa-dri
  libgl1-mesa-dri:i386 libgl1-mesa-glx libglapi-mesa libglapi-mesa:i386 libgles2-mesa libglib-object-introspection-perl libglib2.0-0 libglib2.0-0:i386
  libglib2.0-bin libglib2.0-data libglx-mesa0 libglx-mesa0:i386 libgnome-desktop-3-18 libgnutls-dane0 libgnutls30 libgnutls30:i386 libgstreamer-gl1.0-0
  libgstreamer-plugins-bad1.0-0 libgstreamer-plugins-base1.0-0 libgstreamer-plugins-base1.0-0:i386 libgstreamer1.0-0 libgstreamer1.0-0:i386
  libhttp-cookies-perl libib-util libip4tc2 libip6tc2 libiptc0 libisofs6 libjs-sphinxdoc libjte2 liblightdm-gobject-1-0 liblouis-data liblouisutdml-data
  libmatroska6v5 libmysofa0 libnftables1 libnftnl11 libnss3 libnss3-tools liborcus-0.15-0 libosmesa6 libosmesa6:i386 libpcaudio0 libpci3 libpci3:i386

I've tried reading the apt-doc contents, and various apt and dpkg man pages. I'm not specifically interested in the cool --status-fd=2 option; I want to be able to see the list of packages that will be installed/upgraded/removed one on each line, before I say Yes.

Of course I can run it once with a yes no | apt-get upgrade and pipe to awk. But is there a built-in parameter or a plugin I can use to get more readable output?

Last edited by bgstack15 (2019-12-18 02:25:29)


This space intentionally left blank.

Offline

#2 2019-12-17 01:19:41

golinux
Administrator
Registered: 2016-11-25
Posts: 1,985  

Re: [SOLVED] Apt-get show one package per line?

Sorry, I don't have an answer for you but I feel your pain.  I have always been overwhelmed by the blob of text too.  That's one reason I use synaptic which produces a nice neat list that can be manipulated in several ways.

Online

#3 2019-12-17 02:29:19

Altoid
Member
Registered: 2017-05-07
Posts: 416  

Re: [SOLVED] Apt-get show one package per line?

Hello:

golinux wrote:

... always been overwhelmed by the blob of text too.

+1

Yes, it is a pity.
Keeps me from being more confident in using apt-get.

Maybe maintainers could find a way to make the output (more) readable by default, like dnf?

A.

Offline

#4 2019-12-17 04:41:22

ralph.ronnquist
Administrator
From: Clifton Hill, Victoria, AUS
Registered: 2016-11-30
Posts: 441  

Re: [SOLVED] Apt-get show one package per line?

Yes, it would be nice to have a built-in option. As is, one has to resort to manual output filtering, e.g. by adding

 | sed "/^  /{s/\\b /\n  /g}"

to the command. That merely "pretty-prints" and doesn't provide the version details.

Offline

#5 2019-12-17 06:09:02

yeti
Member
From: Away
Registered: 2017-02-23
Posts: 185  

Re: [SOLVED] Apt-get show one package per line?

Output formatting would need to shorten filenames to useless fragments or would need ridiculously long lines terminals which will hurt reading a lot if line lengths raise noticeably above 100 characters:

$ apt-cache pkgnames | awk '{ print length,$0 }' | sort -n | tail
53 ruby-rails-assets-markdown-it--markdown-it-for-inline
54 libmono-system-windows-forms-datavisualization4.0a-cil
55 libmoosex-traitfor-meta-class-betteranonclassnames-perl
55 libperl-critic-policy-variables-prohibitlooponhash-perl
56 libcatalyst-authentication-credential-authen-simple-perl
56 libcatalyst-plugin-authentication-credential-openid-perl
58 node-babel-plugin-transform-es3-member-expression-literals
59 libmono-system-runtime-serialization-formatters-soap4.0-cil
60 librust-wasm-bindgen+xxx-debug-only-print-generated-code-dev
60 node-babel-helper-builder-binary-assignment-operator-visitor

If the filenames may be on one line like in apt-cache policynode-babel-helper-builder-binary-assignment-operator-visitor , it may be somewhat readable:

$ apt-cache policy node-babel-helper-builder-binary-assignment-operator-visitor
node-babel-helper-builder-binary-assignment-operator-visitor:
  Installed: (none)
  Candidate: 6.26.0+dfsg-3
  Version table:
     6.26.0+dfsg-3 500
        500 http://deb.devuan.org/merged beowulf/main armhf Packages

Simple post processing of apt-get upgrade's output from ^The following packages will be upgraded:$ to the end of the indented block following it would be no big deal. Maybe just throwing it as one line at apt-get policy $THAT_LINE would give a lot of version information, but sometimes more than one "candidate" for a package will show up and how do we know which one apt-get will choose?

Post processing a dry run of the upgrade process may be a way?

I currently have no deb-ish system with updates waiting to be installed, so no easy way to look at a dry run's output. :-(


"I toggle, therefor I am." — Clock Bit.
"There is no PLANET-B!" — ???
"Vrijdag voor VT100!" — Yeti.
"Stop slavery! Free all mitochondria!" — Yeti.

Offline

#6 2019-12-17 07:35:10

MiyoLinux
Member
Registered: 2016-12-05
Posts: 1,032  

Re: [SOLVED] Apt-get show one package per line?

For this to work, you need to install the package apt-show-versions

apt install apt-show-versions

The following command will show each package that can be upgraded on a single line...along with version numbers.

apt-show-versions -u

However, it still may be confusing. big_smile  tongue

So, you might try this. It will list each package that can be upgraded on a single line, but no version numbers...

apt-show-versions -u | cut -d: -f1

...or do as golinux said, and upgrade through synaptic...which shows the available upgrades for each package on a single line. smile


I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.

Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned. wink

Offline

#7 2019-12-17 12:25:04

Ogis1975
Member
Registered: 2017-04-21
Posts: 140  
Website

Re: [SOLVED] Apt-get show one package per line?

How about aptitude? Maybe with this tool is possible to show one package per line?

Last edited by Ogis1975 (2019-12-17 12:25:27)

Offline

#8 2019-12-17 16:25:11

Geoff 42
Member
Registered: 2016-12-15
Posts: 352  

Re: [SOLVED] Apt-get show one package per line?

How about :-

# apt update
Get:1 http://deb.devuan.org/merged ascii InRelease [25.6 kB]
...
Reading state information... Done
7 packages can be upgraded. Run 'apt list --upgradable' to see them.
# apt list --upgradable
Listing... Done
git/stable-security,stable-proposed-updates 1:2.11.0-3+deb9u5 amd64 [upgradable from: 1:2.11.0-3+deb9u4]
intel-microcode/stable-security,stable-proposed-updates 3.20191115.2~deb9u1 amd64 [upgradable from: 3.20191112.1~deb9u1]
sa-compile/stable-security,stable-security,stable-proposed-updates,stable-proposed-updates 3.4.2-1~deb9u2 all [upgradable from: 3.4.2-1~deb9u1]
spamassassin/stable-security,stable-security,stable-proposed-updates,stable-proposed-updates 3.4.2-1~deb9u2 all [upgradable from: 3.4.2-1~deb9u1]
spamc/stable-security,stable-proposed-updates 3.4.2-1~deb9u2 amd64 [upgradable from: 3.4.2-1~deb9u1]
thunderbird/stable-security 1:68.3.0-2~deb9u1 amd64 [upgradable from: 1:68.2.2-1~deb9u1]
thunderbird-l10n-en-gb/stable-security,stable-security 1:68.3.0-2~deb9u1 all [upgradable from: 1:68.2.2-1~deb9u1]

Is that the sort of thing you are after?

Geoff

Offline

#9 2019-12-17 17:09:32

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 853  
Website

Re: [SOLVED] Apt-get show one package per line?

empty@E485:~ $ sudo apt upgrade -V
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
   libruby2.5 (2.5.5-3 => 2.5.5-3+deb10u1)
   ruby2.5 (2.5.5-3 => 2.5.5-3+deb10u1)
   ruby2.5-dev (2.5.5-3 => 2.5.5-3+deb10u1)
   ruby2.5-doc (2.5.5-3 => 2.5.5-3+deb10u1)
4 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 6,402 kB of archives.
After this operation, 1,024 B disk space will be freed.
Do you want to continue? [Y/n]

Black Lives Matter

Offline

#10 2019-12-18 02:26:21

bgstack15
Member
Registered: 2018-02-04
Posts: 159  

Re: [SOLVED] Apt-get show one package per line?

@Head_on_a_Stick solved it. That's good enough. Wow. Apparently I didn't read the right man pages or right sections of the man pages. This -V is such a game-changer.

edit: Showing the version numbers is even a nice bonus!

Last edited by bgstack15 (2019-12-18 02:29:25)


This space intentionally left blank.

Offline

#11 2019-12-18 10:05:18

MiyoLinux
Member
Registered: 2016-12-05
Posts: 1,032  

Re: [SOLVED] Apt-get show one package per line?

Head_on_a_Stick wrote:
empty@E485:~ $ sudo apt upgrade -V
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
   libruby2.5 (2.5.5-3 => 2.5.5-3+deb10u1)
   ruby2.5 (2.5.5-3 => 2.5.5-3+deb10u1)
   ruby2.5-dev (2.5.5-3 => 2.5.5-3+deb10u1)
   ruby2.5-doc (2.5.5-3 => 2.5.5-3+deb10u1)
4 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 6,402 kB of archives.
After this operation, 1,024 B disk space will be freed.
Do you want to continue? [Y/n]

Show off! tongue

#1


I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.

Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned. wink

Offline

#12 2019-12-18 12:58:23

Ogis1975
Member
Registered: 2017-04-21
Posts: 140  
Website

Re: [SOLVED] Apt-get show one package per line?

bgstack15 wrote:

@Head_on_a_Stick solved it. That's good enough. Wow. Apparently I didn't read the right man pages or right sections of the man pages. This -V is such a game-changer.

edit: Showing the version numbers is even a nice bonus!

Flag

 -V, --verbose-versions 

show full versions for upgraded and installed packages.

Offline

#13 2019-12-18 21:38:28

bgstack15
Member
Registered: 2018-02-04
Posts: 159  

Re: [SOLVED] Apt-get show one package per line?

Yes, it's actually incredibly useful that it shows the version numbers. My requirement however was merely one package per line.

My messing around with awk had produced really weird results, where the y/n prompt would occur, but the last ~50 lines of text including the prompt text would only appear after my response.

So now I am going to go read the man page to see if I can get it to show me, on those individual lines, what repo each package is coming from. I realize that's auxiliary to the main purpose of this thread, but it is a continuation of the thought that I totally haven't read the man page for apt-get.


This space intentionally left blank.

Offline

#14 2019-12-19 16:37:26

Geoff 42
Member
Registered: 2016-12-15
Posts: 352  

Re: [SOLVED] Apt-get show one package per line?

Isn't that what apt list --upgradable does? It lists the repository with the versions.
The info fits on single lines if your terminal is wide enough ;-)

Geoff

Offline

#15 2019-12-20 02:48:50

bgstack15
Member
Registered: 2018-02-04
Posts: 159  

Re: [SOLVED] Apt-get show one package per line?

Apt list --upgradable shows me a different list than what apt-get upgrade -V does. For example, it shows that oddjob-mkhomedir is upgradable, but apt-get upgrade omits oddjob-mkhomedir because of a systemd dependency (I made a dummy package for oddjob-mkhomedir-0.0.1 a while back for my own purposes). But yes, that output looks a little bit better. I realize apt repositories don't have names, so I guess I want to see the server the package comes from.

Last edited by bgstack15 (2019-12-20 02:58:05)


This space intentionally left blank.

Offline

#16 2019-12-20 04:16:59

ToxicExMachina
Member
Registered: 2019-03-11
Posts: 207  

Re: [SOLVED] Apt-get show one package per line?

I think aptitude UI will be suitable solution for different cases.

Last edited by ToxicExMachina (2019-12-20 04:17:10)

Offline

#17 2019-12-20 09:21:06

Geoff 42
Member
Registered: 2016-12-15
Posts: 352  

Re: [SOLVED] Apt-get show one package per line?

bgstack15 wrote:

Apt list --upgradable shows me a different list than what apt-get upgrade -V does.

Is this partly due to the difference between apt-get upgrade and apt-get dist-upgrade? (or apt upgrade and apt full-upgrade)

I suppose, in this context that using -V may be more accurate, in that it shows what it is actually about to do, rather than what it could potentially do, depending on which version of the command you later give.

Geoff

Offline

#18 2019-12-20 12:24:45

bgstack15
Member
Registered: 2018-02-04
Posts: 159  

Re: [SOLVED] Apt-get show one package per line?

Geoff 42 wrote:
bgstack15 wrote:

Apt list --upgradable shows me a different list than what apt-get upgrade -V does.

Is this partly due to the difference between apt-get upgrade and apt-get dist-upgrade? (or apt upgrade and apt full-upgrade)

No, I don't think the differences between those different upgrade commands matters. I think "apt list --upgradable" does not do the full dependency resolution to determine that no, oddjob-mkhomedir is not actually upgradable; it will be held back.


This space intentionally left blank.

Offline

Board footer