6.2 KiB
6.2 KiB
OS-9: Linux Client Tools
Status: not started
Domain:
- 1.0 Operating Systems
Objective alignment:
- 1.9 Linux client tools
What You Need To Know
Linux questions on Core 2 usually test:
- Basic file navigation
- Permissions and ownership
- Important configuration files
- Package managers
- Network commands
- Process and disk usage commands
- The difference between normal user and root/admin actions
Memory Tricks
Command buckets:
- Files:
ls,pwd,mv,cp,rm,find,cat - Permissions:
chmod,chown,sudo,su - Network:
ip,ping,curl,dig,traceroute - System:
top,ps,df,du,mount,fsck - Help:
man
Key files:
/etc/passwd: user account list/etc/shadow: password hashes/etc/hosts: local name-to-IP mappings/etc/resolv.conf: DNS resolver settings/etc/fstab: file systems mounted at boot
Memory hook:
- PASS users, SHADOW passwords, HOSTS names, RESOLV DNS, FSTAB mounts.
Linux Concepts
Root:
- The all-powerful administrative account.
- User ID
0.
sudo:
- Runs one command with elevated privileges.
- Safer than staying logged in as root.
su:
- Switches to another user, often root.
- You remain that user until you exit.
Kernel:
- Core of the operating system.
- Manages hardware, memory, and processes.
Bootloader:
- Starts the operating system during boot.
systemd:
- System and service manager.
- Starts and manages services, login sessions, logging, and other system processes.
Commands To Enter
Safe commands:
pwd
What it does:
- Prints the current working directory.
ls
What it does:
- Lists files and directories.
ls -l
What it does:
- Lists files with permissions, owner, group, size, and date.
cat /etc/os-release
What it does:
- Shows Linux distribution details.
cat /etc/passwd
What it does:
- Shows local user account entries.
- Each line includes username, UID, GID, home directory, and shell.
cat /etc/hosts
What it does:
- Shows local hostname-to-IP mappings.
cat /etc/resolv.conf
What it does:
- Shows DNS resolver settings.
cat /etc/fstab
What it does:
- Shows file systems configured to mount at startup.
grep root /etc/passwd
What it does:
- Searches
/etc/passwdfor lines containingroot.
find . -name "*.txt"
What it does:
- Finds
.txtfiles under the current directory.
ip addr
What it does:
- Shows network interfaces and IP addresses.
ip route
What it does:
- Shows routes, including the default gateway.
ping -c 4 127.0.0.1
What it does:
- Sends four pings to the local loopback address.
curl https://example.com
What it does:
- Retrieves data from a URL.
dig example.com
What it does:
- Queries DNS for detailed domain information.
- If
digis not installed, trynslookup example.com.
traceroute example.com
What it does:
- Shows the route packets take to a destination.
- If not installed, use
tracepath example.comif available.
top
What it does:
- Shows live process and resource usage.
- Press
qto quit.
ps aux
What it does:
- Shows running processes.
df -h
What it does:
- Shows mounted file systems and free space in human-readable units.
du -h
What it does:
- Shows disk usage for files/directories.
man grep
What it does:
- Opens the manual page for
grep. - Press
qto quit.
Practice File Commands
Use these in a temporary folder:
mkdir linux-practice
cd linux-practice
echo "Core 2 Linux practice" > notes.txt
cp notes.txt copy.txt
mv copy.txt renamed.txt
ls -l
grep Linux notes.txt
chmod u+x renamed.txt
ls -l
cd ..
rm -r linux-practice
What they do:
mkdircreates a directory.cdchanges directory.echo ... > filewrites text to a file.cpcopies a file.mvmoves or renames a file.grepsearches inside a file.chmod u+xadds execute permission for the owner.rm -rremoves a directory and its contents.
Admin Commands To Know
Do not run these casually on important systems:
sudo chown user:group file
What it does:
- Changes file owner/group.
sudo apt update
sudo apt install package-name
What it does:
- Updates package lists and installs software on Debian/Ubuntu-based systems.
sudo dnf install package-name
What it does:
- Installs software on Fedora/Red Hat-based systems.
sudo fsck /dev/device
What it does:
- Checks and repairs a file system.
- Usually run on unmounted or read-only volumes.
sudo mount /dev/device /mnt
What it does:
- Mounts a storage device to a directory.
Windows Comparisons
lsis likedir.pwdis like checking your current path in Command Prompt/PowerShell.topandpsare like Task Manager process views.df -his like checking drive free space.fsckis likechkdsk.tracerouteis like Windowstracert.digis likenslookup, but usually more detailed.
Mini Lab
Goal:
- Practice common Linux commands safely.
Linux:
- Run
cat /etc/os-release. - Run
pwd. - Run
ls -l. - Run
cat /etc/passwd. - Run
cat /etc/hosts. - Run
cat /etc/resolv.conf. - Run
ip addr. - Run
ip route. - Run
df -h. - Run
ps aux. - Run
top, then pressq. - Create and remove the
linux-practicefolder from the practice command section.
Record:
- Distribution:
- Current directory:
- Current user:
- DNS server:
- Default gateway:
- Root filesystem free space:
- One running process:
- What permission changed after
chmod u+x:
Windows comparison:
- Run
dir. - Run
taskmgr. - Run
tracert example.com. - Run
nslookup example.com. - Record which Linux commands match those Windows tools.
Quick Check Before Quiz
You are ready for the OS-9 quiz when you can answer these without looking:
- Which file lists user accounts?
- Which file stores password hashes?
- Which command changes file permissions?
- Which command shows live process/resource usage?
- Which command shows disk free space?
- Which package manager is common on Ubuntu/Debian?
- Which command gives help/manual pages?