Linux

Files, Directories & Links

54 flashcards · answers and spaced-repetition review in the KnowCard app

You add a second SATA SSD, then plug in an NVMe drive. Following the standard naming scheme, what device files does the kernel assign to each?
On an MBR-partitioned disk you create partitions but there's a gap in the numbering — the first data partition after the primary ones is /dev/sda5, not /dev/sda3. Why?
For a SATA disk the third partition is /dev/sda3, but for an NVMe SSD the first partition is /dev/nvme0n1p1. What naming rule differs?
From the Linux kernel's point of view, which two characters can never appear inside a file name — and what does that imply about names like a colon, backslash, or newline?
Two files are named report.txt and Report.txt in the same directory. On Linux, are these the same file or two different files?
A user swears their config file is gone because ls shows an empty home directory, but the file is still there. What's the most likely explanation?
Coming from Windows, someone asks which drive letter their second disk gets on Linux. How does the Linux directory tree actually organize storage instead?
What does the tilde ~ expand to, and how does ~jaya differ from ~ — including the surprising case of the root user?
In any directory you'll always find entries named . and .. even in a brand-new empty one. What do they reference?
You're deep in a long path, jump to /var/log to check something, and now want to snap straight back to where you were. Which cd shortcut does that?
You want ls to show the largest files first, including hidden ones, with full details. Which options do that, and what does -r change?
In ls -l output, what is the single number sitting between the permission string and the owner name — and what does an unexpectedly high value there hint at?
cp refuses to copy a directory and only warns about omitting it. Which option fixes that, and when would you reach for cp -a instead of cp -r?
cp -r src dst behaves differently depending on whether dst already exists — you sometimes get dst/src/... and sometimes dst/... directly. What's the rule?
A junior admin uses rmdir to clean up a project folder and it errors out, so they reach for rm -rf. What's the key difference, and why is rm -rf feared?
Beyond ? and *, the shell lets you match a single character from a set. What do [abc], [a-f], and [!abc] each match?
A DOS veteran types *.* to select all files in a directory and some files are missing. On Linux, what's the correct pattern for all files and why?
When you run rm *.log, which program actually turns *.log into the list of matching files — rm, or something else?
You run ls -R *.tex expecting a recursive listing of all .tex files in subdirectories, but it doesn't recurse. Why does the -R option seem ignored?
Someone tries mv *.txt *.bak to rename every .txt file to .bak in one shot and it fails. Why can't mv mass-rename by wildcard?
A cleanup script does rm -r .* to delete hidden files and starts destroying the parent directory. What went wrong, and what's the safe pattern?
What problem do links solve in a filesystem, and where in a typical Linux install do you find them used most heavily?
You run ln abc xyz, then ls -li shows abc and xyz with the same inode number and a link count of 2. What have you actually created?
You need a link that points to a file on a different disk and can also target a directory. Which link type works — and what does it actually store internally?
You have a symlink efg pointing to abc. Compare what happens when you delete abc versus when you delete efg.
Given that symbolic links are more flexible, why would you ever choose a hard link instead?
A colleague raves about modern Rust/Go rewrites of classic Unix tools. Which newer commands stand in for cat, ls, find, df, du, and man?
What is fzf, and how does typing a double-asterisk followed by Tab change the way you complete commands like emacs or ssh?
A device file stores no data yet ls -l shows two numbers where the size normally is. What three properties actually define a device file?
In a long listing under /dev, how do you tell at a glance whether an entry is a block device or a character device?
Device files can be created by hand, but almost never need to be. Which command creates one manually, what normally does it for you, and what does the block-vs-char distinction mean physically?
You want to silently discard a command's output, and separately to fill a file with zero bytes. Which special device files do each, and what do /dev/random and /dev/urandom provide?
Modern distros no longer pre-create thousands of static device files at install. Which background daemon populates /dev on demand, and what is devtmpfs for?
You see /dev/sr0, /dev/ttyS0, and /dev/nvme0n1 on a box. What category of hardware does each device-name prefix under /dev correspond to?
You need to copy a file to a remote host over an encrypted channel. What's the scp syntax, and how do you copy a whole directory or use an IPv6 address?
sshfs lets you mount a remote filesystem locally over SSH — so why does the author ultimately advise against relying on it?
You should never use telnet to log into a remote machine — yet it's still handy. What's the one legitimate diagnostic use, and why the login ban?
Plain FTP is discouraged for a specific security reason. What is it, and what's the recommended secure replacement — plus how does anonymous FTP log in?
Inside an interactive ftp session, which commands download versus upload a file, and how do you end the session?
sftp looks and feels like the old ftp client, but which package provides it and what's one thing you can no longer do with it?
A large ISO download over wget dies halfway. Which option resumes it, and how do you make wget keep retrying an unreliable server overnight?
curl's ability to read stdin and write stdout enables a neat trick: transferring a directory to a backup server without ever writing a temp archive file. How?
Beyond downloading files, why is curl a convenient tool for poking at a REST API from the command line?
For scripted FTP transfers, how does lftp let you run commands non-interactively, and what do mirror and mirror -R do?
rsync is the go-to for syncing directory trees over SSH, but what do you fall back to when the remote host runs neither an SSH nor an rsync server?
Your backup script chokes on a file called my report.txt but works fine on my_report.txt. What's going on, and what does the book recommend?
Coming from DOS, someone assumes the part after the last dot in a Linux file name is a meaningful extension the kernel enforces. Why is that wrong, and how are international characters handled?
A colleague changes directories by typing j proj instead of a long cd path. What tool is that, and why can't it fully replace cd?
You want to know both how much free space is left on your disks and how much a particular directory tree is eating. Which two commands answer those two different questions?
In ls -l, besides -, d, l, b, and c, you sometimes see s or p as the first character. What kinds of files are those?
You keep two files as hard links and edit one in a text editor. After saving, the link count drops to 1 and the files diverge. Why does editing sometimes break a hard link?
Hard links normally can't point to a directory. Is it ever possible to hard-link a directory on Linux?
When creating symbolic links, why does the book advise using relative paths and changing into the link's own directory first?
What's the simplest command to create a new empty file, and what happens if the file already exists?

Start learning today

Free to start — download the app or use it in your browser.

Get it on App StoreGet it on Google Play
Files, Directories & Links (Linux) · KnowCard