هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.
الهدف
Make a folder structure, copy and move files, create both kinds of links, find files by owner and size, and make a compressed backup that you can restore.
قبل أن تبدأ
- Work on server1. Some tasks need root (
sudo -i).
المهام
ضع علامة على المهمة عندما تنتهي منها. متصفحك فقط يتذكر ذلك.
- Create the folders
/data/projects/web,/data/projects/dband/data/archivewith one command. - Copy all files from
/etcthat start withhostto/data/projects/web. Keep their permissions and times. - Rename
/data/projects/web/hoststo/data/projects/web/hosts.old. - Make a symbolic link
/data/currentthat points to/data/projects/web. Make a hard link/data/projects/db/hosts.hardto/data/projects/web/hosts.old. - Find all files in
/usr/sharebigger than 5 MiB and write their names to/data/archive/big-files.txt. - Create the archive
/data/archive/etc.tar.bz2of the folder/etccompressed with bzip2. - Extract only the file
etc/hostsfrom that archive into/tmp/restore.
تحقّق من عملك
ls -lR /data
ls -l /data/current
ls -li /data/projects/web/hosts.old /data/projects/db/hosts.hard
wc -l /data/archive/big-files.txt
tar -tjf /data/archive/etc.tar.bz2 | head
cat /tmp/restore/etc/hosts/data/currentshows-> /data/projects/web.- The two hard-linked files have the same inode number and a link count of 2.
- The archive lists files that start with
etc/.
تلميحات
اعرض التلميحات
mkdir -pwith braces makes many folders:mkdir -p /data/projects/{web,db}.cp -akeeps permissions and times.find -size +5M -type f.tar -cjffor bzip2; give the member name to extract one file.
الحل
اعرض الحل
- Make the folders.
mkdir -p /data/projects/{web,db} /data/archive - Copy with the attributes.
cp -a /etc/host* /data/projects/web/ - Rename.
mv /data/projects/web/hosts /data/projects/web/hosts.old - Make the links.
- Find big files.
find /usr/share -type f -size +5M > /data/archive/big-files.txt - Create the bzip2 archive.
tar -cjf /data/archive/etc.tar.bz2 /etc - Extract one file.
ملاحظاتي
لا توجد ملاحظات بعد.