Checking Disk Usage Examples


Point 1: To check and list disk usage of /var/log directory is given below

# du -hx /var/log --max-depth=1
0 /var/log/ntpstats
57M /var/log/sa
288K /var/log/tuned
39M /var/log/audit
0 /var/log/chrony
112K /var/log/xcat
3.2M /var/log/anaconda
0 /var/log/rhsm
12K /var/log/Lenovo_Support

Point 2: Sort out and list disk usage in /var/log is given below

# du -hx /var/log --max-depth=1 |sort -h
0 /var/log/chrony
0 /var/log/ntpstats
0 /var/log/rhsm
12K /var/log/Lenovo_Support
112K /var/log/xcat
288K /var/log/tuned
3.2M /var/log/anaconda
39M /var/log/audit
57M /var/log/sa
108M /var/log

Point 3: Show last modification time and sort it by usage

# du -hx /var/log -d 1 --time -a --max-depth=1 |sort -h
0 2017-04-13 05:24 /var/log/ntpstats
0 2017-08-04 05:27 /var/log/chrony
0 2018-03-30 03:21 /var/log/tallylog
0 2018-03-30 03:27 /var/log/rhsm
0 2018-03-30 06:21 /var/log/opensm-activity.dump
0 2019-05-07 18:39 /var/log/opensm.log
0 2019-09-30 03:36 /var/log/spooler-20191006
0 2019-10-01 03:17 /var/log/btmp-20191101
0 2019-10-06 03:41 /var/log/spooler-20191013
0 2019-10-13 03:43 /var/log/maillog-20191021
0 2019-10-13 03:43 /var/log/spooler-20191021
0 2019-10-21 03:28 /var/log/maillog-20191027
0 2019-10-21 03:28 /var/log/spooler-20191027
0 2019-10-24 03:30 /var/log/boot.log-20191024
0 2019-10-25 03:30 /var/log/boot.log-20191025
0 2019-10-26 03:11 /var/log/boot.log-20191026
0 2019-10-27 03:07 /var/log/boot.log-20191027
0 2019-10-27 03:07 /var/log/spooler
0 2019-10-28 03:48 /var/log/boot.log-20191028
0 2019-10-29 03:28 /var/log/boot.log-20191029
0 2019-11-01 10:29 /var/log/boot.log
0 2019-11-01 10:29 /var/log/boot.log-20191101
0 2019-11-01 10:29 /var/log/btmp
4.0K 2018-03-30 03:21 /var/log/grubby_prune_debug
4.0K 2018-03-30 05:08 /var/log/grubby
4.0K 2019-02-25 03:06 /var/log/opensm.log-20190225.gz
4.0K 2019-02-25 19:31 /var/log/opensm.log-20190303.gz
4.0K 2019-04-07 23:25 /var/log/opensm.log-20190408.gz
4.0K 2019-05-07 17:10 /var/log/opensm.log-20190507.gz
4.0K 2019-10-14 17:30 /var/log/secure-20191021
4.0K 2019-10-24 20:06 /var/log/yum.log
4.0K 2019-11-01 15:41 /var/log/secure
8.0K 2018-09-10 15:01 /var/log/centrifydc-install.log
8.0K 2019-10-02 12:02 /var/log/secure-20191006
8.0K 2019-10-24 22:24 /var/log/secure-20191027
8.0K 2019-11-01 15:30 /var/log/maillog
12K 2018-03-30 13:41 /var/log/Lenovo_Support
.....
.....
.....
39M 2019-10-29 06:00 /var/log/audit
57M 2019-11-01 16:20 /var/log/sa
108M 2019-11-01 16:20 /var/log

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.