Using Linux Terminal 1.1: Files and directories
Making a directory tree in one command, copying with hidden files and dates kept, hard and symbolic links, and removing directories.
Before you start
The lab creates user student (password Lab-Pass-1). Work as student
(sudo -iu student), so ~ is /home/student. The lab only checks that
~/lab doesn't exist yet; le-lab reset removes it.
Tasks
- Create
~/lab/app/config,~/lab/app/logsand~/lab/app/datain one command, and copy/etc/skelto~/lab/skel, keeping its hidden files and timestamps. - In
~/lab, createnotes.txtcontaining the wordhello, a hard linknotes.hardand a symbolic linknotes.linkto it. Then renamenotes.txttonotes.old, and see whatcatmakes of each link. - Remove
~/lab/app/logswithrmdir. Put a file in~/lab/app/data, tryrmdiron it, then remove that directory too. Onlyconfigis left in~/lab/app.
Hints
mkdir -pwith a brace list:{config,logs,data}.cp -a; comparels -la ~/lab/skelwithls -la /etc/skel.ln,ln -s,mv;ls -lishows inode numbers andstat -c %hthe link count.rmdironly removes empty directories: "Directory not empty".rm -r.