For anyone interested this is a simple alias to make it a little more legible.
Code: Select all
alias lupg='apt list --upgradable|sed "s/\// /"|column -t'
Code: Select all
alias lupg='apt list --upgradable|sed "s/\// /"|column -t'
Is this a new feature added to the python script apt at /usr/local/bin which is executed when I type "apt" from the command line, or is this a feature in the "real" apt in /usr/bin ? Typing "apt list --upgradable" from the command line just brings up a list of commands for the python script because "list" is not one of the options.WharfRat wrote:Apt now has a feature to list the available upgrades apt list --upgradable, but it's bunched up which makes it difficult to read.
For anyone interested this is a simple alias to make it a little more legible.
Code: Select all
alias lupg='apt list --upgradable|sed "s/\// /"|column -t'
It works on my 18.1 but not on my 17.3 so it must be a new featureslipstick wrote: EDIT: or is this a new feature in LM18 or 18.1 (I'm still using 17.3)
Code: Select all
samba-common xenial-updates,xenial-updates,xenial-security,xenial-security 2:4.3.11+dfsg-0ubuntu0.16.04.3 all [upgradable from: 2:4.3.11+dfsg-0ubuntu0.16.04.1]
samba-common-bin xenial-updates,xenial-security 2:4.3.11+dfsg-0ubuntu0.16.04.3 amd64 [upgradable from: 2:4.3.11+dfsg-0ubuntu0.16.04.1]
samba-libs xenial-updates,xenial-security 2:4.3.11+dfsg-0ubuntu0.16.04.3 amd64 [upgradable from: 2:4.3.11+dfsg-0ubuntu0.16.04.1]
smbclient xenial-updates,xenial-security 2:4.3.11+dfsg-0ubuntu0.16.04.3 amd64 [upgradable from: 2:4.3.11+dfsg-0ubuntu0.16.04.1]
systemd xenial-updates 229-4ubuntu16 amd64 [upgradable from: 229-4ubuntu12]
systemd-sysv xenial-updates 229-4ubuntu16 amd64 [upgradable from: 229-4ubuntu12]
udev xenial-updates 229-4ubuntu16 amd64 [upgradable from: 229-4ubuntu12]
util-linux xenial-updates 2.27.1-6ubuntu3.2 amd64 [upgradable from: 2.27.1-6ubuntu3.1]
uuid-runtime xenial-updates 2.27.1-6ubuntu3.2 amd64 [upgradable from: 2.27.1-6ubuntu3.1]
xdg-utils xenial-updates,xenial-updates 1.1.1-1ubuntu1.16.04.1 all [upgradable from: 1.1.1-1ubuntu1]
apt list --upgradable| sed -r 's/^([^/]*)\/[^ ]* ([^ ]*) [^ ]* [^:]*: (.*)]$/\1\/\2\/\3/' | column -s / -t
Code: Select all
samba-common 2:4.3.11+dfsg-0ubuntu0.16.04.3 2:4.3.11+dfsg-0ubuntu0.16.04.1
samba-common-bin 2:4.3.11+dfsg-0ubuntu0.16.04.3 2:4.3.11+dfsg-0ubuntu0.16.04.1
samba-libs 2:4.3.11+dfsg-0ubuntu0.16.04.3 2:4.3.11+dfsg-0ubuntu0.16.04.1
smbclient 2:4.3.11+dfsg-0ubuntu0.16.04.3 2:4.3.11+dfsg-0ubuntu0.16.04.1
systemd 229-4ubuntu16 229-4ubuntu12
systemd-sysv 229-4ubuntu16 229-4ubuntu12
udev 229-4ubuntu16 229-4ubuntu12
util-linux 2.27.1-6ubuntu3.2 2.27.1-6ubuntu3.1
uuid-runtime 2.27.1-6ubuntu3.2 2.27.1-6ubuntu3.1
xdg-utils 1.1.1-1ubuntu1.16.04.1 1.1.1-1ubuntu1
apt list --upgradable| sed -r 's/^([^ ]*) ([^ ]*) [^ ]* [^:]*: (.*)]$/\1\/\2\/\3/' | column -s / -t
apt list --upgradable| sed -r 's/^([^ ]*) ([^ ]*) .*$/\1\/\2/' | column -s / -t
sed -r 's/^
- this tells sed to use extended regular expressions so we can more easily use groups, and starts the substitute command from the start of each line.([^/]*)\/
- the next part matches any character that is not a forward slash and puts that in the first group and matches the forward slash next (this needs to be escaped by a backslash, hence the two slashes) and discards that. The round brackets are for grouping matches and we can refer back to groups later. The square brackets are for matching a character from a set of allowed characters. By putting the ^ character first in the square brackets we invert the set meaning match any character except the one given after the ^ character. This part grabs the package name.[^ ]*_
- the next part (I've replaced the whitespace at the end by an underscore else it wouldn't display) works the same way except instead of matching any character that is not a forward slash and then discarding the forward slash after it, match any character that is not a whitespace and then discarding the whitespace after it. This part matches the package origin but in the first command I gave it doesn't group it so it is discarded.([^ ]*)_
- the next part works the same and grabs the new version.[^ ]*_
- the next part works the same and discards the package architecture.[^:]*: (.*)]
- the next part discards everything until the : character in the "[upgradable from: old-version]" bit of the output. It then discards the :_ , grabs the old version and discards the ] at the end.$/\1\/\2\/\3/'
- the final bit says we have to match till the end of the line and then replace the entire line by the first group, followed by a forward slash (needs to be escaped again, and so on for the second and third groups. Those were the package name, new version and old version. Using forward slash lets us tell the column command to use that as separator so any whitespace will be left untouched by it.I'm on 17.3. IsWharfRat wrote:Apt now has a feature to list the available upgrades apt list --upgradable, but it's bunched up which makes it difficult to read.
For anyone interested this is a simple alias to make it a little more legible.
Code: Select all
alias lupg='apt list --upgradable|sed "s/\// /"|column -t'
--upgradable
similar to:
Code: Select all
sudo apt-get -u -V --assume-no upgrade
sudo apt-get -u -V --assume-no upgrade | awk '/^ / {printf ("%-40s %-30s %s\n", $1, $2, $4)}'
# I think I like this better
sudo apt-get -u -V --assume-no upgrade | awk '/^ / {print $1, $2, $4}' | column -t
/usr/bin/apt list --upgradable
on Linux Mint 17.x. The normal apt command doesn't use /usr/bin/apt yet on Linux Mint 17.x, as it does on Linux Mint 18.x. Hence you would have to explicitly say you want to use /usr/bin/apt.Brilliant. It didn't dawn on me that there would be 2 apt's on the system.xenopeek wrote:You can use/usr/bin/apt list --upgradable
on Linux Mint 17.x. The normal apt command doesn't use /usr/bin/apt yet on Linux Mint 17.x, as it does on Linux Mint 18.x. Hence you would have to explicitly say you want to use /usr/bin/apt.