LPIC-1 103.3: Basic file management
Brace expansion and copying trees, finding files by age and size, tar
archives, the three compressors, and dd.
Before you start
The lab adds a 64 MiB spare disk, /dev/loop40, with a partition table
and a little text near the start, and installs bzip2 if it's missing.
Work as root (sudo -i), and write answers to the files in
/root/lab-answers/. Files in /tmp don't survive a reboot on every
system, so check task 3 before you reboot.
Tasks
- Make
/root/practice/a,/root/practice/band/root/practice/cwith one command, create a file in each withtouch, then copy the whole tree withcp -aand remove the copy withrm -r. - Find every file under
/etcchanged in the last day, and write the list to/root/lab-answers/2-etc. Find every file over 10 MiB under/usr, and write that list to/root/lab-answers/2-usr. - Archive
/etcinto/root/etc.tar.xz, list it, and extract onlyetc/hostnameinto/tmp. - Compress copies of one log file with
gzip,bzip2andxzin/root/compress/, and compare the sizes withls -l. - Copy the first megabyte of the spare disk
/dev/loop40to/root/first-mb.imgwithdd, and look at it withod -c | head.
Hints
mkdir -p /root/practice/{a,b,c};touch;cp -a;rm -r.find /etc -type f -mtime -1;find /usr -type f -size +10M.tar -cJf,tar -tJf,tar -xJf ARCHIVE -C /tmp etc/hostname.gzip -k(or-c),bzip2 -k,xz -k;ls -l.dd if=/dev/loop40 of=/root/first-mb.img bs=1M count=1;od -c | head, orod -c | grep -v '\\0 \\0'to skip the zeros.