Don't show snap packages in lsblk command output
When your try to see blocks / devices in your Linux distribution that has snap pkgs installed on it, you’ll see too much devices (loop) but they’re not devices. They are actually snap packages. So, how not to show them in the output of the lsblk command.
The lsblk command has an -e
argument to help to exclude some devices/loops , so we can just exclude loops of snaps. All snap packages on my system has that 7
on them, so I can just exclude any device that has 7
in its description or title, so the command will be lsblk -e 7
.
But I don’t want to remember to add this argument on every command of lsblk I write. There is a fix for that.
We can create an alias for that command like this.
alias lsblk='lsblk -e 7'
so I can write lsblk
and get the results as if I wrote lsblk -e 7
.
If you are using fish not bash or zsh, just use abbr
instead of alias
like this.
abbr lsblk 'lsblk -e 7'
so, when you write lsblk
and then press space bar, the full command will be shown as lsblk -e 7
. That’s great.
If you think some people need to know this fix, share this post link with them on social media.