Skip to content

Instantly share code, notes, and snippets.

@alirezapla
Created August 5, 2023 20:40
Show Gist options
  • Save alirezapla/2ff2d9e1e3aa802e8486d218920b2f89 to your computer and use it in GitHub Desktop.
Save alirezapla/2ff2d9e1e3aa802e8486d218920b2f89 to your computer and use it in GitHub Desktop.
disk usage
#!/bin/bash
free=$(df -h / | tail -n 1 | awk '{print $4}')
total=$(df -h / | tail -n 1 | awk '{print $2}')
use=$(df -h / | tail -n 1 | awk '{print $5}')
echo Free/Total memory: $free / $total
echo Percentage: $use | sed 's/%//'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment