Day 3 Lab Workbook: Registration, File Commands, and the Filesystem¶
1. Lab Overview¶
| Item | Detail |
|---|---|
| Lab title | Register a RHEL system and manage files across the filesystem |
| Objective | Register a system with Red Hat, verify repository access, create and manage files and directories safely, and identify the purpose of key directories |
| Skills tested | rhc and subscription-manager, repository verification, redirection and append, reading files, copying, moving, and removing, path navigation, filesystem hierarchy |
| Estimated time | 90 to 120 minutes |
| Difficulty | Beginner to intermediate |
| Required environment | A RHEL 9 or 10 virtual machine with internet access |
| Prerequisites | Days 1 and 2 completed; a Red Hat account with a usable subscription for Tasks 1 to 3 |
2. Lab Environment and Safety¶
Requirements
- A disposable RHEL VM (your own VM from Day 2 is ideal).
- A regular user with
sudorights. - Internet access.
- For Tasks 1 to 3: Red Hat account credentials with an entitlement. Tasks 4 to 8 need no account.
Assumptions (not verified for your environment)
- The VM is not already registered. If it is registered (for example, the hosted course lab may manage registration differently), check the state first and adapt Tasks 1 to 3.
- The command-line assistant package is available for your RHEL release.
- Files named in tasks, such as
/etc/servicesand/usr/lib/tmpfiles.d/tmp.conf, exist on typical systems. Confirm before relying on them.
Safety
- Work only in a directory you create,
~/day3-lab. Do not delete or overwrite anything outside it. - Several commands are destructive (
>,rm,rm -r,rm -rf,mvover an existing file). Read every command twice before pressing Enter. - Do not type your Red Hat password on the command line. Let the tools prompt you.
- Never send passwords or other secrets to the command-line assistant.
- Do not disable SELinux or the firewall.
- Unregister the VM when you finish so a test system does not stay attached to your account.
3. Practice Tasks¶
Try each task from the requirements first. Solutions are in the last section.
Task 1: Register with the Red Hat connector¶
Scenario: A new VM cannot install packages and you have been asked to enable access to Red Hat content.
Requirements:
- Record the repository list before registering.
- Register the system using the Red Hat connector.
- Confirm that the connection is active.
- Record the repository list after registering.
- Save the before and after observations in
~/day3-lab/registration.txt.
Hints:
- You need elevated privileges for registration.
- A repository listing command exists in
dnf. - Create the
~/day3-labdirectory first if it does not exist.
Success criteria: The file shows no (or an error for) repositories before registration and a list of repositories afterward, and the connector reports an active connection.
Task 2: Switch to Subscription Manager¶
Scenario: A colleague's documentation uses the traditional registration tool, and you need to show you can use both.
Requirements:
- Remove the current connection.
- Register again, this time with Subscription Manager.
- Verify registration status and identity.
- Verify repository access again.
Hints:
- Disconnecting with one tool and re-registering with another is allowed, but verify the state in between.
Success criteria: Status and identity commands show a registered system, and the repository list is not empty.
Task 3: Ask the command-line assistant (optional)¶
Scenario: You need to remember how to open a firewall service and want to see how the assistant answers.
Requirements:
- Install the command-line assistant.
- Ask it one plain-English question about opening a firewall service.
- Compare the suggested command with the manual page before running anything.
- Write one sentence in
~/day3-lab/assistant.txtabout whether the answer matched the manual page.
Hints:
- The question goes in quotes.
- The manual pages for
firewall-cmdare the reference.
Success criteria: You received an answer, compared it with the manual page, and recorded your conclusion. If the assistant is unavailable on your release, write that finding instead.
Task 4: Build a directory tree¶
Scenario: You are preparing a workspace for a small application.
Requirements:
- Inside
~/day3-lab, createearth/asia/india/telanganausing one command. - Create three sibling directories named
config,logs, anddatainside a directory namedappusing one command. - Show the whole structure.
- Starting in
telangana, return to~/day3-labusing only relative paths. Then enterapp/logsusing an absolute path.
Hints:
- One option makes missing parent directories.
~refers to your home directory.
Success criteria: The recursive listing shows both trees, and pwd confirms you reached each location.
Task 5: Redirect and append¶
Scenario: You are keeping a simple activity log and must never lose earlier entries.
Requirements:
- Create
~/day3-lab/app/logs/activity.logcontaining the lineservice started. - Add a second line
service checkedwithout losing the first. - Create
~/day3-lab/notes.txtusing keyboard input, with two lines of your choice. - Demonstrate (on a different scratch file) what happens when you use the wrong operator and overwrite content.
Hints:
- Two operators are involved. One keeps existing content.
- A keyboard-input file needs an end-of-input signal.
Success criteria: activity.log shows both lines in order. notes.txt shows your two lines. The scratch file demonstrates the overwrite.
Task 6: Read files in different ways¶
Scenario: You must inspect a long file quickly and pull out its beginning and end.
Requirements:
- Create a file
~/day3-lab/numbers.txtcontaining the numbers 1 to 30, one per line. - Show the first 5 lines and the last 5 lines.
- Show the file in reverse order.
- Page through the whole file in a viewer that lets you scroll backward, and search it for the number 17. Then quit.
- Show the first 10 lines of
/etc/services(if it exists).
Hints:
seqcan generate numbers, and redirection can save them.- Two paging tools exist, but only one scrolls backward easily.
Success criteria: Your outputs match the expected lines, and you can name which tool you used for paging and how you quit.
Task 7: Copy, rename, move, and remove safely¶
Scenario: You need to back up and reorganize files without risking real data.
Requirements:
- Copy
activity.loginto thedatadirectory. - Copy the entire
appdirectory toapp-backup(inside~/day3-lab). - Rename
notes.txttonotes-old.txt. - Move
notes-old.txtintoapp/config. - Try to remove the non-empty
app-backup/logsdirectory with the command that only removes empty directories and read the result. Then removeapp-backupcorrectly. - After each step, list the affected directory to confirm the result.
Hints:
- Copying a directory needs an extra option.
- Renaming and moving use the same command.
- Only remove paths inside
~/day3-lab.
Success criteria: The final listing shows the expected files, app-backup is gone, and you saw the "not empty" error and can explain it.
Task 8: Explore the filesystem hierarchy¶
Scenario: A new teammate asks where configuration, logs, home directories, and temporary files live.
Requirements:
- List the top-level directories of the filesystem.
- Find out whether
/binand/sbinare real directories or symbolic links, and where they point. - For each directory below, write one line in
~/day3-lab/fhs.txtexplaining what it holds:/boot,/dev,/etc,/home,/root,/run,/tmp,/usr,/var,/var/tmp. - Find the cleanup age configured for
/tmpand/var/tmpon your system.
Hints:
- A long listing with the directory itself (not its contents) shows link targets.
- The cleanup rules are in a systemd tmpfiles configuration file.
Success criteria: Your file has ten accurate lines, and you report the actual cleanup values from your system (not assumed values).
4. Troubleshooting Challenges¶
Perform these only inside ~/day3-lab.
Challenge A: The vanished log¶
A colleague says their log file lost its old entries after they added a line.
Setup: Create ~/day3-lab/ch-a.log with three lines. Then add a fourth line using the wrong operator.
Your job: Explain what happened, state whether the data can be recovered, and describe how to prevent it.
Success criteria: You identify the operator, say that the earlier content is gone (and that a backup would have saved it), and give a prevention method.
Challenge B: The directory that will not delete¶
Setup: Create ~/day3-lab/stubborn/inner/file.txt.
Your job: Try to remove stubborn with rmdir, explain the result, and remove it using an appropriate command after listing its contents.
Success criteria: You read the error, explain it, and remove only the intended directory.
Challenge C: The copy that skipped a directory¶
Setup: Create ~/day3-lab/src/sub/a.txt. Try cp src dest.
Your job: Explain the message, fix the command, and verify the result.
Success criteria: dest contains the full copy with sub/a.txt.
Challenge D: The package that will not install¶
Setup: Unregister the VM (after Task 2), then try to install a small package of your choice.
Your job: Diagnose why the install fails, state the registration check you would run, restore the registration, and confirm the install now works.
Success criteria: You tie the failure to missing registration, you used a status command to show it, and the install succeeds after you register again.
5. Final Practical Challenge¶
Scenario: You are setting up a small project workspace on a newly built RHEL VM and must leave a verifiable record.
Requirements: Using only the requirements below, build the following inside ~/day3-lab/final:
- A directory structure
project/{src,docs,logs,backup}created with a minimal number of commands. - A file
project/src/main.txtcontaining three lines of your choice. - A log file
project/logs/events.logwith one entry per action you perform below, appended in order. - A copy of
main.txtinbackup, and a renamed copy of it calledmain-v1.txtindocs. - A file
project/docs/summary.txtthat contains, in your own words, the purpose of/etc,/var, and/tmp. - A final file
project/docs/status.txtshowing the current registration status of the VM (use the appropriate command) and the first 3 lines ofmain.txt. - Confirm all of it with one recursive listing.
Choose the commands yourself. Do not copy the notes without understanding each option.
Success criteria: The listing shows the exact structure, events.log has an entry for each action in order, no earlier content was overwritten, and status.txt matches current system state.
6. Verification Checklist¶
- [ ] I recorded the repository list before and after registering.
- [ ] I registered with
rhcand verified with a status command. - [ ] I registered with Subscription Manager and checked status and identity.
- [ ] I compared the assistant's answer with a manual page (or noted it was unavailable).
- [ ] I created nested directories with one command each.
- [ ] I used
>and>>correctly and saw the effect of each. - [ ] I used
head,tail,tac, and a pager on a file. - [ ] I copied a directory with
-r, renamed a file, and moved a file. - [ ] I saw
rmdirrefuse a non-empty directory. - [ ] I identified
/binand/sbinas links (or documented what my system shows). - [ ] I found the actual cleanup ages for
/tmpand/var/tmp. - [ ] I completed Challenges A to D.
- [ ] My final workspace matches the requirements.
- [ ] I only deleted or overwrote items inside
~/day3-lab. - [ ] I unregistered or disconnected the VM when finished.
7. Solutions and Answer Key¶
Try the tasks first. Output varies by system, so expected results describe what to look for. Replace placeholders with your own values.
Task 1 solution¶
Approach: Capture the starting state, register, verify.
mkdir -p ~/day3-lab
{ echo "BEFORE:"; sudo dnf repolist 2>&1; } > ~/day3-lab/registration.txt
sudo rhc connect
sudo rhc status
{ echo; echo "AFTER:"; sudo dnf repolist 2>&1; } >> ~/day3-lab/registration.txt
cat ~/day3-lab/registration.txt
Explanation: 2>&1 includes error messages in the file. The first group uses > to start the file, and the second uses >> to append, so the "before" results are kept.
Verification: rhc status reports a connection, and the "AFTER" section lists repositories.
Rollback: sudo rhc disconnect
Task 2 solution¶
sudo rhc disconnect
sudo subscription-manager register
sudo subscription-manager status
sudo subscription-manager identity
sudo dnf repolist
Explanation: Disconnecting first avoids an "already registered" conflict. The register command prompts for credentials.
Verification: Status reports registration, identity shows the system's identity, and dnf repolist lists repositories.
If repositories are missing: Check the subscription in your Red Hat account and the output of subscription-manager status.
Task 3 solution¶
sudo dnf install command-line-assistant -y
c "how do I allow the http service through the firewall permanently?"
man firewall-cmd
echo "Answer matched the manual page for --add-service and --permanent." > ~/day3-lab/assistant.txt
Write the real conclusion in the file based on your comparison. Do not copy the sentence above unless it is true for what you observed.
Explanation: The manual page is the authority. Look for --add-service, --permanent, and --reload.
If the assistant is unavailable: Run rpm -q command-line-assistant and record your finding.
Cleanup: None required.
Task 4 solution¶
cd ~/day3-lab
mkdir -p earth/asia/india/telangana
mkdir -p app/{config,logs,data}
ls -R
cd earth/asia/india/telangana && pwd
cd ../../../..
pwd
cd /home/<your-user>/day3-lab/app/logs
pwd
Explanation: -p creates parents. The braces in app/{config,logs,data} expand to three directories. From telangana, four .. levels reach ~/day3-lab. The final cd uses an absolute path, which starts with /.
Verification: ls -R shows both trees, and each pwd matches the expected location.
Task 5 solution¶
cd ~/day3-lab
echo "service started" > app/logs/activity.log
echo "service checked" >> app/logs/activity.log
cat app/logs/activity.log
cat > notes.txt
# type two lines, then press Ctrl+D on a new line
cat notes.txt
echo "keep me" > scratch.txt
echo "oops" > scratch.txt
cat scratch.txt
Explanation: The first > creates the log and >> appends. cat > notes.txt reads from the keyboard until Ctrl+D. The scratch demo shows that the second > replaced "keep me".
Verification: activity.log has both lines in order, notes.txt has your lines, and scratch.txt contains only oops.
Cleanup: rm scratch.txt (a file you created).
Task 6 solution¶
cd ~/day3-lab
seq 1 30 > numbers.txt
head -n 5 numbers.txt
tail -n 5 numbers.txt
tac numbers.txt
less numbers.txt # type /17 and press Enter to search; press q to quit
head -n 10 /etc/services
Explanation: seq 1 30 prints 1 to 30, and > saves it. less scrolls both ways and supports / search. q quits. more pages forward only and is less convenient for searching.
Verification: head shows 1 to 5, tail shows 26 to 30, and tac starts at 30.
Task 7 solution¶
cd ~/day3-lab
cp app/logs/activity.log app/data/
ls app/data
cp -r app app-backup
ls app-backup
mv notes.txt notes-old.txt
mv notes-old.txt app/config/
ls app/config
rmdir app-backup/logs # expected to fail: directory not empty
rm -r app-backup
ls
Explanation: cp -r copies directories recursively. A rename is a move to a new name. rmdir refuses non-empty directories, so it protected the files. rm -r app-backup removes the directory and its contents, and the path is inside ~/day3-lab, so it is safe.
Verification: ls no longer shows app-backup, and app/config contains notes-old.txt.
Task 8 solution¶
ls /
ls -ld /bin /sbin
cat /usr/lib/tmpfiles.d/tmp.conf
If that path does not exist:
systemd-tmpfiles --cat-config | grep -i tmp
Example content for fhs.txt (write your own wording):
/boot - kernel and boot files
/dev - device files representing hardware
/etc - system-wide configuration files
/home - home directories of regular users
/root - home directory of the root user
/run - runtime data, cleared at reboot
/tmp - temporary files, cleaned automatically
/usr - installed software and libraries
/var - variable data such as logs and caches
/var/tmp - temporary files kept longer than /tmp
Explanation: ls -ld shows the directory entry itself. An l at the start of the line and an arrow -> show a symbolic link. The tmpfiles configuration lines for /tmp and /var/tmp include an age value (for example, a number followed by d).
Verification: Report the exact ages you see on your system.
Challenge A solution¶
cd ~/day3-lab
printf "1\n2\n3\n" > ch-a.log
echo "4" > ch-a.log
cat ch-a.log
Cause: > overwrote the file, so lines 1 to 3 were lost. They cannot be recovered from the shell unless you have a backup. Prevention: use >> to append, make a copy first (cp ch-a.log ch-a.log.bak), or use cp -i-style careful habits. Some shells offer a noclobber setting that blocks overwriting. Check your shell's documentation.
Challenge B solution¶
cd ~/day3-lab
mkdir -p stubborn/inner && touch stubborn/inner/file.txt
rmdir stubborn # fails: directory not empty
ls -R stubborn
rm -r stubborn
ls
Explanation: rmdir only removes empty directories. After checking the contents, rm -r removes the directory and everything in it.
Challenge C solution¶
cd ~/day3-lab
mkdir -p src/sub && touch src/sub/a.txt
cp src dest # fails: -r not specified
cp -r src dest
ls -R dest
Explanation: cp refuses to copy a directory without -r.
Challenge D solution¶
sudo subscription-manager unregister
sudo dnf install -y tree # expected to fail: system not registered
sudo subscription-manager status
sudo subscription-manager register
sudo dnf install -y tree
Explanation: Without registration, the system cannot reach Red Hat repositories, so the package cannot be found or downloaded. subscription-manager status shows the unregistered state. (tree is only an example package. Use any small package from your repositories.)
Verification: The second install succeeds after registering.
Cleanup: sudo dnf remove -y tree if you do not want it.
Final practical challenge solution¶
mkdir -p ~/day3-lab/final/project/{src,docs,logs,backup}
cd ~/day3-lab/final/project
echo "created directory structure" > logs/events.log
printf "line one\nline two\nline three\n" > src/main.txt
echo "created src/main.txt" >> logs/events.log
cp src/main.txt backup/
echo "copied main.txt to backup" >> logs/events.log
cp src/main.txt docs/main-v1.txt
echo "copied main.txt to docs as main-v1.txt" >> logs/events.log
cat > docs/summary.txt <<'EOF'
/etc holds system-wide configuration files.
/var holds variable data such as logs and caches that persists across reboots.
/tmp holds temporary files that are cleaned automatically.
EOF
echo "wrote docs/summary.txt" >> logs/events.log
{ echo "Registration status:"; sudo subscription-manager status; echo; echo "First 3 lines of main.txt:"; head -n 3 src/main.txt; } > docs/status.txt
echo "wrote docs/status.txt" >> logs/events.log
ls -R ~/day3-lab/final
cat logs/events.log
Explanation: {src,docs,logs,backup} creates the four directories in one command. The first log entry uses > to start the log, and every later entry uses >> so no earlier entry is lost. The <<'EOF' block (a here-document) writes several lines to a file without opening an editor. Grouping commands in braces sends all of their output to a single file.
Verification: The listing shows the required structure, events.log has the entries in order, and status.txt matches what sudo subscription-manager status reports now.
Cleanup:
rm -r ~/day3-lab
sudo subscription-manager unregister # when you are finished practicing
Remove only ~/day3-lab, which you created.
8. Extended Practice Drills¶
Short, independent drills for repeated practice. Do them in order or jump to the group you need. Work only inside your lab directory, read each drill carefully, and check your result with a command before looking at the answer list in section 9.
Setup (run once):
mkdir -p ~/day3-lab/drills && cd ~/day3-lab/drills
A. Registration checks¶
- Show whether the system is registered with Subscription Manager.
- Show the connector state.
- List available repositories.
- Show the system's registration identity.
- Display the options of
rhc connect. - Find the
registersection in the Subscription Manager manual page. - Check whether
bash-completionis installed. - Check whether the command-line assistant package is installed.
- In one sentence, why does
dnffail on an unregistered RHEL system? - Why should you unregister disposable test VMs?
B. Creating files¶
- Create an empty file
empty.txt. - Create three files
f1,f2,f3with one command. - Show the full timestamp of
f1, wait two seconds, touch it, and show the timestamp again. - Create
hello.txtcontaininghello. - Add the line
worldtohello.txtwithout losinghello. - Create
k.txtfrom keyboard input with two lines. - Append a third line to
k.txtfrom the keyboard. - Show
hello.txtandk.txt. - Overwrite a scratch file on purpose to see the effect.
- Append twice to a scratch file and confirm both lines stay.
C. Creating directories¶
- Create
a/b/c/dwith one command. - Create
x/one,x/two,x/threewith one command. - Try
mkdir p/q/rwithout-p. What happens? - Run
mkdir -p a/b/c/dagain. What happens? - Show the structure of
arecursively. - Show the directory entry for
aitself rather than its contents.
D. Reading files¶
- Create
hundred.txtwith the numbers 1 to 100, one per line. - Show the first 10 lines.
- Show the first 3 lines.
- Show the last 10 lines.
- Show the last 3 lines.
- Show the file in reverse order.
- Page through the file with
less. Jump to the end, to the start, search for 50, then quit. - Page through it with
more. How do you advance and quit? - Count the lines in
hundred.txt. - Show lines 10 to 12 using
headandtailtogether. - Show the first 5 lines of
/etc/servicesif it exists. - Show the last 5 lines of
/etc/passwd.
E. Listing and navigating¶
- Show a long listing of the current directory.
- Show hidden files too.
- Show a long listing including hidden files.
- Show human-readable sizes in a long listing.
- Create
.secretand show that plainlshides it butls -ashows it. - Print your location.
- Enter
a/b/c/dusing a relative path and print your location. - Go up one level, then two levels, then three levels.
- Return to the previous directory.
- Go to your home directory two different ways.
- Reach the same directory with one absolute and one relative path.
F. Copying and moving¶
- Copy
hello.txttocopy.txt. - Copy it again with a prompt before overwriting.
- Copy the directory
atoa-copy. - Create
boxand copyf1,f2,f3into it. - Rename
copy.txttorenamed.txt. - Move
renamed.txtintobox. - Rename the directory
a-copytoa-moved. - Move a file with a prompt before overwriting.
- Try
cp a a-fail(a directory without-r). Explain the message.
G. Removing safely¶
- Remove
f1. - Remove
f2with a confirmation prompt. - Compare
rm nothing.txtwithrm -f nothing.txtfor a file that does not exist. - Create
emptyand remove it with the command that only removes empty directories. - Try
rmdir a. Explain the result. - Remove
a-movedand everything in it. - Before any
rm -r, which command should you run first? - Show whether
rm,cp, andmvare aliased in your shell. - Why is
rm -rfdangerous?
H. Filesystem hierarchy¶
- List the top-level directories.
- Are
/binand/sbinreal directories or links? - Show the first 10 entries of
/etc. - List home directories.
- Show the owner and permissions of
/rootitself. - List some log files.
- List the contents of
/boot. - Show the first 10 entries of
/dev. - Show the first 10 entries of
/run. - Find the cleanup ages configured for
/tmpand/var/tmp. - Create a file in
/tmpand in/var/tmp, list them, then remove only those two files. - Explain the difference between
/and/root. - Match each to its purpose:
/etc,/var,/usr,/run,/boot,/dev.
I. Integrated drills¶
- Create
~/day3-lab/drills/logand append five timestamped lines toevents.logusingdate. - Make a backup copy of
lognamedlog-backupand confirm both exist. - Show the newest two entries of the log.
- Show the log in reverse order.
- Rename
log-backuptolog-oldand move it intobox. - Write a file
fhs-notes.txtwith one line each for/etc,/var,/tmp,/home,/root. - Confirm every change with one recursive listing.
- Clean up everything you created in this drill directory.
9. Drill Answer Key¶
Answers show one valid approach. Output varies by system, so compare the meaning of your output, not exact text. Commands marked with
sudoneed elevated privileges.
A. Registration checks¶
sudo subscription-manager statussudo rhc statussudo dnf repolistsudo subscription-manager identityrhc connect --helpman subscription-manager, then/registerand Enter.rpm -q bash-completionrpm -q command-line-assistant- It cannot reach Red Hat's repositories without a registered, entitled system.
- So old test systems do not clutter your Red Hat account.
B. Creating files¶
touch empty.txttouch f1 f2 f3ls -l --time-style=full-iso f1; sleep 2; touch f1; ls -l --time-style=full-iso f1(only the time changes).echo "hello" > hello.txtecho "world" >> hello.txtcat > k.txt, type two lines, pressCtrl+D.cat >> k.txt, type the line, pressCtrl+D.cat hello.txt k.txtecho one > s.txt; echo two > s.txt; cat s.txt(onlytworemains).echo one > t.txt; echo two >> t.txt; echo three >> t.txt; cat t.txt
C. Creating directories¶
mkdir -p a/b/c/dmkdir -p x/{one,two,three}- It fails because
pandp/qdo not exist (No such file or directory). - No error.
-pdoes not complain when the directory exists. ls -R als -ld a
D. Reading files¶
seq 1 100 > hundred.txthead hundred.txthead -n 3 hundred.txttail hundred.txttail -n 3 hundred.txttac hundred.txtless hundred.txt;G(end),g(start),/50then Enter,q.more hundred.txt; Space advances a page;qquits.wc -l hundred.txt(prints 100).head -n 12 hundred.txt | tail -n 3(the pipe|passes output to the next command).head -n 5 /etc/servicestail -n 5 /etc/passwd
E. Listing and navigating¶
ls -lls -als -lals -lhtouch .secret; ls; ls -apwdcd a/b/c/d; pwdcd ..,cd ../..,cd ../../..(runpwdafter each).cd -cdandcd ~- Absolute:
cd ~/day3-lab/drills/a. Relative (fromdrills):cd a.
F. Copying and moving¶
cp hello.txt copy.txtcp -i hello.txt copy.txt(answern).cp -r a a-copymkdir box; cp f1 f2 f3 box/mv copy.txt renamed.txtmv renamed.txt box/mv a-copy a-movedmv -i <source> <destination>- It refuses to copy a directory without
-r.
G. Removing safely¶
rm f1rm -i f2(answery).- The first prints an error. The second stays silent.
mkdir empty; rmdir empty- It fails: the directory is not empty.
rm -r a-moved- List the target, for example
ls -R <path>, and confirm the path withpwd. aliasortype rm cp mv- It removes without prompting and cannot be undone. A wrong path can destroy important data.
H. Filesystem hierarchy¶
ls /ls -ld /bin /sbin(on modern RHEL they are symbolic links into/usr).ls /etc | headls /homesudo ls -ld /rootsudo ls /var/log | headls /bootls /dev | headls /run | headcat /usr/lib/tmpfiles.d/tmp.conf(orsystemd-tmpfiles --cat-config | grep -i tmp).touch /tmp/drill-tmp /var/tmp/drill-vartmp; ls -l /tmp/drill-tmp /var/tmp/drill-vartmp; rm /tmp/drill-tmp /var/tmp/drill-vartmp/is the top of the whole tree./rootis the home directory of the root user.- Configuration; variable data (logs, caches); installed software and libraries; runtime data cleared at reboot; boot files; device files.
I. Integrated drills¶
mkdir -p log; for i in 1 2 3 4 5; do echo "$(date) entry $i" >> log/events.log; done; cat log/events.logcp -r log log-backup; ls -R log log-backuptail -n 2 log/events.logtac log/events.logmv log-backup log-old; mv log-old box/- Use
echo "/etc - configuration" > fhs-notes.txtthen>>for the rest, andcat fhs-notes.txt. ls -R ~/day3-lab/drillscd ~ && rm -r ~/day3-lab/drills(removes only the practice directory you created; check the path first).