Goal
Use everything from Part 1 in one session: make a practice tree with brace expansion, copy and link files with wildcards, save output and errors with redirection, count with a pipeline, set permissions for a shared folder, and control a background job with signals. Work as a normal user; only the shared folder needs sudo.
Before you start
- Open a terminal as a normal user. Work in your home directory.
- If you have no
sudorights, skip task 6 or do it in your home directory with your own group.
Tasks
Tick a task when it is done. Only your browser remembers it.
- Make the directory
~/lab1with the subdirectories2026-01to2026-12in one command. - Copy all files from
/etcwhose names end in.confinto~/lab1/2026-01. Errors (for example "Permission denied") must go to the file~/lab1/errors.txt, not to the screen. - Count how many
.conffiles you copied. Save only the number in~/lab1/count.txt. - In
~/lab1, make a hard linkhosts-hardand a symbolic linkhosts-symto a copy of/etc/hostscalledhosts. Deletehostsand show which link still works. - Show the 5 biggest files in
/usr/bin(biggest first) and save the list in~/lab1/big.txtand show it on the screen at the same time. - Make the directory
/srv/teamfor the groupteam(make the group). Members of the group may make and change files; new files must belong to the group; others have no access. - Start
sleep 600in the background. List your jobs, bring it to the foreground, pause it, send it back to the background, and end it with the signalTERM.
Check your work
Hints
Show the hints
- Brace expansion:
{01..12}. 2>redirects only the error stream.cpwith many files into a directory:cp files... dir.ls dir | wc -lcounts names.ls -lSsorts by size;head -5takes the first 5;teewrites to a file and the screen.- Mode
2770= setgid + rwx for owner and group. Ctrl-zpauses;bg,fg,kill %1.
Solution
Show the solution
- Make the tree with brace expansion.
mkdir -p ~/lab1/2026-{01..12} - Copy with a wildcard and send errors to a file.
cp /etc/*.conf ~/lab1/2026-01/ 2> ~/lab1/errors.txt - Count with a pipeline.
- Make the links, delete the original, test both.
- Sort by size and save with tee.
- Make the group and the shared folder.
- Control the job.
My notes
No notes yet.