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.
Practice now
Study without an account
/varScheduled with the default Askesis timings. Progress is saved in this browser.
All 50 cards
- 1Find regular files over 100 MB under
/varbashfind /var -type f -size +100M-sizeunits:k,M,G;+means more than,-less than. - 2Find files with the SUID bit setbash
find / -perm -4000 -type f 2>/dev/null-perm -MODEmatches files with all of those bits set;-perm /MODEmatches any of them. - 3Run a command on each file
findmatchesbashfind . -name "*.bak" -exec rm {} \;End with{} +instead to pass many files to one command, likexargs. - 4What does
grep -Eenable?Extended regular expressions:+,?,|,()and{}work without backslashesThe oldegrepcommand is equivalent.grep -Fmatches fixed strings, with no regex at all. - 5grep flags
-v,-i,-cand-l-vprints non-matching lines,-iignores case,-ccounts matching lines,-llists only the names of matching files - 6Show the lines of a config file that are neither comments nor blankbash
grep -Ev '^(#|$)' /etc/ssh/sshd_config - 7Find files by name instantly from a databasebash
locate sshd_configThe database is rebuilt byupdatedb, usually daily from cron, so very new files may be missing. - 8The special permission bits in octal4 = SUID, 2 = SGID, 1 = sticky, written before the usual three digits, as in
chmod 4755 - 9What does SUID do on an executable?The program runs with the file owner’s privileges instead of the caller’s
/usr/bin/passwdis SUID root so users can update/etc/shadow. It shows assin the owner’s execute slot:-rwsr-xr-x. - 10What does SGID do on a directory?New files created inside inherit the directory’s group instead of the creator’s primary groupHandy for shared team directories.
- 11What 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
/tmpis mode 1777, shown asdrwxrwxrwt. - 12With
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. - 13Change a file’s owner and group at oncebash
chown alice:developers report.txtAdd-Rto recurse into directories.chgrpchanges only the group. - 14Hard link vs symbolic linkA 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 removedbash
ln data.txt data-hard.txt ln -s /etc/nginx/nginx.conf nginx.conf - 15What is an inode?The structure that stores a file’s metadata (type, permissions, owner, size, timestamps, data block locations), but not its name
ls -ishows inode numbers;df -ishows inode usage per filesystem. - 16The six fields of an
/etc/fstablineDevice (orUUID=/LABEL=), mount point, filesystem type, mount options, dump flag, fsck pass orderExample:UUID=… /home ext4 defaults 0 2. For the fsck pass,1is the root filesystem,2others,0skips the check. - 17Mount everything in
/etc/fstabthat isn’t mounted yetbashmount -aA good test after editing fstab, before you reboot. Entries with thenoautooption are skipped. - 18MBR vs GPT partition tablesMBR: 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
fdiskandpartedhandle both;gdiskis GPT-only. - 19Create an ext4 filesystem, then check itbash
mkfs.ext4 /dev/sdb1 fsck /dev/sdb1Only runfsckon unmounted filesystems. For XFS, usexfs_repair. - 20Set up and enable a swap partitionbash
mkswap /dev/sdb2 swapon /dev/sdb2Check withswapon --showorfree -h; add aswapline to/etc/fstabto keep it after reboot. - 21SysV runlevels 0, 1, 3, 5 and 60 halt · 1 single-user (maintenance) · 3 multi-user, text mode with networking · 5 multi-user, graphical · 6 rebootRunlevels 2 and 4 vary by distribution.
- 22systemd targets that replace the runlevels
poweroff.target(0),rescue.target(1),multi-user.target(3),graphical.target(5),reboot.target(6) - 23Show and change the default boot targetbash
systemctl get-default systemctl set-default multi-user.target - 24Switch to rescue mode now, without rebootingbash
systemctl isolate rescue.targetThe SysV equivalent istelinit 1. - 25Start a service now and enable it at bootbash
systemctl enable --now nginxsystemctl status nginxshows whether it is running and its latest log lines. - 26Show a service’s log messages since the last bootbash
journalctl -u nginx -b-ffollows new messages;-p errshows only errors and worse. - 27Regenerate the GRUB 2 configuration after editing
/etc/default/grubbashgrub-mkconfig -o /boot/grub/grub.cfgDebian and Ubuntu wrap this asupdate-grub; Red Hat systems rungrub2-mkconfig -o /boot/grub2/grub.cfg. - 28Load a kernel module together with its dependenciesbash
modprobe usb_storageinsmodloads a single module file without resolving dependencies.lsmodlists loaded modules;modprobe -rremoves one. - 29List the shared libraries a program needsbash
ldd /usr/bin/sshAfter adding a library directory under/etc/ld.so.conf.d/, runldconfigto rebuild the cache. - 30Debian: install a local
.deb, list installed packages, list a package’s filesbashdpkg -i package.deb dpkg -l dpkg -L openssh-server - 31Which package owns a file? (Debian and RPM)bash
dpkg -S /usr/bin/ssh rpm -qf /usr/bin/ssh - 32
apt removevsapt purgeremoveuninstalls the package but keeps its configuration files;purgedeletes them tooapt updaterefreshes the package lists;apt upgradeinstalls newer versions. - 33RPM: install, upgrade and erase a packagebash
rpm -ivh package.rpm rpm -Uvh package.rpm rpm -e packagerpmdoesn’t resolve dependencies;dnf(formerlyyum) andzypper(openSUSE) do. - 34The seven fields of
/etc/passwdusername : password placeholder (x) : UID : GID : comment (GECOS) : home directory : login shell - 35Where are password hashes stored?
/etc/shadow, readable only by rootIt also holds password ageing data, managed withchage. - 36Create a user with a home directory and Bash as the shellbash
useradd -m -s /bin/bash alice passwd alice - 37Add a user to a supplementary group, keeping their other groupsbash
usermod -aG wheel aliceWithout-a,-Greplaces the user’s supplementary groups. - 38The five time fields of a crontab lineMinute, hour, day of month, month, day of weekbash
# 02:30 every Monday 30 2 * * 1 /usr/local/bin/backup.sh - 39How does
/etc/crontabdiffer from a user’s crontab?System crontabs (/etc/crontab,/etc/cron.d/) have a sixth field naming the user to run asEdit your own withcrontab -e; list it withcrontab -l. - 40Run a job once at a later timebash
echo "/usr/local/bin/report.sh" | at 23:00atqlists pending jobs;atrmremoves one. - 41Nice values: the range, the default, and which is the highest priority-20 (highest priority) to 19 (lowest); the default is 0Start with
nice -n 10 cmd; change withrenice -n 5 -p PID. Only root can lower a nice value. - 42Suspend a foreground job, resume it in the background, then bring it backCtrl+Z, then
bg, thenfgjobslists them;%1refers to job 1, as infg %1. - 43Signal numbers of SIGHUP, SIGINT, SIGKILL and SIGTERM1, 2, 9 and 15SIGTERM is what
killsends by default; SIGHUP makes many daemons reload their configuration. - 44Create and extract a gzip-compressed tar archivebash
tar -czvf etc.tar.gz /etc tar -xzvf etc.tar.gz -C /tmp-jfor bzip2,-Jfor xz,-tto list the contents. - 45Replace text in a file in place with sedbash
sed -i 's/old/new/g' file.txtUse-i.bakto keep a backup of the original. - 46Which files does Bash read for a login shell?
/etc/profile, then the first of~/.bash_profile,~/.bash_loginand~/.profilethat existsInteractive non-login shells read~/.bashrcinstead. - 47vi: save and quit, quit without saving, delete a line, search
:wq(orZZ),:q!,dd,/patternPressito insert text andEscto return to normal mode. - 48Show IP addresses and the routing tablebash
ip addr show ip route showTheipcommand replaces the olderifconfigandroute. - 49List listening TCP and UDP ports with their processesbash
ss -tulpnssreplacesnetstat. Run it as root to see every process. - 50Which file sets the order of name lookups (local files, DNS)?
/etc/nsswitch.conf, e.g.hosts: files dnsStatic 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.
More in IT & DevOps
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 cardsIntermediate 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 cardsAdvanced 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 cardsBash scripting
Bash scripting flashcards: shebangs, quoting, exit codes, tests, loops, functions, arrays, parameter expansion, redirection, set -euo pipefail and traps.
50 cardsVim
Learn Vim from the keyboard up: modes, motions, operators and text objects, search and :s substitutions, registers, macros, visual mode and windows.
50 cardsNetworking
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 cardsCyber 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 cardsDocker
Learn Docker from images and layers to multi-stage builds, volumes, networks and Compose, with the commands and best practices you use daily.
50 cardsKubernetes
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 cardsAWS
AWS flashcards: regions and AZs, EC2, S3 storage classes, IAM users, roles and policies, VPC networking, RDS, Lambda, CloudWatch and Route 53.
50 cardsTerraform
Terraform flashcards: HCL, providers, resources, variables and outputs, state and remote backends, plan and apply, modules, count, for_each, drift and import.
50 cards