How to check disk space on ec2 instance? code example

Example: command to know disk ussage in ec2 instance

#To check disk space:
# Using Linux Command
df -h

#output
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda2       38G   26G  9.7G  73% /

# Using AWS CLI
aws ec2 describe-volumes --filters Name=attachment.instance-id,Values=i-1234567890abcdef0

#output
{
    "Volumes": [
        {
            "AvailabilityZone": "us-east-1a",
            "Attachments": [
                {
                    "AttachTime": "2013-12-18T22:35:00.000Z",
                    "InstanceId": "i-1234567890abcdef0",
                    "VolumeId": "vol-049df61146c4d7901",
                    "State": "attached",
                    "DeleteOnTermination": true,
                    "Device": "/dev/sda1"
                }
            ],
            "Encrypted": false,
            "VolumeType": "gp2",
            "VolumeId": "vol-049df61146c4d7901",
            "State": "in-use",
            "SnapshotId": "snap-1234567890abcdef0",
            "CreateTime": "2013-12-18T22:35:00.084Z",
            "Size": 8
        }
    ]
}