Skip to content

Instantly share code, notes, and snippets.

@maiha
Last active September 28, 2018 07:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maiha/923ab3b48bd9e8f73d27da707f48b93f to your computer and use it in GitHub Desktop.
Save maiha/923ab3b48bd9e8f73d27da707f48b93f to your computer and use it in GitHub Desktop.
  • disable all
chmod -x /etc/update-motd.d/*
  • show information of package and reboot
chmod +x /etc/update-motd.d/90-updates-available
chmod +x /etc/update-motd.d/98-reboot-required

pretty disk usage

apt install dbar
vi /etc/update-motd.d/50-df
chmod +x /etc/update-motd.d/50-df
  • /etc/update-motd.d/50-df
#!/usr/bin/env bash
# show disk usages with colorized progress bar by 'dbar'

echo "Filesystem"
for x in / /data; do \
  df -h $x | grep -oP '(\d+)%' | cut -d'%' -f1 | dbar -nonl | sed -e "s/\\([\\=]\\+\\)/\x1B\[1;32m\\1\x1B\[0m/";\
  df -h --output=size,target $x | sed 1d;\
done
$ ssh ubuntu1
Filesystem
  8% [==                       ]  29G /
 51% [=============            ] 4.9T /data
Last login: Fri Sep 28 16:08:11 2018 from 10.10.15.51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment