Back to commands

Linux Survival Basics

Read-only

List Contents of a Backup Tarball

You need to see what a backup tarball contains before restoring it.

Command

tar -tf archives/site-backup.tar | sort | head

Before you run this

System impact: Read-only. Low when scoped to the shown target.

When not to use it: Do not treat a file listing as content verification; pair it with checksums when possible.

Expected output

A sorted sample of paths stored inside the tar archive.

System impact

Read-only. Nothing changes. The command lists archive member names.

Recovery / rollback: no state is changed.

When to use it

Use before extracting a backup archive or when checking whether expected files are present.

When not to use it

Do not treat a file listing as content verification; pair it with checksums when possible.

Watch this command run

Command transcript

This sanitized transcript shows the commands and output shape without exposing host details.

demo@lab:~$

$ ls -lh archives/site-backup.tar

-rw-r--r-- 1 root root 10K Jun 26 00:27 archives/site-backup.tar

$ tar -tf archives/site-backup.tar | sort | head

./
./app/
./app/config.yml
./assets/
./assets/logo.svg
./content/
./content/about.md
./content/index.md
View commands shown

These are the commands shown in the sanitized transcript.

Commands shown

  1. ls -lh archives/site-backup.tar
  2. tar -tf archives/site-backup.tar | sort | head

next steps

Related commands

Hosting Operations Read-only

List Archive Contents Before Extracting

You can inspect a tar backup before it writes a single file.

cd restore-dr && tar -tf backups/2026-06-25/site.tar | sed 's#^./##' | sort
Linux Survival Basics Can be slow

Count Failures by Test File

Turn noisy test logs into a ranked failure list.

grep -RhoE '[A-Za-z0-9_./-]+\.(test|spec)\.(js|ts|py|rb)' logs/ | sort | uniq -c | sort -nr | head
Linux Survival Basics Read-only

Find the Largest Installed Packages

Disk cleanup starts with evidence, not random package removal.

dpkg-query -W -f='${Installed-Size}\t${Package}\n' | sort -nr | head -20
Linux Survival Basics Can be slow

Find the Files Eating Your Disk

The disk was full, but guessing at folders was the slow part.

find /var -type f -printf '%s %p\n' | sort -nr | head -20
Linux Survival Basics Can be slow

Find the Processes Using Memory

The server felt slow. Memory pressure was the first thing to rule out.

ps -eo pid,comm,%mem,%cpu --sort=-%mem | head
Study mapping

Use this as independent command practice: read the notes, predict the output, then compare it with the example before using a real shell.

  • lpic1:103-gnu-unix-commands
  • lpic1:104-filesystems-permissions-fhs
  • lfcs:essential-commands
  • lfcs:storage
  • linuxplus:automation-scripting
  • linuxplus:provisional
  • risk:read-only

Useful for

  • LPIC-1 style command-line practice
  • LFCS style performance tasks
  • Linux+ style troubleshooting review

Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.