First, run the command "df -h"
-bash-4.2$ df -h
Filesystem Size Used Avail Capacity Mounted on
/dev/sda1 3.9G 927M 2.7G 25% /
/dev/sda2 10G 10G 0G 99% /home
-bash-4.2$
Now you know the largest files are in the /home directory. Run the command "cd /home" In the example below, there's only one user, "rob" so I will go straight to the path.
-bash-4.2$ cd home/rob
-bash-4.2$ sudo du -sh *
9.9G logs
17M dev
4.0K documents
12K tools
-bash-4.2$
For the same path /home/rob/logs we find there are many log files taking up the space.
-bash-4.2$ ls -lh
total 5
-rw-r--r-- 1 robertf users 2.5G Aug 31 23:00 log_083111
-rw-r--r-- 1 robertf users 2.5G Sep 1 23:00 log_090111
-rw-r--r-- 1 robertf users 2.5G Sep 2 23:00 log_090211
-rw-r--r-- 1 robertf users 2.5G Sep 3 23:00 log_090311
-rw-r--r-- 1 robertf users 5M Sep 4 07:46 log_090411
-bash-4.2$
First create the folder on your /tmp directory by running the command "mkdir /tmp/rob"
-bash-4.2$ mkdir /tmp/rob
-bash-4.2$ mv * /tmp/rob
log_083111 log_090111 log_090211 log_090311 log_090411
-bash-4.2$ tar -zcvf log.tar /tmp/rob
tar: Removing leading '/' from member names
a tmp/robertf
a tmp/robertf/logs
a tmp/robertf/logs/log_090411
a tmp/robertf/logs/log_090311
a tmp/robertf/logs/log_090211
a tmp/robertf/logs/log_090111
a tmp/robertf/logs/log_083111
-bash-4.2$ ls
log.tar
This is just a small example of how to find and clear space on your system. There are many many other examples.
Nixcraft - How to find large files
No comments:
Post a Comment