System administrators frequently have to deal with running out of disk space. The users can’t create files, and they want it fixed, now!                 
(Of course, the files in this lab are much too small to worry about. This is just practice. Multiply all the sizes by a million if that works better for you.)                 
Do this command, as user ct320.
Note that “-qO-” contains a capital letter “O”, not a zero:
                
wget -qO- https://www.cs.colostate.edu/~ct320/pub/disk-full-lab | sh
Normally, it would be foolish to trust a script that you downloaded from the internet. These are special circumstances.                 
That command will:
/tmp/full, and populate it with many files.
/tmp/full contains 1000 files.” when done.
The correct answer is sometimes quite simple: buy another, larger, disk, and move some files to that new disk. Let’s do that:                 
mkdir /tmp/large
/tmp/large:
rsync -aH /tmp/full/ /tmp/large/
rsync rather than cp because rsync handles
hard links correctly.
ls -l /tmp/full/a/l/e/relax.txt /tmp/large/a/l/e/relax.txt
stat /tmp/full/a/l/e/relax.txt /tmp/large/a/l/e/relax.txt
/tmp/full/w/o/r/crowd.perl got copied properly.
/tmp/full/symlink, a symlink, got copied properly.
/tmp/full/hardlink, a hard link, got copied properly.
New approach. We can’t afford to buy another disk, but perhaps we could still fit if we removed some large files. But, which ones?                 
find /tmp/full -type f -size +5k
find /tmp/full -type f -size +5k -exec ls -ld {} \;
ls is executed many times.
Modify the command to execute ls only once:
find /tmp/full -type f -size +5k -exec ls -ld {} +
-h option to ls to print human-readable file sizes:
find /tmp/full -type f -size +5k -exec ls -ldh {} +
-size +5k to get the list down to a dozen files.
Perhaps we could remove some recently-created files. But, which ones are they?                 
find /tmp/full -type f -mtime -30
-exec, as above, that generates a long
listing of all files in /tmp/full that were modified within
the past week.
/tmp/full that are more than 700kB and were modified within the
past two weeks.
Sometimes, executable files are left over from compiling a program, and can be safely removed. Other times, they’re scripts, and should be kept. This part ignores that possibility.                 
find command that shows all files in /tmp/full that
are executable (have the user-execute bit set).
.save files                /tmp/full that
have a suffix of .save.
-delete option of find to create a command that
removes those .save files. Be careful!
-print instead of -delete until you get it right.
Show your work to the TA.                 
User: Guest