I know that I can update a snap package using

sudo snap refresh <package>

But there is a way to update all snaps, like

sudo apt dist-upgrade
share|improve this question
    
Since of snapd version 2.0.8 which is available in the ubuntu main repository now, the command sudo snap refresh updates all installed snap packages ! :) – cl-netbox Jun 14 '16 at 7:47
up vote 28 down vote accepted
snap refresh 

will do this. It is part of snapd 2.0.8, which landed 2016-06-13 in xenial-updates.

share|improve this answer
    
Isn't that for resfresh a package? Or it will update everything is a snap is not specified? – Alejandro Vera Apr 26 '16 at 2:37
    
Is it implemented now? – JulianLai May 18 '16 at 8:31
    
snap refresh --list only lists the updates without refreshes the packages – gwarah yesterday

Try this in /usr/bin/update-snaps:

#!/bin/bash
ROOT_UID="0"

#Check if run as root
if [ "$UID" -ne "$ROOT_UID" ] ; then
        echo "You must be root to do that!"
        exit 1
fi

snap list | awk -F" " '{if ($1 && NR>1) { system("snap refresh " $1 " 2>/dev/null") }}'
share|improve this answer
    
thanks. I know I can write a script, but I wanted the "native" solution, the way for "human beings" :D... I did not vote you down.. – Alejandro Vera Apr 26 '16 at 2:37
1  
Thanks for that! It's annoying that snap doesn't have this built-in yet (esp. since 16.04 is an LTS) but your one-liner with awk nicely works around that limitation. Doesn't deserve a downvote at all! – happyskeptic May 2 '16 at 9:28
    
This is not necessary any more. – dholbach Jun 14 '16 at 7:11
    
it is fixed now? I can refresh all my snaps with one command? – Alejandro Vera Jun 14 '16 at 14:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.