Linux+ 2.1.1: Files and directories
Building a directory tree, copying it with and without its attributes, comparing files, and identifying file types.
Before you start
Work as root, so ~ is /root. The lab only checks that /root/lab
doesn't exist yet. Leave your work in place for grading: le-lab reset
removes /root/lab. Write answers to the files in /root/lab-answers/.
Tasks
- Create
~/lab/appwith the subdirectoriesconf,logsanddata, and a file~/lab/app/conf/app.confthat containsListen 80, with mode 640. Copy the tree once withcp -rto~/lab/copy-rand once withcp -ato~/lab/copy-a, and compare the modify times of the threeapp.conffiles. - Change
80to8080in~/lab/copy-a/conf/app.confonly. Save the unified diff of the original against that copy in/root/lab-answers/2. - Find the most common file type among the files in
/usr/bin, and write it (asfiledescribes it, for example the text before the first comma) to/root/lab-answers/3.
Hints
mkdir -pwith a brace list,chmod,stat -c '%a %y %n'.sed -i,diff -u,sdiff,diff -rq.file /usr/bin/* | awk -F: '{print $2}' | cut -d, -f1 | sort | uniq -c | sort -rn | head.