It's important to do spring cleaning every once in a while and ensure automated processes.
If your tmp dir is not getting cleared:
- yum install tmpwatch – removes files older than 10 days.
- /var/log has a ton of logs, they should all be setup on logrotate (if they are not use some of the commands below to find out what is getting out of hand
- Pay attention to config files that create logs in strange places outside of the common var/log path (likely because you set it up that way). eg, check your log paths for apache, nignx etc. Then custom configure a log rotation for it.
Generic command to find the top 50 files on your entire server
- find / -type f -printf ‘%k kb %pn’| sort -nr | head -50
Use the find command to list *.sql specific files within the root folder and show the top 50.
- find /root/ -type f -name *.sql -printf ‘%k kb %pn’| sort -nr | head -50
Same thing but using the DU function which doesn’t have as nice of a printout.
- du -h /home | sort -n -r | head -n 50
Or you could just go around using this command. Start from root, change depth as necessary, and then CD into each directory you find suspiciously large.
- du -h –max-depth=1
This will output the usage of each partition in the server. To list the size of a specific directory, run the following command:
- # du -sh /home/
If you want to list all the subdirectory sizes under /home, run the following command:
- # du -sh /home/*
Top X files in a dirtory that are larger than 10 MB, sorted by size
- find . -maxdepth 1 -type f -size +10M -print0 | xargs -0 ls -Shal | head
Note, the find commands could take a while…
- Download GitBook Editor For Linux Ubuntu
- Download WPS Office 2016 For Linux Ubuntu
- Finally! WPS Office Has A New Release for Linux
- ‘Komorebi’ Display Clock & Animations on Ubuntu Desktop
- Script: Install Joomla 3.7 on a CentOS/Fedora VPS
- Tails OS 3.0 Released! Now Uses Debian 9
- Install GNU Cash Accounting Software On Linux Ubuntu
- Debian 9 Stretch Coming on June 17, Check Out The New Features
- How To Know The Version Of Application Before Installing In Ubuntu
- Install Chatty Twitch Chat Client in Ubuntu 16.04, 17.04