askesis

Linux command line: 50 LPIC-1 essentials

Linux commands and files for sysadmins and LPIC-1 candidates: find and grep, permissions and special bits, fstab, systemd targets, package managers, users, cron and more.

IT & DevOpsIntermediate50 cardsFree

Practice now

Study without an account

0 of 50 seen0 graduated
Find regular files over 100 MB under /var

Scheduled with the default Askesis timings. Progress is saved in this browser.

All 50 cards

  1. 1
    Find regular files over 100 MB under /var
    bash
    find /var -type f -size +100M
    -size units: k, M, G; + means more than, - less than.
  2. 2
    Find files with the SUID bit set
    bash
    find / -perm -4000 -type f 2>/dev/null
    -perm -MODE matches files with all of those bits set; -perm /MODE matches any of them.
  3. 3
    Run a command on each file find matches
    bash
    find . -name "*.bak" -exec rm {} \;
    End with {} + instead to pass many files to one command, like xargs.
  4. 4
    What does grep -E enable?
    Extended regular expressions: +, ?, |, () and {} work without backslashes
    The old egrep command is equivalent. grep -F matches fixed strings, with no regex at all.
  5. 5
    grep flags -v, -i, -c and -l
    -v prints non-matching lines, -i ignores case, -c counts matching lines, -l lists only the names of matching files
  6. 6
    Show the lines of a config file that are neither comments nor blank
    bash
    grep -Ev '^(#|$)' /etc/ssh/sshd_config
  7. 7
    Find files by name instantly from a database
    bash
    locate sshd_config
    The database is rebuilt by updatedb, usually daily from cron, so very new files may be missing.
  8. 8
    The special permission bits in octal
    4 = SUID, 2 = SGID, 1 = sticky, written before the usual three digits, as in chmod 4755
  9. 9
    What does SUID do on an executable?
    The program runs with the file owner’s privileges instead of the caller’s
    /usr/bin/passwd is SUID root so users can update /etc/shadow. It shows as s in the owner’s execute slot: -rwsr-xr-x.
  10. 10
    What does SGID do on a directory?
    New files created inside inherit the directory’s group instead of the creator’s primary group
    Handy for shared team directories.
  11. 11
    What does the sticky bit do on a directory?
    Only a file’s owner, the directory’s owner or root can delete or rename files in it
    /tmp is mode 1777, shown as drwxrwxrwt.
  12. 12
    With umask 022, what permissions do new files and directories get?
    Files 644 (rw-r--r--), directories 755 (rwxr-xr-x)
    The umask removes bits from the defaults of 666 for files and 777 for directories.
  13. 13
    Change a file’s owner and group at once
    bash
    chown alice:developers report.txt
    Add -R to recurse into directories. chgrp changes only the group.
  14. 14
    Hard link vs symbolic link
    A hard link is another name for the same inode (same filesystem only, not for directories); a symlink is a small file holding a path, which can cross filesystems and breaks if the target is removed
    bash
    ln data.txt data-hard.txt
    ln -s /etc/nginx/nginx.conf nginx.conf
  15. 15
    What is an inode?
    The structure that stores a file’s metadata (type, permissions, owner, size, timestamps, data block locations), but not its name
    ls -i shows inode numbers; df -i shows inode usage per filesystem.
  16. 16
    The six fields of an /etc/fstab line
    Device (or UUID=/LABEL=), mount point, filesystem type, mount options, dump flag, fsck pass order
    Example: UUID=… /home ext4 defaults 0 2. For the fsck pass, 1 is the root filesystem, 2 others, 0 skips the check.
  17. 17
    Mount everything in /etc/fstab that isn’t mounted yet
    bash
    mount -a
    A good test after editing fstab, before you reboot. Entries with the noauto option are skipped.
  18. 18
    MBR vs GPT partition tables
    MBR: up to 4 primary partitions (or 3 plus an extended one holding logical partitions) and disks up to 2 TiB. GPT: 128 partitions by default and far larger disks; used with UEFI
    fdisk and parted handle both; gdisk is GPT-only.
  19. 19
    Create an ext4 filesystem, then check it
    bash
    mkfs.ext4 /dev/sdb1
    fsck /dev/sdb1
    Only run fsck on unmounted filesystems. For XFS, use xfs_repair.
  20. 20
    Set up and enable a swap partition
    bash
    mkswap /dev/sdb2
    swapon /dev/sdb2
    Check with swapon --show or free -h; add a swap line to /etc/fstab to keep it after reboot.
  21. 21
    SysV runlevels 0, 1, 3, 5 and 6
    0 halt · 1 single-user (maintenance) · 3 multi-user, text mode with networking · 5 multi-user, graphical · 6 reboot
    Runlevels 2 and 4 vary by distribution.
  22. 22
    systemd targets that replace the runlevels
    poweroff.target (0), rescue.target (1), multi-user.target (3), graphical.target (5), reboot.target (6)
  23. 23
    Show and change the default boot target
    bash
    systemctl get-default
    systemctl set-default multi-user.target
  24. 24
    Switch to rescue mode now, without rebooting
    bash
    systemctl isolate rescue.target
    The SysV equivalent is telinit 1.
  25. 25
    Start a service now and enable it at boot
    bash
    systemctl enable --now nginx
    systemctl status nginx shows whether it is running and its latest log lines.
  26. 26
    Show a service’s log messages since the last boot
    bash
    journalctl -u nginx -b
    -f follows new messages; -p err shows only errors and worse.
  27. 27
    Regenerate the GRUB 2 configuration after editing /etc/default/grub
    bash
    grub-mkconfig -o /boot/grub/grub.cfg
    Debian and Ubuntu wrap this as update-grub; Red Hat systems run grub2-mkconfig -o /boot/grub2/grub.cfg.
  28. 28
    Load a kernel module together with its dependencies
    bash
    modprobe usb_storage
    insmod loads a single module file without resolving dependencies. lsmod lists loaded modules; modprobe -r removes one.
  29. 29
    List the shared libraries a program needs
    bash
    ldd /usr/bin/ssh
    After adding a library directory under /etc/ld.so.conf.d/, run ldconfig to rebuild the cache.
  30. 30
    Debian: install a local .deb, list installed packages, list a package’s files
    bash
    dpkg -i package.deb
    dpkg -l
    dpkg -L openssh-server
  31. 31
    Which package owns a file? (Debian and RPM)
    bash
    dpkg -S /usr/bin/ssh
    rpm -qf /usr/bin/ssh
  32. 32
    apt remove vs apt purge
    remove uninstalls the package but keeps its configuration files; purge deletes them too
    apt update refreshes the package lists; apt upgrade installs newer versions.
  33. 33
    RPM: install, upgrade and erase a package
    bash
    rpm -ivh package.rpm
    rpm -Uvh package.rpm
    rpm -e package
    rpm doesn’t resolve dependencies; dnf (formerly yum) and zypper (openSUSE) do.
  34. 34
    The seven fields of /etc/passwd
    username : password placeholder (x) : UID : GID : comment (GECOS) : home directory : login shell
  35. 35
    Where are password hashes stored?
    /etc/shadow, readable only by root
    It also holds password ageing data, managed with chage.
  36. 36
    Create a user with a home directory and Bash as the shell
    bash
    useradd -m -s /bin/bash alice
    passwd alice
  37. 37
    Add a user to a supplementary group, keeping their other groups
    bash
    usermod -aG wheel alice
    Without -a, -G replaces the user’s supplementary groups.
  38. 38
    The five time fields of a crontab line
    Minute, hour, day of month, month, day of week
    bash
    # 02:30 every Monday
    30 2 * * 1 /usr/local/bin/backup.sh
  39. 39
    How does /etc/crontab differ from a user’s crontab?
    System crontabs (/etc/crontab, /etc/cron.d/) have a sixth field naming the user to run as
    Edit your own with crontab -e; list it with crontab -l.
  40. 40
    Run a job once at a later time
    bash
    echo "/usr/local/bin/report.sh" | at 23:00
    atq lists pending jobs; atrm removes one.
  41. 41
    Nice values: the range, the default, and which is the highest priority
    -20 (highest priority) to 19 (lowest); the default is 0
    Start with nice -n 10 cmd; change with renice -n 5 -p PID. Only root can lower a nice value.
  42. 42
    Suspend a foreground job, resume it in the background, then bring it back
    Ctrl+Z, then bg, then fg
    jobs lists them; %1 refers to job 1, as in fg %1.
  43. 43
    Signal numbers of SIGHUP, SIGINT, SIGKILL and SIGTERM
    1, 2, 9 and 15
    SIGTERM is what kill sends by default; SIGHUP makes many daemons reload their configuration.
  44. 44
    Create and extract a gzip-compressed tar archive
    bash
    tar -czvf etc.tar.gz /etc
    tar -xzvf etc.tar.gz -C /tmp
    -j for bzip2, -J for xz, -t to list the contents.
  45. 45
    Replace text in a file in place with sed
    bash
    sed -i 's/old/new/g' file.txt
    Use -i.bak to keep a backup of the original.
  46. 46
    Which files does Bash read for a login shell?
    /etc/profile, then the first of ~/.bash_profile, ~/.bash_login and ~/.profile that exists
    Interactive non-login shells read ~/.bashrc instead.
  47. 47
    vi: save and quit, quit without saving, delete a line, search
    :wq (or ZZ), :q!, dd, /pattern
    Press i to insert text and Esc to return to normal mode.
  48. 48
    Show IP addresses and the routing table
    bash
    ip addr show
    ip route show
    The ip command replaces the older ifconfig and route.
  49. 49
    List listening TCP and UDP ports with their processes
    bash
    ss -tulpn
    ss replaces netstat. Run it as root to see every process.
  50. 50
    Which file sets the order of name lookups (local files, DNS)?
    /etc/nsswitch.conf, e.g. hosts: files dns
    Static names live in /etc/hosts; DNS servers are listed in /etc/resolv.conf.

Frequently asked questions

Is this deck enough to pass LPIC-1?

No single deck is. It drills the commands, files and numbers the exams expect you to recall instantly; pair it with hands-on practice in a virtual machine.

Does it cover both Debian and Red Hat systems?

Yes. Package management covers dpkg and apt as well as rpm, dnf and zypper, and the systemd commands are the same on every major distribution.

How is this different from the Git & terminal deck?

That deck covers everyday shell basics such as pipes, redirects and chmod 755. This one goes deeper into system administration.

Beginner

Linux filesystem basics

Learn the Linux directory tree: what /etc, /var, /usr, /proc and /dev are for, plus passwd, shadow, fstab and hosts. Free flashcards, no signup.

50 cards
Intermediate

Intermediate Linux filesystem

Linux paths admins use daily: /usr/local, /var/lib, /run, /sys, /etc/skel, sudoers, Bash startup files, SSH keys, resolv.conf and /proc. Free flashcards.

50 cards
Advanced

Advanced Linux filesystem

Deeper Linux files for LPIC-1: profile.d, sudoers.d, systemd units, GRUB config, nsswitch.conf, ld.so.conf, distro logs and /lib/modules. Free flashcards.

50 cards
Beginner

Bash scripting

Bash scripting flashcards: shebangs, quoting, exit codes, tests, loops, functions, arrays, parameter expansion, redirection, set -euo pipefail and traps.

50 cards
Beginner

Vim

Learn Vim from the keyboard up: modes, motions, operators and text objects, search and :s substitutions, registers, macros, visual mode and windows.

50 cards
Beginner

Networking

Computer networking fundamentals: OSI and TCP/IP layers, TCP vs UDP, common port numbers, subnetting and CIDR, DNS, DHCP and ARP, and IPv6 basics.

50 cards
Beginner

Cyber security

Cyber security flashcards: the CIA triad, phishing, XSS, CSRF, SQL injection, MITM, hashing vs encryption, TLS, MFA, least privilege, OWASP and zero trust.

50 cards
Beginner

Docker

Learn Docker from images and layers to multi-stage builds, volumes, networks and Compose, with the commands and best practices you use daily.

50 cards
Intermediate

Kubernetes

Kubernetes fundamentals for developers and CKA or CKAD candidates: Pods, Deployments, Services, storage, probes, resources and scheduling, plus the kubectl commands you use daily.

50 cards
Beginner

AWS

AWS flashcards: regions and AZs, EC2, S3 storage classes, IAM users, roles and policies, VPC networking, RDS, Lambda, CloudWatch and Route 53.

50 cards
Beginner

Terraform

Terraform flashcards: HCL, providers, resources, variables and outputs, state and remote backends, plan and apply, modules, count, for_each, drift and import.

50 cards