Storage, File Systems and Networking in Linux

Learn where Linux keeps its files and how its special directories, links and device files work. Inspect disks and partitions, mount filesystems by hand and at boot, and find out what fills a disk. Read and change network settings with the ip command, resolve names with DNS and the hosts file, and log in to remote machines securely with SSH and key pairs.

BeginnerLesson 7 of 7 in Linux Basics Course

What you will learn

  1. Know where Linux keeps programs, settings, logs and user files, and work with the special directories and files that behave differently from ordinary ones.
    • Know what each top-level directory holds
      Use the Filesystem Hierarchy Standard to predict where programs, configuration, variable data and user files live.
    • Use temporary directories and the sticky bit
      Choose between /tmp and /var/tmp, explain how the sticky bit protects shared directories, and create temporary files safely.
    • Create and manage symbolic and hard links
      Create symbolic links with ln -s, recognize and repair broken links, and explain how hard links differ.
    • Recognize device files and virtual filesystems
      Read file types in ls -l, use the pseudo-devices in /dev, and read system information from /proc and /sys.
  2. Identify the storage devices and partitions in a Linux system, attach filesystems to the directory tree, and make those mounts start automatically at boot.
    • Identify disks, partitions and filesystem types
      Name storage devices and partitions, read lsblk, blkid and fdisk output, and tell partition tables and filesystem types apart.
    • Mount and unmount filesystems
      Attach a filesystem to a directory with mount, see what is mounted, and detach it safely with umount.
    • Mount filesystems at boot with /etc/fstab
      Read and write /etc/fstab entries that identify filesystems by UUID, and test them safely before rebooting.
  3. Check how full each filesystem is, find out which directories and files use the space, and free space without damaging the system.
    • Check free space and inodes with df
      Read df output, explain why its numbers do not simply add up, and recognize when inodes rather than bytes run out.
    • Find what uses the space and clean up safely
      Use du, sort and find to locate large directories and files, explain why du and df disagree, and free space safely.
  4. Explain addresses, interfaces and routes, read a machine's network configuration with ip and ss, change it, and find the step where a connection fails.
    • Explain interfaces, IP addresses and routes
      Describe network interfaces, IPv4 and IPv6 addresses with prefixes, special address ranges, default gateways, ports and how hosts get their settings.
    • Read the network configuration with ip and ss
      Read interfaces, addresses and routes with ip addr, ip link and ip route, and listening services with ss.
    • Change network settings and troubleshoot connections
      Make temporary changes with ip, make lasting changes with the distribution's network tool, and test a connection step by step with ping.
  5. Explain how Linux turns names into IP addresses, use /etc/hosts for local names, and check and test the DNS client settings.
    • Explain how Linux turns names into addresses
      Describe DNS names and records, the lookup order set in /etc/nsswitch.conf, and how /etc/hosts and the machine's own hostname fit in.
    • Check and test the DNS client configuration
      Read /etc/resolv.conf and resolvectl, query names with host, dig and getent, and locate a name resolution fault.
  6. Log in to remote machines and copy files over SSH, replace passwords with key pairs, and run the SSH server with safe settings.
    • Log in, run commands and copy files over SSH
      Connect with ssh, verify host keys, run remote commands, transfer files with scp, sftp and rsync, and read connection errors.
    • Set up key-based login
      Create an SSH key pair with ssh-keygen, protect it with a passphrase and an agent, install the public key on servers, and fix common key problems.
    • Run and secure the SSH server
      Manage the sshd service, change its settings safely, switch off password logins, and read its logs.

Linux Storage and Networking study guide

6 chapters

1

Find your way around the Linux filesystem

Linux paths tell you what a file is for, but some names lead to more than ordinary disk files. Programs, settings and changing data each have a place in the directory tree. Shared temporary directories add a special deletion rule; links give files extra names; device and virtual files expose the running system. Learning these differences helps you choose where to save work and understand what a command will read or change.

1.1 Find programs, settings and changing data

Every Linux path starts in one directory tree rooted at /. A second disk joins that tree at a directory when it is mounted. The Filesystem Hierarchy Standard (FHS) describes the usual purpose of each directory; version 3.0 dates from 2015.

Programs and settings

The FHS separates static files from files that change, and shared files from machine-specific ones. That puts installed programs under /usr, changing data under /var, and this machine's settings under /etc.

LocationWhat belongs there
/usr/bin, /usr/sbinUser commands and administration commands
/usr/libLibraries that programs use
/usr/shareData such as manuals and icons that is not tied to one processor type
/usr/localSoftware installed by the administrator by hand
/etcSystem-wide configuration, mostly text

The older /bin, /sbin and /lib locations hold essential commands and libraries in the FHS layout. Many current distributions use merged /usr: these paths are symbolic links into /usr. Thus /bin/ls and /usr/bin/ls can reach the same program. /etc excludes executable binaries, but administrative scripts may be kept there.

Personal files and running data

Regular users usually keep their own files in /home/NAME; ~ means your home directory. User settings such as ~/.bashrc are hidden entries there. /root is the root user's home. The root directory / is the start of the whole tree, not that user's home.

Under /var, the second directory narrows the purpose:

  • /var/log holds logs.
  • /var/cache holds data that can be downloaded or rebuilt.
  • /var/lib holds program state, including databases and package records.
  • /var/spool holds queued work, such as print jobs.
  • /var/tmp holds temporary files that survive rebooting.

/tmp is for shorter-lived temporary files. /run holds data for the current boot, such as sockets and process ID files, and is cleared at reboot. /boot contains the kernel, initial RAM disk and boot loader files. /dev, /proc and /sys expose devices and the kernel's current information.

Mounts and service data

/mnt is the usual place for a temporary manual mount. Desktop systems commonly mount removable drives below /media/USER/LABEL, or /run/media/USER/LABEL on Fedora. /opt holds add-on software in separate package directories. /srv holds data served to other machines; some distributions use locations such as /var/www for websites.

Consider a packaged nginx server on Debian or Ubuntu. Its executable is /usr/sbin/nginx, its main settings are /etc/nginx/nginx.conf, and requests are logged in /var/log/nginx/access.log. Documentation is under /usr/share/doc/nginx. The directory's purpose tells you where to investigate a settings change or growing log.

Install your own command under /usr/local/bin, keeping it apart from package-managed files. An update can replace files under /usr. For a systemd service, use the override location under /etc/systemd/system instead of editing its shipped unit under /usr/lib/systemd/system.

Key Takeaways

  • The filesystem is one tree rooted at /; mounted drives join it at directories.
  • Use /usr for installed software, /etc for system settings and /var for changing data.
  • Personal files belong in home directories; /root and / have different purposes.
  • /run, /dev, /proc and /sys describe the running system.
  • Keep manually installed software under /usr/local and local service overrides under /etc.

1.2 Create temporary files and protect shared directories

Temporary files need both a suitable lifetime and suitable permissions. A file can survive a reboot yet still be scheduled for cleanup, and protection against deletion is different from protection against reading.

Choose a lifetime

Use /tmp for short-lived work that a program will not need on its next run. FHS recommends clearing it at boot. Fedora and Debian 13 commonly mount it as tmpfs, which uses memory and swap; its contents disappear at shutdown. Its default size limit is half of physical RAM, so a large temporary job can fill it even when the main disk has room.

Use /var/tmp when temporary work must survive rebooting. FHS requires its contents to remain across boot. It is still temporary storage: systemd's upstream cleanup rules commonly age out unused entries after 10 days in /tmp and 30 days in /var/tmp. Distribution and local settings can change those ages. Save lasting work in your home or another permanent data directory.

Read the directory permissions

Inspect the directory entry itself:

ls -ld /tmp

An example permission string is drwxrwxrwt. The initial d means directory. The three permission groups allow everyone to read, write and enter it. The final t marks the sticky bit, replacing the usual execute character for others.

Write permission on a directory normally lets a user remove or rename entries there, including other people's files. In a sticky directory, deletion and renaming are restricted to the file's owner, the directory's owner or root, subject to the usual access rules. The bit is useful precisely because many users share /tmp.

For example, Mina creates /tmp/draft.txt, mode 644, in a root-owned sticky directory. Tomas can read that file because its own permissions allow it. He cannot remove it merely because he can write to /tmp. Mina and root can remove it. Changing the file to mode 600 also protects its contents from other ordinary users.

Set and recognize the sticky bit

On a shared directory you administer:

sudo chmod 1777 /srv/shared

The leading 1 sets the sticky bit; the remaining 777 allows all users full directory access. sudo chmod +t /srv/shared adds the bit without replacing the other permissions. chmod -t removes it when you have permission to change the mode.

A lowercase t means the sticky bit and others' execute permission are both set. An uppercase T means sticky is set but others lack execute permission. For example, mode 1770 appears as drwxrwx--T. Linux ignores the sticky bit on regular files; its historical name comes from keeping program code in memory or swap on early Unix.

Let mktemp choose the name

mktemp creates a file with a unique random name, permissions 600, and prints its path. mktemp -d creates a private temporary directory. In a shell script, keep the printed name in a variable, use that name for the work, then remove the file when finished.

A fixed name such as /tmp/results.txt can already belong to someone else or be created before your program starts. A unique name avoids that collision. The sticky bit does not make predictable names safe and does not make a mode-644 file private.

Key Takeaways

  • /tmp is short-lived; /var/tmp survives rebooting but still receives cleanup.
  • The sticky bit restricts deletion and renaming in shared directories.
  • File permissions control reading; the sticky bit does not hide contents.
  • Mode 1777 combines open directory access with sticky protection; T means others lack execute permission.
  • mktemp creates a unique private file; mktemp -d creates a directory.

A link gives a file another route through the directory tree. A symbolic link stores a path. A hard link supplies another name for the same underlying file. Their different behavior matters when the original name moves or disappears.

Create a symbolic link

The syntax is ln -s TARGET LINKNAME: target first, new name second. For example:

ln -s /srv/manuals ~/manuals
ls -ld ~/manuals
readlink ~/manuals

ls -l starts a symbolic link's permission string with l and prints an arrow to its target. Its displayed size is the byte length of the stored path, not the size of the target directory. For ordinary Linux symlinks, the displayed rwxrwxrwx permissions do not grant access to the target; the target's own permissions still apply.

ls -ld /etc lists the directory entry and permissions. ls -l /etc lists its contents. A trailing slash on a directory symlink follows it: ls -l manuals/ lists the linked directory's contents.

Resolve a relative target

A relative target starts from the directory containing the link. Suppose /home/lee/notes.txt exists and /home/lee/backup is a directory. From /home/lee, run:

ln -s ../notes.txt backup/notes-link

To follow the link, start inside backup, move up with .., then find notes.txt. Writing ln -s notes.txt backup/notes-link instead stores a path to backup/notes.txt. Your working directory when creating the link does not become part of that stored relative path. An absolute target avoids this particular ambiguity.

A dangling link remains after its target path is moved or deleted. Opening it fails with "No such file or directory." readlink LINK shows the stored target; readlink -f LINK resolves the full path when it can. find . -xtype l locates broken links below the current directory. Recreate a broken link with the right target, for example ln -sfn NEWTARGET LINKNAME.

Compare with a hard link
printf 'hello\n' > original.txt
ln original.txt second.txt
ln -s original.txt shortcut.txt
rm original.txt

cat second.txt still prints "hello." A hard link is another directory entry for the same inode, the filesystem's file record. There is no special original name that must remain. cat shortcut.txt fails because its stored target path no longer exists.

PropertySymbolic linkHard link
StoresA target pathAnother name for the same file
Can cross filesystemsYesNo
Can link to a directoryYesNo
After target name is removedMay become danglingOther name still reaches the data

ls -i shows the same inode number for two hard links on one filesystem. The second column of ls -l shows their link count. Removing the last name releases the file once no process still holds it open.

Remove a symlink with rm LINKNAME or unlink LINKNAME. For a directory link, leave off the trailing slash: rm manuals removes only the link. A recursive command on manuals/ can reach and delete the target's contents. System paths such as /bin, versioned command names and enabled systemd services often use symlinks.

Key Takeaways

  • ln -s TARGET LINKNAME stores a path; relative targets start at the link’s directory.
  • Inspect stored targets with readlink; recreate links whose paths no longer work.
  • Hard links share an inode and stay usable when another name is removed.
  • Hard links stay within one filesystem and do not link to directories.
  • Remove a directory symlink without a trailing slash to protect the target’s contents.
  • A symlink’s displayed permissions do not replace the target’s permissions.

1.4 Read devices and the running kernel as files

A path in Linux can name a disk, a terminal or live kernel information. The first character in ls -l tells you the kind of entry before you treat it like an ordinary document.

Recognize file types

The markers are - for a regular file, d for a directory, l for a symbolic link, b for a block device, c for a character device, p for a named pipe and s for a socket. A block device, such as /dev/sda1, provides storage in blocks that can be accessed in any order. A character device, such as /dev/tty1, provides a byte stream.

A device listing can look like this:

brw-rw---- 1 root disk 8, 1 Oct 22 08:00 /dev/sda1

The b identifies a block device. The numbers 8, 1 replace the ordinary size field: the major and minor numbers identify the driver and device to the kernel. /dev is normally provided in memory by devtmpfs and populated as hardware appears, with help from udev. Plugging in a USB drive can create /dev/sdb and /dev/sdb1.

Writing to a disk device directly can overwrite its data without a confirmation question. Check the device's identity with lsblk before any such write.

Use pseudo-devices

/dev/null discards written bytes and immediately returns end of file when read. This command hides error messages while leaving normal results visible:

find / -name '*.conf' 2>/dev/null

The 2> redirects standard error. Anything sent there is discarded.

/dev/zero supplies zero bytes. For example, dd if=/dev/zero of=test.img bs=1M count=100 creates a regular 100 MiB file of zeros: 104,857,600 bytes. The output here is test.img, not a disk device. /dev/urandom supplies random bytes; head -c 16 /dev/urandom | base64 makes 16 of them printable.

Once Linux's random generator is initialized, both /dev/random and /dev/urandom provide cryptographically secure random bytes. On kernels from 5.6 onward, /dev/random waits for that initialization early in boot; /dev/urandom can return bytes before it finishes.

Read live information

procfs, mounted at /proc, creates information on demand. Many entries show a size of zero yet return text when read. /proc/cpuinfo describes processors, /proc/meminfo describes memory, and /proc/mounts lists mounts. Numbered directories describe running processes; /proc/sys exposes kernel settings. Tools such as ps, top and free read this information.

cat /proc/uptime might print 86400.52 340000.10. The first value is seconds since boot: about 24 hours. The second adds idle time across processors, so it can exceed elapsed time.

sysfs, mounted at /sys, describes devices, drivers and buses. ls /sys/class/net/ lists interfaces, ls /sys/block/ lists block devices, and cat /sys/class/net/enp0s3/address reads one interface's MAC address. Writing to writable settings under /proc or /sys changes the running kernel and normally needs root. When making a whole-system backup, configure exclusions for /proc, /sys, /dev and /run; the running system recreates them.

Key Takeaways

  • Read the type marker before treating a path as an ordinary file.
  • Block devices expose storage; character devices expose streams.
  • /dev/null discards data, /dev/zero supplies zeros and /dev/urandom supplies random bytes.
  • /proc and /sys expose live kernel information without ordinary disk files.
2

Inspect disks, partitions and mounted filesystems

A drive, a partition and a filesystem are different layers of storage. Read the device tree to identify what is present, then attach the right filesystem at a directory so its files become accessible. A manual mount lasts for the current system state; an entry in the boot configuration makes it return automatically. Following these layers in order helps you avoid formatting the wrong device or introducing a mount that prevents normal startup.

2.1 Read disks, partitions and filesystem types

A disk is a storage device, physical or virtual. A partition is a region of it. The partition table records those regions, while a filesystem inside a partition organizes its files and directories. A partition can also hold swap, which supports memory instead of storing ordinary files.

Decode the device name

SATA, SAS and USB drives commonly use /dev/sda, /dev/sdb and so on; their partitions add a number, such as /dev/sdb1. NVMe names already contain digits, so a partition adds p: /dev/nvme0n1p2 is partition 2 of /dev/nvme0n1. SD and eMMC devices use names such as /dev/mmcblk0p1; many virtual machines use /dev/vda1.

Detection order can change these names. Identify a drive by several clues, not yesterday's letter:

lsblk -o NAME,SIZE,MODEL,RM,TYPE,MOUNTPOINTS
lsblk -f
sudo blkid
sudo fdisk -l

lsblk displays the disk and its partitions as a tree. RM=1 identifies a device marked removable; TYPE distinguishes disk and part. A mount point of / identifies the root filesystem. lsblk -f adds filesystem types, labels and UUIDs. blkid provides identifiers and types, while fdisk -l shows partition boundaries and the table type. These inspection commands do not repartition anything.

Separate table type from filesystem type
LayerCommon choicesMeaning
Partition tableGPT, MBR/DOSDescribes regions of the drive
Filesystemext4, XFS, Btrfs, FAT32, exFAT, NTFSOrganizes files within a region

MBR allows four primary partitions; one can be an extended partition containing logical partitions numbered from 5. With 512-byte sectors, its addressing limit is 2 TiB. GPT handles larger drives and commonly provides 128 partition entries. UEFI systems boot using an EFI System Partition, formatted with FAT and often mounted at /boot/efi.

Debian and Ubuntu commonly use ext4; RHEL uses XFS by default; Fedora Workstation and openSUSE commonly use Btrfs. FAT32 appears as vfat in Linux and cannot hold a single file of 4 GiB or more. exFAT suits larger removable-media files; NTFS is common on Windows disks. A partition's existence alone does not mean it already has a filesystem.

Read the size units

lsblk, df -h and du -h use binary units: G represents a GiB, or 1,073,741,824 bytes. Drive makers use decimal GB, each containing 1,000,000,000 bytes. Thus a drive holding 500,107,862,016 bytes appears as 465.8G; 32,000,000,000 bytes is about 29.8G. lsblk -b shows exact byte counts. This difference in labels is not lost capacity.

Preparing a new empty drive requires a partitioning step followed by filesystem creation, for example sudo mkfs.ext4 /dev/sdb1. Before changing partitions or formatting, verify the target by size, model and removable status, confirm that its data may be destroyed, and unmount it. fdisk -l only lists; interactive fdisk writes changes when you use w.

Key Takeaways

  • Disk, partition table and filesystem describe different storage layers.
  • NVMe and SD partition names insert p before the partition number.
  • Use lsblk, blkid and fdisk -l to inspect before making changes.
  • GPT and MBR describe partition tables; ext4 and XFS describe filesystems.
  • Binary G and decimal GB measure the same bytes with different unit sizes.
  • FAT32 cannot hold a single file of 4 GiB or more.

2.2 Attach a filesystem and detach it cleanly

Mounting attaches a filesystem to a directory, its mount point. A filesystem mounted at /data becomes accessible through paths such as /data/report.pdf. The directory tree stays continuous even when several disks supply its contents.

Mount and inspect

Suppose lsblk -f identifies /dev/sdb1 as the filesystem you want to read. Make an empty mount directory, then mount it:

sudo mkdir -p /mnt/usb
sudo mount /dev/sdb1 /mnt/usb
findmnt /mnt/usb

mount usually detects the type. Supply -t ext4 when you need to name it explicitly. findmnt shows TARGET, SOURCE, FSTYPE and OPTIONS. mount without arguments lists mounts, including virtual filesystems; df -h reports their space, and lsblk shows mount points beside block devices.

Mounting over a directory hides its existing contents. If /mnt/usb/local.txt was there first, it disappears from view while the USB filesystem is mounted and reappears after unmounting. It was not copied to the drive or erased.

Choose options for the job

Use -o for a comma-separated option list. sudo mount -o ro /dev/sdb1 /mnt/usb disallows normal file writes through this mount. It is useful for inspection, though mounting itself can still write to the device. rw permits writes.

noexec prevents direct execution of files on the mount. It does not stop an interpreter from reading a script: bash /mnt/usb/script.sh can still run a readable script. Treat this as a direct-execution restriction, not a complete barrier to running its contents.

FAT and exFAT do not store Unix owners. When root mounts such a drive, supply the desired owner through mount options. Check both IDs with id -u and id -g. If both print 1000:

sudo mount -o uid=1000,gid=1000 /dev/sdb1 /mnt/usb
cp report.pdf /mnt/usb/

This assigns Linux's displayed ownership for the mount. Changing permissions with chmod is not the same ownership mechanism as on ext4.

Finish the work

Leave the filesystem and close programs using it, then run:

sudo umount /mnt/usb

The spelling is umount. Detach removable storage before pulling it out so buffered writes reach the drive. A file manager's Eject action performs this job on a desktop.

If the command reports "target is busy," a process still uses the filesystem. A shell whose current directory is /mnt/usb is enough. Run cd in that shell, close open files, and try again. fuser -vm /mnt/usb or lsof /mnt/usb helps identify users of the filesystem.

Desktop systems normally arrange automatic removable-media mounts through udisks2, under /media/USER/LABEL or Fedora's /run/media/USER/LABEL. Servers generally rely on configured boot mounts or manual commands. Mounts can also expose a file image, memory or a network share. For example, after creating /mnt/iso, sudo mount -o loop,ro ubuntu.iso /mnt/iso presents an ISO image as a directory.

Key Takeaways

  • A mount point presents the attached filesystem and temporarily hides earlier directory contents.
  • Inspect actual mounts with findmnt; use -o to select options.
  • noexec blocks direct execution; interpreters can still read scripts.
  • FAT and exFAT ownership is supplied by mount options such as uid and gid.
  • Close users of a filesystem and run umount before removing its drive.

2.3 Make a mount return after reboot

A manual mount does not create a boot rule. /etc/fstab supplies those rules, one entry per filesystem or swap area. On a systemd machine, a generator turns filesystem entries into mount units and swap entries into swap units.

Read all six fields

An ext4 data filesystem can use this entry:

UUID=3f2c9a1e-7b4d-4e8a-9c61-2d5f0b8e4a17 /data ext4 defaults,nofail 0 2

Spaces or tabs separate the six fields. Commas join options within one field; do not put spaces inside that list.

  1. Source: a UUID, label or device path.
  2. Mount point: here, /data.
  3. Type: here, ext4.
  4. Options: here, defaults,nofail.
  5. Dump flag: normally 0, disabling the old dump backup flag.
  6. Filesystem check order: 1 for root, 2 for other filesystems that need checking, 0 to skip; XFS and Btrfs normally use 0.

A line beginning with # is a comment. A swap entry uses none as its mount-point field, type swap, and commonly ends in 0 0.

Choose a lasting identifier

Find the filesystem UUID with lsblk -f or sudo blkid. Unlike a name such as /dev/sdb1, the UUID stays with the filesystem when drive detection order changes. Reformatting creates a new filesystem with a new UUID, so update its fstab entry afterward.

defaults includes read-write access and automatic mounting. nofail allows boot to continue if an optional drive is absent. noauto skips automatic mounting; the entry can still support sudo mount /data later. ro means read-only and noexec blocks direct execution. user permits an ordinary user to mount the entry.

Add and test an entry

For an already prepared ext4 data partition:

sudo cp /etc/fstab /etc/fstab.bak
lsblk -f
sudo mkdir -p /data

Edit /etc/fstab to add the line using the UUID actually reported. Then test before rebooting:

sudo findmnt --verify
sudo systemctl daemon-reload
sudo mount -a
findmnt /data

findmnt --verify checks the table, including problems with its fields and sources. The reload makes systemd reread the changed configuration. mount -a mounts eligible entries that are not already mounted. findmnt /data then confirms the source, type and current options. A successful mount -a does not mean a noauto entry was tested; mount that entry explicitly.

The root of a newly mounted ext4 filesystem may belong to root. Once the correct filesystem is mounted, sudo chown lee:lee /data gives Lee ownership of that directory. Doing this before mounting would change the underlying mount-point directory instead.

A wrong UUID, wrong type or unavailable required device can interrupt boot and leave the system in emergency mode. Correct such errors while the system is running. systemctl list-units --type=mount shows the resulting active mount units.

Key Takeaways

  • fstab entries have six fields; options stay together in one comma-separated field.
  • A filesystem UUID stays stable across device-name changes but changes after reformatting.
  • nofail allows an absent optional drive; noauto skips automatic mounting.
  • Back up, verify, reload systemd, mount and inspect before rebooting.
  • Change ownership after mounting to affect the attached filesystem.
3

Measure disk usage and free up space

A message about a full device can mean that storage blocks are exhausted or that the filesystem has no free file records. Start by checking the filesystem that holds the failing path, then locate the files responsible. Some space remains allocated even after a file name disappears. Reading the measurements together lets you choose a cleanup method that frees the resource you need without damaging installed software or application data.

3.1 Check both free space and free inodes

df reports space for mounted filesystems. It answers "How full is the filesystem containing this path?" It does not add up a directory's own files. That difference lets you identify the affected storage before searching for its largest contents.

Read a space report

Use df -h /var/log to inspect the filesystem containing the log directory. A report might show:

Filesystem Size Used Avail Use% Mounted on
/dev/vda1   98G  61G   32G  66% /
/dev/vdb1  916G 210G  660G  25% /data

Here, logs under /var/log use the root filesystem unless a separate filesystem is mounted there. The /data filesystem's free space cannot help a write to /var/log simply because both belong to one computer.

The columns describe the filesystem's size, used space, space available to ordinary users, usage percentage and mount point. GNU df calculates Use% from Used divided by Used plus Avail, rounded up. For the root example, 61 divided by 93 is about 65.6%, displayed as 66%. Human-readable figures themselves are rounded.

Size can exceed Used + Avail. An ext4 filesystem normally reserves 5% of its blocks for root, helping essential services keep working when users fill the rest. Five percent of 98G is about 4.9G. Those unused reserved blocks are excluded from ordinary-user Avail; they are not file data in Used. The reserve can be adjusted with tune2fs -m, such as to 1% for a large data filesystem. Metadata also uses space.

Choose a useful view

df -h uses binary K, M and G units. df -H uses decimal powers of 1000. Plain df normally reports 1024-byte blocks, and df -T adds the filesystem type. To reduce clutter from memory filesystems:

df -h -x tmpfs -x devtmpfs

A tmpfs entry is memory-backed storage, while efivarfs exposes firmware variables. free measures RAM and swap, so it cannot replace df for disk capacity. lsblk tells you how large a disk or partition is, not how much free space its filesystem has.

Check the file records too

An inode is a filesystem record for a file or directory. Hard-linked names share one record. An ext4 filesystem has a fixed supply of inodes created with the filesystem. Very many tiny files can consume them while leaving gigabytes of data space unused.

df -i /var/log

Read IUsed, IFree and IUse%. If IFree is zero, making a new file can fail with "No space left on device" even when df -h shows free space. Removing a few large files releases blocks but very few inodes; cleaning up many unwanted session or cache files addresses inode exhaustion.

When root storage fills, databases may stop, logs fail, updates break and logins can fail. Check both df -h PATH and df -i PATH early. The reports identify which resource is exhausted and which mounted filesystem needs attention.

Key Takeaways

  • df PATH reports the filesystem containing the path, not the directory’s total.
  • Use% uses Used divided by Used plus Avail, rounded up.
  • Unused ext4 reserved blocks reduce ordinary-user availability without becoming used file data.
  • Check df -i when file creation fails despite free gigabytes.

3.2 Find growing files and reclaim space safely

Once df identifies the full filesystem, use du to find the directories using it. Inspect before deleting: application state and replaceable cache files can be large for very different reasons.

Work down the directory tree
sudo du -h -d 1 /var | sort -h
sudo du -sh /var/log

-d 1 gives totals one directory level down, and -s prints one summary total. sort -h understands sizes such as 900M and 2.1G. Use sudo to include directories your ordinary account cannot read. If /var/log is large, repeat the first command there to locate its growing subdirectory.

du -sh * skips names beginning with a dot because the shell's * does not match them. du -h -d 1 ~ | sort -h includes hidden directories, such as .cache and .local, while inspecting a home directory.

To locate large individual files on the root filesystem:

sudo find / -xdev -type f -size +500M 2>/dev/null

-xdev stays on the starting filesystem; -type f selects regular files; M here means MiB. ls -lhS sorts one directory's files from largest to smallest.

Understand different totals

ls -l reports a file's logical length. du normally counts allocated storage. A file containing "hi" and a newline is 3 bytes long but may occupy one 4 KiB block, shown as 4.0K. A sparse virtual-disk image can have a long logical length while consuming much less actual space. du --apparent-size reports logical lengths instead.

A higher df usage than a directory scan can also come from unreadable directories, files hidden beneath mount points, or deleted open files. Deleting a name does not release the data while a process keeps the file open.

For example, removing a 20G live application log may leave df unchanged. Inspect such files with sudo lsof +L1. Restarting the owning service releases its open file, allowing the storage to be freed. To empty a known disposable active log without leaving an unlinked open file, sudo truncate -s 0 /var/log/app/app.log keeps the name and file in place. This erases its recorded contents.

Use the owner of the data to clean it

Package tools know which downloaded files can be replaced. Use sudo apt clean on Debian or Ubuntu, or sudo dnf clean all on Fedora or RHEL. Review proposed changes from apt autoremove or dnf autoremove before removing unused packages. Clear your own unwanted downloads and trash. Do not hand-delete files from /usr, /boot or /var/lib to make room.

For journal growth, sudo journalctl --vacuum-size=1G removes old archived journal files until their total fits the limit. Active files can leave overall journal use above that size. For lasting control, set SystemMaxUse=1G in /etc/systemd/journald.conf and restart systemd-journald.

After cleanup, rerun df -h PATH or df -i PATH to confirm that the resource which caused the failure is available again. If the journal or another log repeatedly grows, inspect the messages causing the growth as well as its retention settings.

Key Takeaways

  • Use du to narrow directory growth and find to locate large regular files.
  • A directory argument includes hidden entries; the shell pattern * skips them.
  • Logical length, allocated blocks and filesystem totals measure different things.
  • Deleted files still held open can keep using space; identify them with lsof +L1.
  • Use package and journal tools for their data; journal vacuuming affects archived files.
  • Recheck the exhausted resource after cleanup and address repeated growth.
4

Configure and check network settings with ip

A working connection needs an active interface, an address and a route toward the destination. A service also needs to listen where clients can reach it. Linux exposes these separate pieces through ip and ss, so you can inspect each before changing anything. Read the current state, distinguish a temporary command from saved configuration, and test from the local link outward to narrow a connection problem without guessing its cause.

4.1 Understand addresses, networks and service ports

A network interface is a connection point through which the kernel sends traffic. It can be Ethernet, Wi-Fi, loopback or a virtual connection such as a VPN. Names such as enp0s3, eno1 and wlp2s0 describe physical adapters; lo is loopback. Some virtual and cloud systems use eth0.

Read IPv4 and its prefix

Ethernet and Wi-Fi interfaces have a 48-bit MAC address, written as six hexadecimal pairs, used for delivery on the local network. An IP address identifies a host for communication across networks. One interface can have several IP addresses.

IPv4 has 32 bits, written as four numbers from 0 to 255. In 192.168.1.50/24, the first 24 bits identify the network and eight bits remain for addresses within it. The network is 192.168.1.0/24, with netmask 255.255.255.0.

Those eight bits provide 256 addresses. The first names the network, and the last, 192.168.1.255, is its broadcast address, leaving 254 host addresses. A /26 has six host bits: 64 total addresses and 62 ordinary host addresses. /24 counts network bits, not machines.

The private ranges are 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. They are not publicly routed; a home router commonly uses NAT to translate private traffic to its public address. 127.0.0.1 is loopback, meaning the machine running the command. A 169.254.x.x link-local address often points to failed DHCP configuration. Documentation uses 192.0.2.0/24, 198.51.100.0/24 and 203.0.113.0/24.

Recognize IPv6

IPv6 has 128 bits in eight hexadecimal groups. Remove leading zeros within a group and replace one run of zero groups with ::: 2001:0db8:0000:0000:0000:0000:0000:0042 becomes 2001:db8::42. Use :: only once in one address. ::1 is loopback; fe80: addresses are link-local on IPv6-enabled Ethernet and Wi-Fi links. Local IPv6 networks commonly use /64, and one host often has several addresses.

Reach networks and services

A host sends traffic directly to destinations on a directly connected network. Its default gateway handles destinations for which there is no more specific route. The gateway is a router reachable on the local link. Without a matching route or default route, other networks are unreachable.

A port identifies a service at an address: SSH uses TCP 22, DNS uses UDP and TCP 53, HTTP uses TCP 80 and HTTPS commonly uses TCP 443. TCP provides reliable connections; UDP carries independent messages. A socket endpoint combines an address and port, such as 192.168.1.50:22.

Learn or set the configuration

DHCP for IPv4 leases an address, prefix, gateway and DNS settings. Static configuration sets fixed values, commonly for servers. IPv6 SLAAC forms an address from router-advertised information. DHCPv6 can supply IPv6 addresses and DNS servers; IPv6 default-router information comes from router advertisements. A DHCPv6 address alone does not supply that route.

Key Takeaways

  • An interface can hold several addresses; MAC and IP addresses serve different roles.
  • A prefix counts network bits: an ordinary IPv4 /24 has 254 usable host addresses.
  • Loopback always refers to the machine running the command.
  • The default route handles destinations without a more specific route.
  • Ports identify services; IP addresses identify hosts and interfaces.
  • IPv6 learns default routers through router advertisements.

4.2 Read interface, route and listening-socket output

The ip command shows the network's current state. Its objects describe different parts: addr for addresses, link for interface state, route for routing and neigh for local neighbors. ss shows sockets and their listening services.

Inspect an interface
ip -br addr
ip addr show dev enp0s3
ip link show

The brief view might show enp0s3 UP 192.168.1.50/24 fe80::a00:27ff:fe3a:5c71/64. The interface is up, with one IPv4 address and one IPv6 link-local address. The longer output separates these fields:

link/ether 08:00:27:3a:5c:71 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.50/24 brd 192.168.1.255 scope global dynamic enp0s3
inet6 fe80::a00:27ff:fe3a:5c71/64 scope link

link/ether gives the MAC address. inet introduces IPv4, and inet6 introduces IPv6. The IPv4 brd value is the broadcast address, not the gateway. dynamic indicates a dynamically assigned address, and valid_lft shows how long it remains valid. UP is administrative state; LOWER_UP indicates a working lower-level link.

ip -4 addr and ip -6 addr select an address family. ip link omits IP addresses. hostname -I prints the machine's configured addresses. Do not select 127.0.0.1 when giving another computer an address for this host.

Read the route separately
default via 192.168.1.1 dev enp0s3 proto dhcp src 192.168.1.50 metric 100
192.168.1.0/24 dev enp0s3 proto kernel scope link src 192.168.1.50 metric 100

ip route show produces this kind of output. The local 192.168.1.0/24 network is directly reachable through enp0s3. Other destinations use gateway 192.168.1.1 under the default route. proto dhcp indicates where that route came from; src supplies the preferred source address.

Use ip route get 203.0.113.10 to inspect the selected path to one destination. ip -6 route show lists IPv6 routes. ip neigh shows learned local IP-to-MAC mappings; a FAILED gateway entry means neighbor resolution did not receive the needed local reply.

Check where a service listens
sudo ss -tulnp

The flags mean TCP, UDP, listening, numeric addresses and process details. Read the local address column. 0.0.0.0:22 accepts traffic on all local IPv4 addresses, while 127.0.0.1:5432 is local-only. [::]:80 names all IPv6 addresses. Listening is only one requirement; network reachability and access rules still matter. ss -tn lists current TCP connections without selecting listeners only.

Older guides use ifconfig, route, arp and netstat. Their current counterparts are ip addr/ip link, ip route, ip neigh and ss. Missing ifconfig is a missing tool, not a failed network. Short forms such as ip a, ip r and ip l are accepted abbreviations.

Key Takeaways

  • Use separate ip objects for addresses, links, routes and neighbors.
  • brd is a broadcast address; find the gateway in ip route.
  • ip route get ADDRESS shows the route selected for that destination.
  • A listener bound to loopback cannot accept connections addressed to the host’s network interface.
  • ss -tulnp connects listening ports to their owning processes.

4.3 Change settings and narrow a connection fault

A temporary command and a saved network profile serve different purposes. ip changes the running kernel state immediately; the distribution's network manager restores saved settings at boot and may replace temporary changes sooner.

Make a temporary change

On a practice interface named enp0s8:

sudo ip link set dev enp0s8 up
sudo ip addr add 192.168.50.10/24 dev enp0s8
sudo ip route add default via 192.168.50.1

Include the prefix. Without /24, an added IPv4 address gets /32, so the expected route to the local /24 network is absent. ip addr del removes the specified address, ip route del default removes the default route, and ip link set ... down disables the interface.

Changing the interface carrying a remote SSH session can disconnect you. Use console access or a configuration tool with rollback for that work.

Save settings with the active manager

Fedora, RHEL and many desktops use NetworkManager. Find the profile with nmcli device status, then modify its connection name:

sudo nmcli connection modify "Wired connection 1" ipv4.method manual ipv4.addresses 192.168.1.60/24 ipv4.gateway 192.168.1.1 ipv4.dns 192.168.1.1
sudo nmcli connection up "Wired connection 1"

Setting ipv4.method auto returns the profile to DHCP. Ubuntu commonly uses netplan YAML under /etc/netplan/; other systems use systemd-networkd's .network files or Debian ifupdown's /etc/network/interfaces. Cloud systems often rely on DHCP and cloud-init.

A netplan static configuration can read:

network:
  version: 2
  ethernets:
    enp0s3:
      dhcp4: false
      addresses: [192.168.1.60/24]
      routes:
        - to: default
          via: 192.168.1.1
      nameservers:
        addresses: [192.168.1.1]

Use spaces for indentation. sudo netplan try applies the configuration with a 120-second confirmation window before rollback. sudo netplan apply applies it directly.

Test one layer at a time

Start with ip -br link, then ip -br addr, then ip route. No active link, no suitable address and no default route are different faults. Test the gateway with ping -c 3 192.168.1.1, then an external address, then a name. The -c count makes Linux ping stop after a fixed number of requests; otherwise use Ctrl+C.

A reply reports round-trip time, while the summary reports packet loss. No echo reply can reflect ICMP filtering as well as a down host or broken route. If an address works but a name produces "Temporary failure in name resolution," inspect name lookup. If ping prints the resolved address and then gets no replies, lookup already succeeded.

tracepath or traceroute shows responding routers along the path. Test the actual application too: curl -I https://example.com asks for HTTP headers. If a local web request succeeds but remote ones fail, inspect sudo ss -tlnp. A service bound to 127.0.0.1:80 needs a network-facing bind address for remote use, as well as the necessary network access rules.

Key Takeaways

  • ip changes are immediate and temporary; save lasting settings through the active network manager.
  • Include a prefix when adding an address.
  • Test link, address, route, gateway, external address, name and service in order.
  • A name-resolution error differs from a resolved name that receives no ping replies.
  • A ping failure alone does not identify which connection layer failed.
  • Use console access or rollback when changing a remote connection’s settings.
5

Resolve hostnames with DNS and the hosts file

A server can be reachable by address while its name fails, or one computer can send a familiar name to an outdated address. Name resolution is a separate part of a connection, with several possible sources and caches. Learn how local names, DNS records and resolver settings fit together, then choose a test that follows the same lookup path as the application. Comparing those paths helps locate a stale entry or a failing DNS service.

5.1 Follow a hostname through local files and DNS

Names let people use web1.example.com instead of remembering an address. DNS, the Domain Name System, stores records in a distributed hierarchy of domains. A short hostname such as web1 names a machine; its fully qualified domain name identifies it within the full hierarchy.

Recognize what a record answers
RecordMeaning
AIPv4 address for a name
AAAAIPv6 address for a name
CNAMEAlias pointing to another name
MXMail server for a domain
PTRName obtained from an address in reverse lookup

DNS servers use port 53 over both UDP and TCP. A record's time to live (TTL) tells caches how long they may keep it, in seconds. A TTL of 3600 is one hour. Changing a record does not instantly remove the older answer from every cache.

The resolver is the client side of name lookup: library code and often a service such as systemd-resolved. Its configured nameservers are typically recursive resolvers operated by a router, provider, organization or public service. They find answers and cache them for clients.

Check the system's source order

Linux applications generally use the lookup sources configured by the hosts: line in /etc/nsswitch.conf. A simple example is:

hosts: files dns

Here files means /etc/hosts, checked before DNS. Other installations include sources such as resolve or mdns4_minimal. Read the actual line when comparing two systems.

/etc/hosts contains an address followed by its main name and optional aliases:

127.0.0.1 localhost
::1 localhost ip6-localhost
192.168.1.20 nas.home.arpa nas

With the shown lookup order, nas resolves to 192.168.1.20 on this computer. home.arpa is reserved for home networks. Hosts-file changes take effect without rebooting, but they affect only the machine whose file you edit. The file does not accept wildcards or port numbers: 192.168.1.20:8080 nas is invalid.

Use local entries deliberately

A hosts-file entry can name a device on a small network or point your computer to a replacement web server before public DNS changes. Mapping a name to 0.0.0.0 is also used to block it locally. Each use changes address lookup, not the service's port or configuration.

Suppose a website moves and works on other machines but not yours. An old /etc/hosts entry can keep sending your browser to its previous address even when DNS is correct. Compare the local entry with the current intended destination before changing network routes.

The machine's own hostname is a separate setting. hostname prints it; sudo hostnamectl set-hostname web1 changes it. /etc/hostname stores the configured name. Debian and Ubuntu commonly also map it in /etc/hosts, for example 127.0.1.1 web1. After a rename, update that mapping too. A mismatch can cause the warning "unable to resolve host web1" when using sudo. Changing your hostname does not create a public DNS record for it.

Key Takeaways

  • DNS record types answer different questions; A is IPv4 and AAAA is IPv6.
  • TTL controls cache lifetime, so old answers can persist after a change.
  • The hosts: line in nsswitch.conf controls the system’s lookup sources.
  • A hosts-file entry is local to one computer and contains no port number.
  • Keep the configured hostname and its local hosts-file mapping consistent.

5.2 Compare resolver settings with actual lookup results

Use a test that matches the question you are asking. A direct query checks a DNS server's answer. A system lookup checks the sources Linux applications normally use, which may include local files as well as DNS.

Read the resolver configuration

/etc/resolv.conf can contain nameserver 192.168.1.1 and search example.com. The nameserver line identifies a DNS server; the search suffix lets a short name such as web1 be tried as web1.example.com. The traditional resolver uses up to three configured nameservers, normally in order. Options can tune timeout and retry behavior.

This file is often generated by a network service. A comment or symlink reveals the owner. Changes made directly can disappear at the next network update, so change saved DNS values through NetworkManager, netplan or the active manager.

On a system using systemd-resolved, the file commonly links to /run/systemd/resolve/stub-resolv.conf and names 127.0.0.53. That is a local DNS stub, not an external server accidentally replaced with loopback. It forwards queries and caches answers. Use:

resolvectl status
resolvectl query example.com
resolvectl flush-caches

The first shows real upstream DNS servers, including per-interface settings. Flush the cache when you need to discard cached results while investigating a change.

Choose the lookup tool

host web1.example.com asks DNS for a name. host 203.0.113.10 performs a reverse lookup; host -t MX example.com requests mail records. dig example.com A +short prints a compact IPv4 answer, and dig @1.1.1.1 example.com A explicitly selects a DNS server. nslookup is an older DNS-query tool. The tools are commonly packaged as dnsutils or bind-utils.

getent hosts nas follows the system lookup order from /etc/nsswitch.conf, as most applications do. dig, host and nslookup do not read /etc/hosts themselves. However, querying systemd-resolved's stub can return an answer that the service obtains from that file. Select a known upstream server explicitly when you want to compare its DNS data with local lookup.

Interpret the result before changing settings

NXDOMAIN means the queried DNS server answered that the name does not exist. SERVFAIL means the server could not complete the lookup. A timeout means no usable reply arrived before the deadline. "Name or service not known" from a program is a system lookup error, not a DNS response code by itself.

Suppose ping to an external address succeeds, but lookup of example.com reports a temporary failure. Inspect the configured resolver and compare a direct query to it with a query to another known resolver. A valid answer from the second server narrows the problem toward the configured server, its path or local resolver settings. If both fail, distinguish actual error replies from timeouts before blaming a firewall. DNS traffic and ICMP ping are different traffic, even when they use the same network.

Key Takeaways

  • Generated resolv.conf settings should be changed through their network manager.
  • 127.0.0.53 normally names systemd-resolved’s local stub; resolvectl status reveals upstream servers.
  • Use getent for the system lookup path and dig @SERVER to query a chosen DNS server.
  • A DNS error reply, a timeout and a system lookup error carry different evidence.
6

Connect to remote systems securely with SSH

SSH gives you a remote shell, a way to run single commands and secure file transfer. A successful connection involves two identity checks: your client checks the server, and the server checks your account. Set up keys with those roles clear, then test server settings while you still have a working session. Reading connection errors and effective configuration helps you fix the correct stage without weakening the protection SSH provides.

6.1 Connect, verify the server and transfer files

SSH, Secure Shell, encrypts remote sessions and file transfers. The ssh client connects to sshd, normally on TCP port 22. OpenSSH is the usual Linux implementation. Older tools such as telnet and FTP expose passwords as plain text.

Verify and enter the remote session

Connect with ssh lee@web1.example.com; omit lee@ to use your local username. For a different port, use ssh -p 2222 lee@web1.example.com. Check the remote machine's identity before running commands; exit or Ctrl+D returns to the local shell.

On first contact, SSH displays a host-key fingerprint. Compare it through a trusted route with the server administrator or provider. The administrator can print it with ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub. Accepting it stores the key in your ~/.ssh/known_hosts file for later comparison.

A changed-host-key warning means the presented identity differs from the saved one. A rebuild or reused address can explain it, but so can an attacker. Verify the new fingerprint first. Once the change is confirmed, ssh-keygen -R 203.0.113.10 removes the old entry for that address so you can connect and record the new one.

Run a command without staying logged in
ssh lee@web1.example.com 'df -h /'

The command runs remotely, its output appears locally, and the connection ends. A following local pipe can process that output. Programs needing a terminal, including interactive sudo, can use ssh -t, for example ssh -t lee@web1.example.com sudo systemctl restart nginx.

Choose a transfer tool

scp report.pdf lee@web1.example.com:/home/lee/ uploads a file. scp lee@web1.example.com:/home/lee/results.csv . downloads into the current local directory. The colon marks the remote path; without it, lee@web1.example.com is a local filename. -r copies directories, and -P 2222 selects a port, with a capital P. Modern scp uses SFTP underneath.

sftp lee@web1.example.com opens an interactive session. Use get to download, put to upload, cd for the remote directory, lcd for the local one, and bye to finish. For repeated directory copies, rsync -av site/ lee@web1.example.com:/srv/site/ sends changes over SSH; rsync must be installed at both ends.

Store repeated connection details in ~/.ssh/config:

Host web1
    HostName 203.0.113.10
    User lee
    Port 2222
    IdentityFile ~/.ssh/id_ed25519

Then ssh web1 and scp notes.txt web1: use those settings.

Read the failure stage

"Connection refused" indicates an active rejection, commonly no listener on the chosen port. A timeout means no answer arrived; possible causes include routing, filtering or a down host. "Permission denied (publickey)" means the connection reached authentication but your account or offered key was not accepted. ssh -v shows progress through connection and authentication so you can investigate the stage that failed.

Key Takeaways

  • Verify the server fingerprint before trusting its first or changed host key.
  • known_hosts remembers server identities, not the keys allowed into your account.
  • Quoted remote commands run on the server; subsequent local pipes run on your client.
  • A colon marks an scp remote path; scp uses -P while ssh uses -p for ports.
  • Use sftp interactively and rsync for repeated changed-file transfers.
  • Distinguish rejection, timeout and authentication failures before troubleshooting.

6.2 Create a key pair and install the public key

Key login proves that your client holds a private key corresponding to an authorized public key. The client signs authentication data; it does not send the private key to the server. The two files therefore have different destinations and protection needs.

Generate and protect the pair

On your own computer:

ssh-keygen -t ed25519 -C "lee@laptop"

Choose a passphrase when prompted. The default files are ~/.ssh/id_ed25519, the private key, and ~/.ssh/id_ed25519.pub, the public key. The -C text is an identifying comment. Ed25519 has been ssh-keygen's default since OpenSSH 9.5; explicitly naming it makes the example clear. For an older server requiring RSA, ssh-keygen -t rsa -b 4096 generates a 4096-bit RSA key.

A passphrase encrypts the private key file. It protects the stored key if someone obtains the file; it is different from the remote account password. Automated jobs sometimes use keys without passphrases, with limited account rights. Keep the private key on the client and secret.

An SSH agent holds unlocked keys in memory so you do not reenter the passphrase for every connection. Desktop sessions commonly start an agent. Add the key with ssh-add ~/.ssh/id_ed25519 and enter its passphrase when requested.

Authorize the public key on one account
ssh-copy-id lee@web1.example.com

After authenticating to Lee's server account, the command appends a public key to that account's ~/.ssh/authorized_keys. If several client keys exist, ssh-copy-id -i ~/.ssh/id_ed25519.pub lee@web1.example.com explicitly selects the public key. Cloud provisioning can install it when the server is created.

Each authorized_keys line contains a key type, encoded public-key data and usually a comment. Several keys can authorize separate devices or people. A key in Lee's file grants access to Lee's account, not root's account. Removing its line revokes that key there; after a leak, remove its public key from every affected server.

Check ownership and permissions

On the server, in the intended account:

chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys

Keep the home directory from being writable by group or others. With normal strict checks, sshd rejects unsafe writable authorization files or parent directories. On the client, mode 600 protects the private key; overly open permissions can produce "UNPROTECTED PRIVATE KEY FILE!" The public .pub file can be readable at mode 644.

Confirm the login path

Open a fresh connection with ssh lee@web1.example.com. A passphrase prompt unlocks the local private key; an already loaded agent can make that unnecessary. In verbose output, look for successful authentication using "publickey."

If login fails, check the account name first, then its public-key entry, ownership and permissions, then the offered client key. ssh -i ~/.ssh/other_key lee@web1.example.com selects a particular private key; IdentityFile makes that selection part of a saved host configuration. Generating another key does not repair a missing authorization entry for the existing one.

Key Takeaways

  • Keep the private key secret on the client; install the public key in the intended server account.
  • A passphrase protects the stored private key; an agent holds an unlocked key in memory.
  • Use 700 for .ssh and 600 for authorized_keys and the client private key.
  • Authorization is per account; deleting a public-key line revokes that key there.
  • Check the account, authorized key, permissions and offered key when authentication fails.

6.3 Change SSH server settings without losing access

The server program is sshd, provided by openssh-server. Debian and Ubuntu call its systemd service ssh; Fedora, RHEL, openSUSE and Arch generally call it sshd. Use the name your distribution provides when checking status, enabling or reloading the service.

Locate the effective configuration

Install with sudo apt install openssh-server or sudo dnf install openssh-server. For a Fedora or RHEL service, sudo systemctl enable --now sshd starts it and enables startup at boot. systemctl status sshd reports its state.

The server reads /etc/ssh/sshd_config. /etc/ssh/ssh_config is for the client. Many systems include /etc/ssh/sshd_config.d/*.conf near the beginning of the server file. For most directives, the first value read wins. Appending a different value to the bottom of the main file may have no effect.

Use sudo sshd -T to print effective settings. If it shows passwordauthentication yes despite a later no, check included files. On an Ubuntu cloud image, 50-cloud-init.conf can supply the earlier value. An earlier applicable file such as 10-no-passwords.conf, or a change to the controlling setting, must be followed by validation and reload.

Require the intended authentication

After key login works, these settings establish key-only access:

PubkeyAuthentication yes
PasswordAuthentication no
KbdInteractiveAuthentication no
AuthenticationMethods publickey
PermitRootLogin no

The first enables keys. The next two disable password and keyboard-interactive methods, which can both accept passwords. AuthenticationMethods publickey explicitly requires public-key authentication. PermitRootLogin no blocks root SSH login; administrators log in as themselves and use sudo. The default prohibit-password is different: it still permits root key login. AllowUsers lee deploy can restrict which accounts may enter.

Apply and test safely

Keep the working session open, and confirm key login in a second terminal before removing password access. After editing:

sudo sshd -t
sudo systemctl reload sshd

Use reload ssh on Debian or Ubuntu. sshd -t prints nothing on a valid configuration; correct errors before reloading. A reload keeps existing sessions, so a new connection is the test of the changed policy. Keep the old session until that test succeeds.

Check access and logs

journalctl -u sshd or journalctl -u ssh shows attempts. Traditional log files include /var/log/auth.log on Debian/Ubuntu and /var/log/secure on RHEL. Repeated invalid-user password attempts are common on internet-facing servers; key-only access removes password guessing as a login route.

Permit the SSH service through the active firewall: Ubuntu's sudo ufw allow OpenSSH, or Fedora/RHEL's sudo firewall-cmd --permanent --add-service=ssh followed by sudo firewall-cmd --reload. A cloud provider's rule must also permit the listening port. Moving SSH to port 2222 can reduce scan noise, but keys, restricted login and OpenSSH updates provide the real protection.

Key Takeaways

  • Use the distribution’s service name: ssh on Debian/Ubuntu, usually sshd elsewhere.
  • Inspect effective settings with sshd -T; earlier included values can win.
  • Disable both password-capable methods and require publickey for key-only login.
  • Confirm keys, check syntax, reload and test a new connection while keeping a working session.
  • Read the server logs and check host and cloud access rules.

Linux Storage and Networking examples

6 Walkthroughs

1

Follow files through a Linux system

16 steps
Locate service files, reason about shared directories and links, then read live system information.
  1. 1
    IntroductionStart with the purpose of the path

    A small help-desk service keeps its program, settings and request history in different places (/usr, /etc and /var). Its administrator also uses a shared temporary directory and a shortcut to the current report, which is a symlink.

    Follow each path by asking two questions: what kind of data belongs here, and what kind of filesystem entry is this? The answers determine where you look and what a file operation will change, such as who may delete entries (the sticky bit).

  2. 2
    ExplanationSeparate program, settings and output

    The program itself normally belongs in /usr, its machine-wide settings in /etc, and its changing data in /var. A personal working copy belongs in a home directory.

    For an administrator's hand-installed helper, /usr/local/bin keeps it apart from packaged commands. A request history belongs under /var/log, where growing operational data is expected.

  3. 3
    ChallengePlace the service files

    A support service has three files: its packaged executable, its local configuration and a log that grows every day. Match them to /usr, /etc and /var.

    ---reveal---

    The executable belongs in /usr, the local settings in /etc, and the changing log in /var, normally /var/log. A name ending in .conf is a useful clue, but the file's purpose is the reason for its location.

  4. 4
    ExplanationChoose where temporary work lives

    A short conversion job can use /tmp. A longer job that must resume after rebooting needs /var/tmp. Neither is a permanent home for the final result.

    A memory-backed /tmp loses its files at shutdown, while cleanup rules can age out entries in either location. Use mktemp for a uniquely named private file and retain its printed path for later commands.

  5. 5
    ExampleRead the sticky permission

    The root-owned shared directory shows drwxrwxrwt. Everyone can create entries, but the final t changes who may remove or rename them.

    Jo creates a file with mode 644. Pat can read its contents because the file permits others to read. Pat cannot delete its entry: the sticky directory reserves that operation to the entry's owner, directory owner or root, with normal access checks.

  6. 6
    ChallengeChange privacy without changing deletion rules

    Jo wants the existing temporary file to stop being readable by Pat. The shared directory already has the sticky bit. What should Jo change?

    ---reveal---

    Change the file's own permissions, for example to mode 600. The sticky bit already restricts deletion and renaming; it does not remove the read permission in a mode-644 file. These two protections act on different operations.

  7. 7
    ExampleCreate a relative link

    The directory /home/jo/exports exists, and the report is /home/jo/today.txt. A link at /home/jo/exports/current should reach the report.

    Use ln -s ../today.txt /home/jo/exports/current. When following the stored target, start inside exports, move up to /home/jo, then read today.txt. The shell's working directory does not supply the starting point.

  8. 8
    ChallengeRepair a moved target

    Jo renames today.txt to ready.txt without moving the link at /home/jo/exports/current. What target should the recreated link store?

    ---reveal---

    Store ../ready.txt. The first .. still climbs from exports to Jo's home, but the final filename must match the new name. Changing the symlink's displayed permissions cannot fix its missing target path.

  9. 9
    ExplanationGive the file a second hard-linked name

    A hard link stores another name for the same file record, not a path to a preferred original name. ln ready.txt kept.txt makes the two names share an inode on that filesystem.

    Removing ready.txt leaves kept.txt usable. A symlink storing ready.txt would become dangling instead. A hard link cannot name a directory or cross to another filesystem.

  10. 10
    TipRemove the entry you intend

    For a symlink pointing to a directory, use its name without a trailing slash: rm current or unlink current. The target directory stays.

    A trailing slash asks commands to follow the directory target. A recursive removal can then reach files inside that target, so the exact path spelling matters. Inspect the arrow with ls -l or read the stored target with readlink when uncertain.

  11. 11
    ExplanationRecognize devices before opening them

    A listing beginning with b describes a block device such as a disk partition. A leading c identifies a character device such as a terminal. Regular files begin with -, regardless of whether their contents are text or binary.

    The major and minor numbers in a device listing identify the driver and device. They occupy the position where a regular file would show its length.

  12. 12
    ExampleRead live uptime

    cat /proc/uptime returns 259200.0 710000.0. The first value is elapsed seconds since boot: dividing by 3600 gives 72 hours, or three days.

    The second value adds processor idle time, so it can be larger than wall-clock uptime. This text comes from the running kernel; it is not an ordinary log saved to disk each second.

  13. 13
    ChallengeExplain a zero-size information file

    A trainee sees size 0 for an entry under /proc and assumes it cannot contain useful information. Reading it returns several lines. How can both observations be correct?

    ---reveal---

    The kernel generates the information on request. The listing's size is not the stored length of an ordinary disk file, so zero there does not predict an empty read. Use the entry's documented role to interpret its returned text.

  14. 14
    ConnectionRead an interface through sysfs

    ls /sys/class/net/ lists the interfaces known to the kernel. Reading /sys/class/net/enp0s3/address returns that Ethernet interface's MAC address.

    This connects a familiar pathname to live hardware information. /proc emphasizes process and system data, while /sys organizes devices, drivers and buses. Their contents are recreated by the running system.

  15. 15
    ChallengeKeep access after a file name disappears

    A report is in a root-owned sticky shared directory. Jo owns it; Pat can read it but cannot rename it. A symlink elsewhere stores its path. Jo removes that report name, but a hard link remains on the same filesystem. Which remaining name still opens the report, and why?

    ---reveal---

    The hard-linked name still opens it because it names the same file record. The symlink becomes dangling because its stored path disappeared. Sticky protection controls who may remove the original entry, not whether another name survives.

  16. 16
    RecapUse purpose, permissions and entry type

    Locate the file by its purpose, read its type and permissions, then follow any link from the correct directory. For live system data, inspect /proc and /sys. For shared temporary work, choose both a lifetime and file privacy; sticky protection handles a separate deletion rule.

2

Attach an optional archive drive

14 steps
Identify an existing filesystem, mount it, and build a tested boot entry using its lasting identifier.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionBegin with an existing data drive
  2. 2
    ExampleRead the device tree
  3. 3
    ExplanationDo not confuse inspection with preparation
  4. 4
    ChallengeChoose the correct source
  5. 5
    ExampleCreate and attach the directory
  6. 6
    TipChoose a restricted inspection mount
  7. 7
    ChallengeResolve a busy unmount
  8. 8
    ExplanationRecord identity instead of detection order
  9. 9
    ExampleBuild the six-field rule
  10. 10
    ExampleVerify the rule before rebooting
  11. 11
    ChallengeDistinguish nofail from noauto
  12. 12
    ConnectionApply ownership to the mounted filesystem
  13. 13
    ChallengeRepair after reformatting
  14. 14
    RecapConfirm each layer
3

Find why a server cannot create files

10 steps
Use space and inode reports, follow directory growth, and explain storage that remains after deletion.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionStart with the failing path
  2. 2
    ExampleRead the containing filesystem
  3. 3
    ExampleCheck the inode supply
  4. 4
    ChallengeChoose cleanup for the missing resource
  5. 5
    ExampleFind the growing directory
  6. 6
    TipInclude hidden storage
  7. 7
    ExplanationFollow a deleted log’s remaining reference
  8. 8
    ChallengeExplain the unchanged free-space report
  9. 9
    ChallengeCheck the result of journal cleanup
  10. 10
    RecapMeasure the resource you repaired
4

Trace a connection from interface to service

15 steps
Read an interface and route, test a temporary change, then diagnose a service that works only locally.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionSeparate the connection’s parts
  2. 2
    ExplanationRead the local network from the prefix
  3. 3
    ChallengeDecide whether a destination is local
  4. 4
    ConnectionRecognize IPv6’s separate address and router roles
  5. 5
    ExampleInspect the short address view
  6. 6
    ExampleRead the route chosen for the destination
  7. 7
    ChallengeFind the router without guessing
  8. 8
    ExampleAdd a complete temporary address
  9. 9
    TipProtect access while applying saved settings
  10. 10
    ChallengeExplain a setting that vanished
  11. 11
    ExplanationRead a ping result precisely
  12. 12
    ExampleInspect a local-only listener
  13. 13
    ChallengeCombine route and service evidence
  14. 14
    ConnectionTest the intended application
  15. 15
    RecapChoose the next test from the result
5

Explain why one computer resolves an old address

11 steps
Compare local mappings, a local DNS stub and an explicit DNS query without mixing up their results.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionA name works differently on two machines
  2. 2
    ExplanationFollow the system lookup order
  3. 3
    ExampleFind the stale local mapping
  4. 4
    ChallengePredict the scope of a local edit
  5. 5
    ConnectionAllow for cached DNS answers
  6. 6
    ExplanationRecognize the local stub
  7. 7
    ExampleCompare two deliberate lookup paths
  8. 8
    ChallengeInterpret a negative reply
  9. 9
    ExplanationDistinguish failure messages
  10. 10
    ChallengeExplain apparently matching tests
  11. 11
    RecapCompare sources before changing settings
6

Set up and verify key-only remote access

17 steps
Verify server identity, authorize a user key, then validate a policy change while preserving recovery access.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionKeep server and user identity separate
  2. 2
    ExampleVerify the first connection
  3. 3
    ChallengeRespond to a changed host key
  4. 4
    ExampleRun one remote command
  5. 5
    TipKeep transfer direction visible
  6. 6
    ExampleCreate the pair on the client
  7. 7
    ExampleInstall only the public key
  8. 8
    TipProtect files and use the agent
  9. 9
    ChallengeFix an account mismatch
  10. 10
    ExplanationRead the server’s controlling settings
  11. 11
    ExampleRequire public-key authentication
  12. 12
    ChallengeExplain the root-login distinction
  13. 13
    ExampleValidate, reload and open a new session
  14. 14
    ConnectionRead where the connection stopped
  15. 15
    ChallengeFind why a late setting lost
  16. 16
    ChallengeRevoke a lost device’s access
  17. 17
    RecapTest the new login path

Linux Storage and Networking practice questions

60 Practice Questions in 6 sets

Set 1: Identify storage and make reliable mounts10 Practice Questions

Question 1 of 10

An optional backup drive is often unplugged. Which fstab option lets boot continue when it is missing?
  1. noexec
  2. ro
  3. nofail
  4. user
Show answerHide answer
Answer: C
nofail allows boot to continue without the optional source device. noexec controls direct execution of files after mounting and does not make a missing drive optional. Read-only access and ordinary-user mounting also concern different mount behavior, so neither addresses this startup requirement.

Question 2 of 10

What does /dev/nvme1n1p3 identify?
  1. NVMe device 3 with its first partition mounted.
  2. Partition 1 of SATA device /dev/nvme3n1.
  3. A filesystem mounted at directory /dev/nvme1.
  4. Partition 3 of NVMe device /dev/nvme1n1.
Show answerHide answer
Answer: D
The p3 suffix identifies partition 3; the parent device is /dev/nvme1n1. The device name does not identify its filesystem type or mount point. Reading the final digit as a drive number would confuse the partition with the whole NVMe namespace and could lead to choosing the wrong target.

Question 3 of 10

A removable drive uses GPT and has a vfat partition. Copying one 6 GiB file fails although 20 GiB is free. What explains the failure?
  1. FAT32 cannot hold a file of that size.
  2. GPT limits each partition file to 4 GiB.
  3. The partition is too small for any new file.
  4. The binary size display hides the used space.
Show answerHide answer
Answer: A
Linux's vfat type includes FAT32, whose single-file limit is below 4 GiB, so the 6 GiB file cannot fit as one file. Available total space does not remove that per-file limit. GPT describes partition boundaries and is not the component imposing this filesystem file-size limit.

Question 4 of 10

An ext4 partition is identified as /dev/vdc1, and /mnt/archive already exists. Which command attaches it there?
  1. sudo mount /mnt/archive /dev/vdc1
  2. sudo umount /dev/vdc1 /mnt/archive
  3. sudo mount /dev/vdc1 /mnt/archive
  4. sudo mkfs.ext4 /mnt/archive /dev/vdc1
Show answerHide answer
Answer: C
mount takes the source device followed by the target directory. Reversing them treats a directory as the source and a device path as the mount point. mkfs.ext4 creates a filesystem and can destroy existing data; it is not how you attach an already prepared filesystem to the tree.

Question 5 of 10

/mnt/store/local.txt was present before you mounted a drive on /mnt/store. It is now absent from the listing. What happens after a successful unmount?
  1. The file is copied back from the drive.
  2. The earlier file becomes visible again.
  3. The file remains deleted from both locations.
  4. The file moves into the drive’s root directory.
Show answerHide answer
Answer: B
Mounting hides the directory's prior contents beneath the attached filesystem. Unmounting reveals those existing entries again; it does not restore a backup or copy files between filesystems. Assuming the missing listing means deletion confuses the visible mounted view with the underlying directory.

Question 6 of 10

A data drive changes from /dev/sdc1 to /dev/sdd1 after another drive is added. What fstab source best avoids this detection-order problem?
  1. The data filesystem’s UUID.
  2. The new /dev/sdd1 path.
  3. The drive’s current mount-point name.
  4. The filesystem type name ext4.
Show answerHide answer
Answer: A
A filesystem UUID remains attached to that filesystem when kernel device names change. Replacing the old path with today's /dev/sdd1 may work now but leaves the same future detection-order problem. The type and mount directory describe other fields of fstab and do not uniquely identify the source filesystem.

Question 7 of 10

A mounted USB filesystem will not unmount. Your shell is currently inside /mnt/usb, and no other process uses it. What should you do?
  1. Change file permissions, then retry umount.
  2. Format the partition, then retry umount.
  3. Delete the mount point, then retry umount.
  4. Leave the directory, then retry umount.
Show answerHide answer
Answer: D
The shell's current directory keeps the filesystem busy. Change to a directory outside the mount, then retry umount to release it cleanly. Changing file permissions does not remove that reference, while formatting the partition would destroy data without solving the reason your shell is using the mount.

Question 8 of 10

A drive holds 64,000,000,000 bytes. Why does a binary-unit size display show about 59.6G?
  1. Its partition table necessarily consumes 4.4 GB.
  2. Each displayed G represents more than a decimal GB.
  3. Its filesystem reserves exactly 4.4 GB for root.
  4. The drive has lost capacity since manufacture.
Show answerHide answer
Answer: B
The display divides bytes by 1,073,741,824 per GiB, producing about 59.6G. The manufacturer divides by 1,000,000,000 per GB. The difference follows from unit size, so it cannot be assigned to reserved filesystem blocks or partition metadata simply by subtracting the displayed numbers.

Question 9 of 10

You add a new fstab entry with noauto, reload systemd and run mount -a. The mount is absent. What is the next appropriate test?
  1. Remove its UUID and use the filesystem type as source.
  2. Reboot immediately to force noauto to take effect.
  3. Mount its fstab target explicitly and inspect it.
  4. Run mount -a again until the filesystem appears.
Show answerHide answer
Answer: C
mount -a intentionally skips noauto entries, so it has not tested this mount. Run a command such as sudo mount /archive, then inspect that target with findmnt. Repeating the same automatic-mount command will still skip it; the absence alone does not show that the UUID is wrong.

Question 10 of 10

An existing ext4 drive has a correct fstab entry using noauto,nofail at /mnt/test. It is now connected, but mount -a leaves the drive absent and an older local file visible there. How can you view the drive while preserving that local file?
  1. Remove nofail and reboot; the local file is then copied onto the drive.
  2. Mount /mnt/test explicitly; the local file is hidden until unmounting.
  3. Format the drive and mount again; the local file becomes its first entry.
  4. Run mount -a again; the local file becomes visible on both filesystems.
Show answerHide answer
Answer: B
noauto makes mount -a skip the entry, so explicitly mount its target. Attaching the existing filesystem hides the earlier directory contents until unmounting; it does not erase or copy them. Removing nofail does not cancel noauto, and formatting would destroy the drive’s existing filesystem.
Set 2: Find files and understand special entries10 Practice Questions

Save this lesson to see every answer and practice every set.

Question 1 of 10

A symlink at /home/ren/archive/current stores ../draft.txt. Which path does it target?
  1. /home/ren/archive/draft.txt
  2. /home/draft.txt
  3. /home/ren/current/draft.txt
  4. /home/ren/draft.txt
Show answerHide answer

Save this lesson to see this answer.

Question 2 of 10

A listing begins brw-rw----. What kind of entry is it?
  1. A broken symlink.
  2. A binary file.
  3. A character device.
  4. A block device.
Show answerHide answer

Save this lesson to see this answer.

Question 3 of 10

You install a command by hand for all users. Where should its executable normally go?
  1. /usr/share/doc
  2. /usr/local/bin
  3. /var/lib/local
  4. /etc/local/bin
Show answerHide answer

Save this lesson to see this answer.

Question 4 of 10

A service writes a growing request history. Which directory normally holds that kind of data?
  1. /usr/lib
  2. /etc/log
  3. /var/log
  4. /boot/log
Show answerHide answer

Save this lesson to see this answer.

Question 5 of 10

A root-owned directory has mode 1777. Eva owns a file there with mode 644. Omar is an ordinary user who is neither owner. What can Omar do?
  1. Read the file but not delete its entry.
  2. Delete its entry but not read the file.
  3. Read the file and delete its entry.
  4. Neither read the file nor list its name.
Show answerHide answer

Save this lesson to see this answer.

Question 6 of 10

In one directory, copy.txt is a hard link to source.txt, and alias.txt is a symlink storing source.txt. After source.txt is removed, what remains readable?
  1. alias.txt only.
  2. copy.txt only.
  3. Both remaining names.
  4. Neither remaining name.
Show answerHide answer

Save this lesson to see this answer.

Question 7 of 10

A temporary job must resume after a reboot. Which location suits its intermediate files?
  1. /var/tmp
  2. /run
  3. /proc/tmp
  4. /tmp
Show answerHide answer

Save this lesson to see this answer.

Question 8 of 10

A packaged service update replaced your edit under /usr/lib/systemd/system. Where should a supported local override be placed?
  1. Under /var/log/systemd.
  2. Under /usr/share/systemd.
  3. Under /etc/systemd/system.
  4. Under /run/media/systemd.
Show answerHide answer

Save this lesson to see this answer.

Question 9 of 10

ls -l shows a /proc entry with size 0, yet cat prints current information. Why?
  1. The kernel generates its contents when read.
  2. The file is empty but cat retrieves its backup.
  3. The text is stored in a hidden disk partition.
  4. The listed size is measured in whole gigabytes.
Show answerHide answer

Save this lesson to see this answer.

Question 10 of 10

A symlink at /home/eli/links/active stores ../work.txt. The target file moves to /data/notes/final.txt on another filesystem. What link type and relative target restore access through the unchanged link name?
  1. A symlink storing ../../data/notes/final.txt.
  2. A symlink storing ../../../data/notes/final.txt.
  3. A hard link to the file /data/notes/final.txt.
  4. A symlink storing ../data/notes/final.txt.
Show answerHide answer

Save this lesson to see this answer.

Set 3: Diagnose full filesystems and unexpected totals10 Practice Questions

Save this lesson to see every answer and practice every set.

Question 1 of 10

A simplified df report shows 24G used and 16G available. What Use% follows GNU df’s rule?
  1. 40%.
  2. 67%.
  3. 75%.
  4. 60%.
Show answerHide answer

Save this lesson to see this answer.

Question 2 of 10

You need the free space of the filesystem holding /srv/uploads. What command gives that report?
  1. df -h /srv/uploads
  2. du -sh /srv/uploads
  3. lsblk /srv/uploads
  4. free -h /srv/uploads
Show answerHide answer

Save this lesson to see this answer.

Question 3 of 10

New files fail on an ext4 filesystem. df -h shows 18G available, but df -i shows IFree as 0. What cleanup best addresses the fault?
  1. Remove one large hard-linked file.
  2. Move one large file inside its directory.
  3. Remove many unwanted tiny cache files.
  4. Increase memory for running programs.
Show answerHide answer

Save this lesson to see this answer.

Question 4 of 10

A home directory is large, but du -sh * accounts for little of it. Which command includes its hidden subdirectories?
  1. du -sh ~/* | sort -h
  2. ls -lhS ~/* | sort -h
  3. df -h ~/* | sort -h
  4. du -h -d 1 ~ | sort -h
Show answerHide answer

Save this lesson to see this answer.

Question 5 of 10

You want one total for /var/cache, including its contents. What command should you use?
  1. sudo df -h /var/cache
  2. sudo du -sh /var/cache
  3. sudo ls -ld /var/cache
  4. sudo findmnt /var/cache
Show answerHide answer

Save this lesson to see this answer.

Question 6 of 10

A deleted log still appears in lsof +L1, held open by its service. Why has df not gained its space?
  1. The deleted name now occupies the same space in trash.
  2. The open file still holds its allocated storage.
  3. The df report waits for the next scheduled disk scan.
  4. The inode is free but all its blocks are reserved for root.
Show answerHide answer

Save this lesson to see this answer.

Question 7 of 10

A sparse image has logical length 30 GiB but only 2 GiB allocated. Which measurements fit?
  1. ls reports about 30 GiB; du reports about 2 GiB.
  2. ls reports about 2 GiB; du reports about 30 GiB.
  3. Both tools must report about 30 GiB for the image.
  4. Both tools must report about 2 GiB for the image.
Show answerHide answer

Save this lesson to see this answer.

Question 8 of 10

You reformatted an optional data partition, and its old UUID remains in fstab. What must change before testing the mount?
  1. Keep the UUID and change only the dump flag.
  2. Keep the UUID and set the check order to zero.
  3. Replace the source with the new filesystem UUID.
  4. Replace the mount point with the old UUID text.
Show answerHide answer

Save this lesson to see this answer.

Question 9 of 10

A sparse image has a logical length of 36 GiB and uses 3 GiB of allocated blocks. It has two hard-linked names, and a process holds it open. Both names are removed. Ignoring small metadata changes, how much space can df recover before and after the last open reference closes?
  1. About 0 GiB before closing, then about 3 GiB.
  2. About 3 GiB before closing, then no further space.
  3. About 0 GiB before closing, then about 36 GiB.
  4. About 36 GiB before closing, then no further space.
Show answerHide answer

Save this lesson to see this answer.

Question 10 of 10

Root df usage is 11G higher than a complete privileged du scan. lsof +L1 is empty. A separate drive is mounted over /srv/data, which held large files beforehand. What explains the gap?
  1. The mounted drive’s capacity is counted as root file data.
  2. The deleted-open files are still listed by their old names.
  3. Unused reserved blocks are reported as Used file data.
  4. Earlier root files are hidden beneath the data mount.
Show answerHide answer

Save this lesson to see this answer.

Set 4: Read network state and locate connection faults10 Practice Questions

Save this lesson to see every answer and practice every set.

Question 1 of 10

What does /24 in an IPv4 address specify?
  1. The number of usable host addresses.
  2. The final byte of the default gateway.
  3. The number of leading network bits.
  4. The service port used by this interface.
Show answerHide answer

Save this lesson to see this answer.

Question 2 of 10

An interface shows inet 192.168.8.44/24 brd 192.168.8.255. What information still requires route output?
  1. The interface’s configured IPv4 address.
  2. The default gateway for off-network traffic.
  3. The broadcast address for its local network.
  4. The number of leading network-prefix bits.
Show answerHide answer

Save this lesson to see this answer.

Question 3 of 10

ss shows a TCP listener at 127.0.0.1:8080. Who can connect to that listening address?
  1. Any device on the local network.
  2. Only the local default gateway.
  3. Any host that knows its DNS name.
  4. Programs on that same machine.
Show answerHide answer

Save this lesson to see this answer.

Question 4 of 10

A temporary address added with ip disappears after reboot. How should you make the intended address last?
  1. Save it through the active network manager.
  2. Repeat the ip command without a prefix.
  3. Add the address to /etc/hosts only.
  4. Change the interface’s MAC address to match.
Show answerHide answer

Save this lesson to see this answer.

Question 5 of 10

A host is 192.168.12.70/26 with a suitable connected route. Which destination is on its same subnet?
  1. 192.168.12.20
  2. 192.168.12.130
  3. 192.168.12.100
  4. 192.168.13.70
Show answerHide answer

Save this lesson to see this answer.

Question 6 of 10

Ping prints the resolved address for portal.example.com but receives no echo replies. What should you investigate next?
  1. A guaranteed failure to resolve the name.
  2. Reachability or filtering of ICMP replies.
  3. A missing entry in the local hostname file.
  4. An automatic need to replace the DNS record.
Show answerHide answer

Save this lesson to see this answer.

Question 7 of 10

An IPv6 host receives an address and DNS servers through DHCPv6. What supplies its default-router information?
  1. IPv6 router advertisements.
  2. DHCPv6 default-gateway option.
  3. The resolver in resolv.conf.
  4. The DHCPv4 lease’s gateway.
Show answerHide answer

Save this lesson to see this answer.

Question 8 of 10

On a console, you add 192.168.90.25 without a prefix to a previously unaddressed interface and bring it up. A peer is 192.168.90.30/24; no other routes exist. Why can the local host not reach the peer normally?
  1. Its default route is missing, which every same-subnet exchange requires.
  2. Its peer has the wrong /24 prefix; both endpoints must use /32 instead.
  3. Its peer lacks a return route because the sender has a /32 address.
  4. Its local subnet route is missing because the new address received /32.
Show answerHide answer

Save this lesson to see this answer.

Question 9 of 10

A client has only a connected 192.168.6.0/24 route. Its intended server is 192.168.7.40. On that server, the web service works locally but listens only on 127.0.0.1:80. What pair of repairs addresses both demonstrated barriers?
  1. Provide client DNS only and retain the server’s loopback-only listener.
  2. Provide a route from the client and a network-facing server listener.
  3. Remove the client’s connected route and retain the server’s current listener.
  4. Retain the client’s routes and make public DNS return the loopback address.
Show answerHide answer

Save this lesson to see this answer.

Question 10 of 10

A host has 192.168.55.130/26 and reaches same-subnet peers. Its saved profile selects gateway 192.168.55.1, but the intended local router is 192.168.55.129. No other routes apply. What lasting correction fits the addressing?
  1. Keep gateway 192.168.55.1 and replace the host’s prefix with /32.
  2. Add 192.168.55.129 to the hosts file and keep the saved gateway unchanged.
  3. Save gateway 192.168.55.129 in the active network profile and apply it.
  4. Temporarily add gateway 192.168.55.129 with ip and leave the profile unchanged.
Show answerHide answer

Save this lesson to see this answer.

Set 5: Compare DNS paths and remote connection evidence10 Practice Questions

Save this lesson to see every answer and practice every set.

Question 1 of 10

Which DNS record type supplies an IPv6 address for a name?
  1. A.
  2. AAAA.
  3. PTR.
  4. CNAME.
Show answerHide answer

Save this lesson to see this answer.

Question 2 of 10

resolv.conf names 127.0.0.53 on a system using systemd-resolved. How can you see the real upstream DNS servers?
  1. Replace the stub with 127.0.0.1.
  2. Run hostnamectl set-hostname.
  3. Read the default route’s broadcast field.
  4. Run resolvectl status.
Show answerHide answer

Save this lesson to see this answer.

Question 3 of 10

A record had TTL 1800 when cached. It changes 5 minutes later. Why might a client still receive the old address immediately afterward?
  1. The earlier cached answer can still be within its TTL.
  2. The record must remain unchanged until the next reboot.
  3. The client must use a CNAME for any changed address.
  4. The TTL tells DNS to keep the old address permanently.
Show answerHide answer

Save this lesson to see this answer.

Question 4 of 10

An SSH client reaches Permission denied (publickey). At what stage did this attempt fail?
  1. IP address routing.
  2. TCP port connection.
  3. User authentication.
  4. File content transfer.
Show answerHide answer

Save this lesson to see this answer.

Question 5 of 10

Lookup order is files dns. A local hosts entry maps docs.example.com to an old address. A query to the explicitly selected authoritative DNS server returns the new address. Which comparison explains an application’s old destination?
  1. getent ignores the local mapping while the direct query loads it first.
  2. Both tests must return the DNS answer because its TTL is shorter.
  3. getent follows the local mapping while that direct DNS query bypasses it.
  4. The direct query updates /etc/hosts and repairs later application lookups.
Show answerHide answer

Save this lesson to see this answer.

Question 6 of 10

A query to the configured DNS server returns NXDOMAIN. What distinguishes this result from a timeout?
  1. The server replied that the queried name does not exist.
  2. The query received no reply before its time limit.
  3. The server supplied an address but the host blocked ping.
  4. The client could not start because its interface was down.
Show answerHide answer

Save this lesson to see this answer.

Question 7 of 10

External IP tests work. A direct DNS query to the configured server returns SERVFAIL for a name, while another known resolver returns an address. What is the strongest supported conclusion?
  1. All DNS traffic is blocked by the local firewall.
  2. The host has no functioning default route anywhere.
  3. The name does not exist on any DNS server.
  4. Investigate the configured resolver’s failure for this name.
Show answerHide answer

Save this lesson to see this answer.

Question 8 of 10

SSH by address times out. The server console shows sshd listening on 0.0.0.0:22, a suitable address and route. What evidence should be checked next before changing user keys?
  1. The authorized_keys comment used to label the client key.
  2. Host and cloud filtering rules for the client’s path to port 22.
  3. The target user’s shell history and its saved commands.
  4. The server’s DNS search suffix for its own short name.
Show answerHide answer

Save this lesson to see this answer.

Question 9 of 10

You rename a Debian machine with hostnamectl. Sudo then warns that it cannot resolve the new local name. What local setting should you compare?
  1. The SSH port stored in known_hosts.
  2. The filesystem UUID in /etc/fstab.
  3. The IPv6 compression in /proc/uptime.
  4. The hostname mapping in /etc/hosts.
Show answerHide answer

Save this lesson to see this answer.

Question 10 of 10

A hosts entry exists for vault.home.arpa. dig without an explicit server and getent hosts both return it; resolv.conf points to the resolved stub. Why is this consistent?
  1. The stub can answer DNS queries using its hosts-file data.
  2. Dig directly parses every file named in nsswitch.conf.
  3. The hosts entry was automatically published to public DNS.
  4. Getent always skips local files when the stub is enabled.
Show answerHide answer

Save this lesson to see this answer.

Set 6: Set up SSH keys and diagnose access safely10 Practice Questions

Save this lesson to see every answer and practice every set.

Question 1 of 10

Which key file should be installed in the remote account’s authorized_keys?
  1. The client’s private key.
  2. The server’s private key.
  3. The saved host fingerprints.
  4. The client’s public key.
Show answerHide answer

Save this lesson to see this answer.

Question 2 of 10

An scp upload must use port 2207. Which command has the right port flag and remote-path syntax?
  1. scp -P 2207 log.txt aya@node.example.com/home/aya/
  2. scp -P 2207 aya@node.example.com:/home/aya/log.txt .
  3. scp -P 2207 log.txt aya@node.example.com:/home/aya/
  4. scp -P 2207 log.txt /home/aya/
Show answerHide answer

Save this lesson to see this answer.

Question 3 of 10

The correct public key is installed for user deploy, but you connect as root with that key and receive permission denied. What should you try first?
  1. Copy the private key into root’s home directory.
  2. Connect as deploy with the same client key.
  3. Delete the server identity from known_hosts.
  4. Change the public key file to mode 777.
Show answerHide answer

Save this lesson to see this answer.

Question 4 of 10

A global included file sets PasswordAuthentication yes before the main file later sets it to no. There are no Match blocks. After reload, password logins still work. What should you inspect and correct?
  1. The effective setting and its first controlling occurrence.
  2. The client’s known_hosts permissions and stored comment.
  3. The main file’s final line by adding the same no value again.
  4. The listening address by replacing all IPv4 addresses with loopback.
Show answerHide answer

Save this lesson to see this answer.

Question 5 of 10

A rebuilt server presents a new host key. The administrator supplies its fingerprint through a trusted channel. What sequence restores trusted access?
  1. Remove the old entry, then accept any key offered on reconnect.
  2. Copy your private user key to the server, then reconnect.
  3. Disable host-key checking, then confirm the password still works.
  4. Compare the fingerprint, then remove the old entry and reconnect.
Show answerHide answer

Save this lesson to see this answer.

Question 6 of 10

Key login fails for the correct account. Its public key is installed, sshd uses strict permission checks, and the server’s .ssh directory is writable by every user. The client offers the matching key. What repair fits the evidence?
  1. Make client known_hosts writable by everyone and retry the connection.
  2. Generate a new key and keep the same writable authorization directory.
  3. Restrict server .ssh to 700 and check its ownership and parent path.
  4. Change the server’s default route while keeping its permissions open.
Show answerHide answer

Save this lesson to see this answer.

Question 7 of 10

Which test checks sshd configuration syntax before you reload the service?
  1. sudo sshd -t
  2. sudo systemctl reload sshd
  3. sudo ssh -v node.example.com
  4. sudo systemctl enable sshd
Show answerHide answer

Save this lesson to see this answer.

Question 8 of 10

Keys already work. The effective server configuration disables PasswordAuthentication but leaves KbdInteractiveAuthentication enabled and has no AuthenticationMethods restriction. Policy requires public-key login only. What change completes that policy?
  1. Keep keyboard-interactive and move the listener to a different port.
  2. Disable keyboard-interactive and require publickey authentication.
  3. Enable password authentication and restrict the root account alone.
  4. Keep the methods unchanged and remove user keys after logging in.
Show answerHide answer

Save this lesson to see this answer.

Question 9 of 10

A lost laptop key authorizes account A on server One and account B on server Two. Both accounts also authorize a separate CI key that must keep working. How should you revoke only the lost laptop while preserving CI access and server trust records?
  1. Delete both accounts’ entire authorized_keys files; retain the CI private key and known_hosts.
  2. Remove the laptop’s public-key line from both accounts; retain the CI lines and known_hosts.
  3. Remove the laptop’s line only on server One; replace server Two’s stored host fingerprint.
  4. Keep both authorized_keys files; remove the laptop’s server identities from known_hosts.
Show answerHide answer

Save this lesson to see this answer.

Question 10 of 10

An existing SSH session survives a reload after login restrictions change. You have not opened another connection. What must happen before you close the working session?
  1. Test a fresh login under the new effective settings.
  2. Treat the surviving session as proof new logins work.
  3. Restart networking so the old session reconnects.
  4. Delete the authorized key and see if the session ends.
Show answerHide answer

Save this lesson to see this answer.

Stuck on your own question? Homework Help

Key Terms

94 Key Terms, each with its definition

A

Application state
Application state is data a program keeps between runs, such as databases and package records, commonly stored under /var/lib.
A large directory under /var/lib may contain a live database, so inspect its owner before cleanup.
Archived journal
An archived journal is a journal file no longer active for new entries, making it eligible for journal vacuum retention cleanup.
A vacuum size limit can leave overall journal storage higher because active files remain.
authorized_keys
The authorized_keys file lists public keys permitted to log in to one server account, usually one authorized key on each line.
Removing a leaked device’s key from one account does not revoke its access on another server.
Available space
Available space is the filesystem storage ordinary users can still allocate, excluding resources such as unused ext4 reserved blocks.
The Avail column can be smaller than total size minus used space on an ext4 filesystem.

B

Block device
A block device is a kernel interface for storage accessed in addressable blocks, represented by a path such as /dev/sda1.
The b at the start of a device listing distinguishes a disk partition from a regular file.
Broadcast address
An IPv4 broadcast address targets the local subnet’s hosts as a group and is normally the final address in an ordinary subnet.
The brd value in ip addr is not the router address to enter as your default gateway.

C

Character device
A character device is a kernel interface that presents a stream of bytes, such as a terminal or the discard device /dev/null.
Redirecting standard error to /dev/null discards those bytes without hiding normal output.

D

Dangling link
A dangling link is a symbolic link whose stored target path cannot be reached, often because the target was moved or deleted.
readlink lets you inspect the stored path when opening a broken shortcut fails.
Default gateway
A default gateway is the next-hop router used by a default route for destinations without a more specific matching route.
A host may reach its local peer yet lack any route through a gateway to external networks.
Deleted open file
A deleted open file has lost its directory name but remains held by a running process, so its storage cannot yet be fully reclaimed.
lsof +L1 can identify a removed live log that still keeps a filesystem full.
DHCP
DHCP for IPv4 leases network configuration to hosts, including an address, prefix, default gateway and DNS-server information.
A dynamically assigned IPv4 address can show a remaining lease lifetime in ip addr output.
Disk
A disk is a physical or virtual storage device that Linux exposes as a block device and that can contain one or more partitions.
An NVMe drive can hold separate partitions for startup files and the root filesystem.
Disk usage
Disk usage is allocated storage consumed by files and directories, which du totals through the parts of the tree it can reach.
Use sudo du -h -d 1 /var to compare large directories after identifying the full filesystem.
DNS
The Domain Name System is a distributed hierarchical database that supplies records for names, including addresses and mail-server information.
An application can resolve a full domain name before opening a connection to its returned address.
DNS timeout
A DNS timeout occurs when no usable response arrives within the query’s waiting period, leaving server and network-path causes to investigate.
A timeout differs from NXDOMAIN because the latter is an actual negative answer from a server.

E

Effective configuration
An effective configuration is the set of settings a service actually derives after reading defaults and all applicable configuration files.
The output of sshd -T helps check which value won when settings appear in several files.

F

Filesystem
A filesystem organizes files and directories within storage and determines features such as file-size limits and ownership support.
A FAT32 partition can have free space yet reject a single file that reaches 4 GiB.
Filesystem check order
The filesystem check order is fstab’s sixth field, normally 1 for root, 2 for other checked filesystems and 0 to skip a check.
An ext4 data entry commonly ends in 0 2: no dump backup flag, then a non-root check order.
Filesystem Hierarchy Standard
The Filesystem Hierarchy Standard describes the usual locations for Linux software, configuration, user files and changing data.
The standard helps you predict that a service’s changing logs belong under /var/log.
Fingerprint
A key fingerprint is a compact representation of a public key used for checking whether two views of a server or user key match.
A verified fingerprint lets you distinguish a legitimate replacement host key from an unknown one.
fstab
The fstab file is the system table of filesystem mounts and swap areas, using six fields per entry to describe startup behavior.
A new data filesystem needs an entry in /etc/fstab if it should mount again at boot.
Fully qualified domain name
A fully qualified domain name identifies a name within the complete DNS hierarchy, such as web1.example.com, rather than a short local name.
Using the full name avoids relying on a local search suffix to complete the hostname.

G

Gibibyte
A gibibyte is a binary storage unit containing 1,073,741,824 bytes, commonly shown as G by Linux human-readable storage tools.
A drive advertised in decimal GB shows a smaller numeric value when lsblk displays GiB.
GPT
GPT is a partition-table format associated with UEFI that supports large disks and commonly provides space for 128 partition entries.
A drive can use GPT for its partition map while using ext4 inside one of those partitions.

H

Hard link
A hard link is another directory entry naming the same inode and file data on one filesystem, with no special original name.
Deleting one hard-linked filename leaves the other name able to read and change the file.
Home directory
A home directory is an account’s personal directory for files and settings, usually under /home for ordinary users.
The shell expands ~ to your home, where hidden entries can hold your personal application settings.
Host key
An SSH host key identifies the server to clients, allowing them to recognize the same server and detect an unexpected replacement.
Compare a first-contact fingerprint through a trusted channel before accepting the server identity.
Hosts file
A hosts file is a local static table mapping IP addresses to names and aliases, commonly checked before DNS in Linux system lookup.
An old entry in /etc/hosts can send only your computer to a website’s previous server.

I

ICMP echo
An ICMP echo is the request-and-reply mechanism used by ping to test whether a destination answers and measure round-trip time.
A firewall can filter ping while allowing the same machine’s HTTPS service to respond.
Included configuration
An included configuration file contributes settings where the main file reads it, so earlier values can control most sshd directives.
Check sshd -T when an earlier included yes value seems to defeat a later no setting.
Inode
An inode is a filesystem record for a file or directory; hard-linked filenames share the record for their underlying file.
Millions of small cache files can consume ext4’s inode supply while using little data space.
Inode exhaustion
Inode exhaustion occurs when no free file records remain, preventing new files even though the filesystem may still have free data blocks.
A zero IFree count explains why a new file fails despite gigabytes in the Avail column.
IP address
An IP address is a logical network address used to identify an interface or host destination, with IPv4 and IPv6 formats.
One Ethernet interface can have an IPv4 address and several IPv6 addresses at the same time.

K

Keyboard-interactive authentication
Keyboard-interactive authentication is an SSH method for challenge-and-response prompts that can accept passwords on a configured server.
Disabling only PasswordAuthentication can leave a second password-capable method enabled.
known_hosts
The known_hosts file stores trusted SSH server keys on the client, allowing later connections to check the server’s presented identity.
A host-key warning means the new server key differs from the saved entry for that destination.

L

Link count
A link count records how many hard-linked directory entries name a file, and appears near the beginning of an ls -l listing.
Creating a second hard link to a regular file raises its displayed link count to two.
Listening socket
A listening socket is a service endpoint waiting for incoming traffic at a local address and port, visible through tools such as ss.
A listener at 127.0.0.1:8080 accepts local traffic but is not bound to the server’s LAN address.
Logical file size
A logical file size is a file’s length in bytes as seen by readers, which can differ from the storage blocks actually allocated to it.
A sparse virtual-disk image may report a long length in ls -l but occupy much less space.
Loopback
Loopback is the host’s internal networking path to itself, commonly reached through 127.0.0.1 in IPv4 or ::1 in IPv6.
A browser on another computer cannot use its own loopback address to reach your server.

M

MAC address
A MAC address is the 48-bit address used by Ethernet and Wi-Fi interfaces for delivery on a local link, written as hexadecimal pairs.
A neighbor-table entry associates the gateway’s local IP address with its MAC address.
Major and minor numbers
Major and minor numbers identify a device’s driver and specific device to the kernel and replace the size field in device listings.
A listing showing 8, 1 in the size position is describing a device, not an eight-byte file.
MBR
MBR is an older partition-table format with four primary slots and a 2 TiB addressing limit when the disk uses 512-byte sectors.
One MBR primary slot can hold an extended partition containing additional logical partitions.
Merged /usr
Merged /usr is a layout in which paths such as /bin, /sbin and /lib are symbolic links to locations within /usr.
On a merged system, /bin/ls and /usr/bin/ls can refer to the same installed command.
mktemp
The mktemp command creates a uniquely named private temporary file or directory and prints the path for the caller to use.
A script keeps the printed path so later commands work on the file it actually created.
Mount option
A mount option selects behavior for an attached filesystem, such as normal write access, direct execution or displayed ownership.
A FAT mount can use uid and gid to present its files as belonging to the intended user.
Mount point
A mount point is the directory where a filesystem is attached to Linux’s tree, making that filesystem’s contents accessible by path.
After mounting a USB drive at /mnt/usb, a file on it appears below that directory.

N

Name Service Switch
The Name Service Switch selects sources and lookup behavior for system databases, with hostname lookup configured by the hosts line in nsswitch.conf.
The setting hosts: files dns checks the local hosts file before asking DNS for a matching name.
Nameserver
A nameserver is a server that answers DNS queries; client configuration identifies which DNS servers the resolver should contact.
dig @192.168.1.1 example.com A explicitly asks that server for the name’s IPv4 record.
Neighbor table
A neighbor table holds learned information for reaching local IP neighbors, including IP-to-MAC mappings on Ethernet networks.
A failed gateway entry in ip neigh directs attention to communication on the local link.
Netplan
Netplan is a Linux network-configuration system using YAML files to describe settings applied through an underlying network service.
On Ubuntu, netplan try offers a rollback window when testing a change that may disrupt access.
Network interface
A network interface is a physical or virtual connection point through which the kernel sends and receives traffic, including loopback.
ip -br addr lists Ethernet, Wi-Fi, loopback and virtual interfaces with their addresses.
NetworkManager profile
A NetworkManager profile is a saved set of connection settings that the service can activate and restore across network changes and boots.
Modify the connection name shown by nmcli device status, then activate that profile.
noauto
The noauto option excludes an entry from automatic mounting at boot and from mount -a, while leaving explicit mounting available.
Test a noauto entry with sudo mount /archive instead of expecting mount -a to attach it.
noexec
The noexec option prevents direct execution of files from a mount but does not stop an interpreter from reading a script there.
A readable shell script on that mount can still be passed explicitly to bash.
nofail
The nofail option allows startup to continue when an optional source device cannot be mounted, supporting removable or extra drives.
An absent backup drive should not stop boot when its fstab entry is marked nofail.
NXDOMAIN
NXDOMAIN is a DNS response saying the queried domain name does not exist, distinguishing a negative reply from a missing response.
Check spelling when the chosen DNS server returns NXDOMAIN for a name you expected it to know.

P

Partition
A partition is a defined region of a disk treated as a separate storage unit, with its boundaries recorded in a partition table.
The p2 suffix in /dev/nvme0n1p2 selects one partition instead of the whole NVMe device.
Partition table
A partition table records the positions and sizes of a disk’s partitions; GPT and MBR are two common table formats.
sudo fdisk -l displays the table type as well as each partition’s start and end sectors.
Passphrase
A key passphrase encrypts the stored private-key file, protecting its use if someone obtains that file and does not know the phrase.
A prompt for the key passphrase unlocks the local key rather than changing the remote account password.
Prefix length
A prefix length counts the leading bits that identify an IP network, leaving the remaining address bits to distinguish destinations within it.
The /26 in an IPv4 address leaves six address bits and gives 64 addresses in that subnet.
Private key
A private key is the secret half of a key pair, kept on the client to prove identity cryptographically without sending the key itself.
Protect id_ed25519 with mode 600 so other ordinary users cannot read it.
procfs
Procfs is the virtual filesystem normally mounted at /proc, where the kernel supplies live process and system information on request.
Reading /proc/uptime returns current timing values even though it is not an ordinary stored text file.
Pseudo-device
A pseudo-device is a device-file interface that provides a software behavior, such as discarding data or generating zero bytes.
/dev/zero can supply the input when creating a regular test image filled with zeros.
Public key
A public key is the shareable half of a key pair, installed on a server account to authorize authentication by the matching private key.
The file ending in .pub can be added to the intended remote account’s authorized_keys.

R

Read-only mount
A read-only mount disallows normal file writes through that mount, although mounting itself can still change the underlying device.
Use the ro option when you want to inspect a filesystem without normal application writes.
Relative target
A relative target is a symlink path interpreted from the directory containing the link, instead of from the filesystem root.
Moving a link into a different directory can change where its relative target points.
Reserved blocks
Reserved blocks are filesystem blocks kept for privileged use, commonly 5% on ext4, to help essential services continue when users fill storage.
Unused reserved blocks reduce ordinary-user availability without becoming used file data.
Resolver
A resolver is the client-side name-lookup mechanism that consults configured sources and services to turn names into usable results.
The resolver can use local hosts-file data before sending a query to a recursive DNS server.
Root directory
The root directory is /, the starting point of Linux’s single tree of files, directories and mounted filesystems.
A second drive mounted at /data joins the tree instead of receiving a separate drive letter.
Round-trip time
A round-trip time measures how long a request and its reply take to travel between hosts, often reported in milliseconds by ping.
A reply with time=0.8 ms measures the return journey too, not just the outgoing packet.
Routing table
A routing table holds rules for reaching destination networks, including directly connected paths and any configured default routes.
ip route get 203.0.113.18 shows which route Linux would select for that destination.
rsync
The rsync program synchronizes files and directories, commonly over SSH, reducing repeated transfers by sending changed content.
A repeated site-directory copy uses rsync installed at both the client and server ends.

S

scp
The scp program transfers files over SSH using a remote path written as USER@HOST:PATH, with capital -P for a nondefault port.
Put the remote path first to download a file into the current local directory.
Search suffix
A search suffix is a domain added during lookup of a short name, allowing a client to try a fuller name within a configured domain.
With search example.com, a lookup for web1 can try the name web1.example.com.
SERVFAIL
SERVFAIL is a DNS response indicating that the server failed to complete a query, instead of successfully resolving or denying the name.
Compare another resolver’s answer when the configured server repeatedly returns SERVFAIL.
Service port
A service port is a transport-layer number used with an address to identify a network service endpoint, such as TCP port 22 for SSH.
DNS normally uses port 53, so reaching another service does not by itself test DNS traffic.
Service reload
A service reload asks a running service to reread its configuration, allowing sshd to change new-login policy while preserving existing sessions.
After reloading SSH, open a fresh connection before closing your still-working recovery session.
SFTP
SFTP is a file-transfer protocol carried over SSH, usable through an interactive client with upload, download and directory commands.
In an sftp session, lcd changes the local working directory while cd changes the remote one.
SLAAC
SLAAC is IPv6 address autoconfiguration in which a host forms its address using a network prefix announced by a router.
An IPv6 host can configure an address without a DHCPv6 address lease using router advertisements.
Sparse file
A sparse file contains logical regions without corresponding allocated data blocks, so its length can exceed its physical disk use.
Normal du and du --apparent-size can give very different totals for the same sparse image.
SSH
Secure Shell is an encrypted protocol for remote login, commands and file transfer, normally provided on Linux by OpenSSH over TCP port 22.
ssh aya@node.example.com starts a remote session using Aya’s account on the named server.
SSH agent
An SSH agent holds unlocked private keys in memory and performs client authentication operations without repeatedly requesting passphrases.
After ssh-add, several connections can use the loaded key without asking you to unlock it again.
sshd
The sshd program is the SSH server daemon, accepting encrypted connections and applying configured identity and account-access rules.
Check service ssh on Debian or Ubuntu and service sshd on Fedora or RHEL.
Sticky bit
The sticky bit is a directory flag that restricts deletion and renaming to the entry owner, directory owner or root, with normal access checks.
In root-owned /tmp, one ordinary user cannot remove another user’s file just because the directory is writable.
Stub resolver
A stub resolver is a local DNS endpoint that accepts client queries and forwards or resolves them using upstream services and local data.
The 127.0.0.53 nameserver commonly sends queries to systemd-resolved on the same machine.
Swap
Swap is disk space, in a file or partition, that the kernel can use to support memory instead of presenting ordinary user files.
An entry with filesystem type swap is activated as swap space instead of mounted for documents.
Symbolic link
A symbolic link is a special file storing another path, which commands follow to reach the named target file or directory.
A link to ../notes.txt begins its lookup in the directory containing that link.
sysfs
Sysfs is the virtual filesystem normally mounted at /sys, exposing the kernel’s view of devices, drivers, buses and related settings.
The directories under /sys/class/net let you inspect which network interfaces the kernel knows.

T

Temporary file
A temporary file holds intermediate work for a limited lifetime and may be removed by its program or a system cleanup policy.
A job that must resume after rebooting keeps its temporary work in /var/tmp instead of /run.
Temporary network configuration
Temporary network configuration changes running kernel state without saving a boot profile and can be replaced by a network manager.
An address added through ip may disappear when NetworkManager reapplies its connection profile.
Time to live
A DNS time to live specifies the lifetime in seconds for a cached answer before it needs refreshing from the name-resolution system.
A record changed at the server can still have an older answer in a client’s unexpired cache.
tmpfs
A tmpfs is a memory-backed filesystem that can also use swap; its contents disappear when it is unmounted or the system shuts down.
A large job can fill a tmpfs mounted at /tmp even while the main disk still has free space.

U

Unmounting
Unmounting detaches a filesystem from its place in the directory tree after outstanding writes are handled and current users release it.
A shell must leave /mnt/usb before that mount can be detached without a busy-target error.
UUID
A filesystem UUID is an identifier stored with the filesystem that normally stays stable when its kernel device path changes.
Use the UUID reported by lsblk -f instead of assuming a USB partition will always be /dev/sdb1.

About this lesson

By StudeliReport a mistake

Make your own Study Materials

Turn your notes, slides and documents into Study Guides, Practice Questions, Flashcards and 6 more tools.

Get Started