I am trying to display the disk freespace to users when they login. Basically the output of df -h. I added this to .bash:
echo -ne '\e[0;34m'"Disk: \e[m"$(df -h)"\n"
It works fine & auto displays this on shell login but the problem is the output is cramped up. The column format is not preserved. It appears like this:
Filesystem 1024-blocks Used Available Capacity Mounted on /dev/sda6 468789752 4907272 440046272 2% / none 4 0 4 0% /sys/fs/cgroup udev 3785472 4 3785468 1% /run/shm none 102400 0 102400 0% /run/user /dev/sda1 184307 66572 104116 40% /boot
I want it to appear in the same format as if the user is running df -h
. Any suggestions on how to modify my command to get a user friendly output? I tried using df -P | column -t
also but it is still cramped.
Using Ubuntu server.