• 230 cards
  • Checked November 2026

CompTIA Linux+ Study Guide in Command Cards

Flip the cards or print them: the job is on the front, the Linux command on the back.

Sort by number, largest first

Card 1 of 35 · Files and text

More options

Set

Every Linux+ card, by set

Files and text

Manual pages at man7.org, read November 29, 2026.

  • List all files with mode, owner and size ls -la -a shows names that begin with a dot.
  • Copy a directory and keep its attributes cp -a src dst -a is for archive. -r alone does not keep owner and times.
  • Move or rename a file mv old new The same command does both.
  • Delete a directory and all in it rm -r dir -i asks first, -f never asks.
  • Make a directory and its parents mkdir -p a/b/c No error if it is there.
  • Make an empty file, or a new time stamp touch file Sets access and modification time to now.
Show all 35
  • Last 20 lines, and follow the file tail -n 20 -f file For a log that grows.
  • First 5 lines head -n 5 file 10 without a number.
  • Read a long file page by page less file Search with /word, leave with q.
  • Find files over 100 MB under /var find /var -type f -size +100M + is more than, − is less than.
  • Find files changed in the last day find ~ -mtime -1 In days. -mmin counts minutes.
  • Run a command on every file found find /tmp -name "*.bak" -exec rm {} + {} stands for the files.
  • Lines with error, any case, in all files grep -ri error /var/log -v lines without it, -n line numbers, -E extended patterns.
  • Replace every foo by bar in a file sed -i "s/foo/bar/g" file -i writes the file. Without g: the first in each line.
  • First field of /etc/passwd cut -d: -f1 /etc/passwd -d is the delimiter, -f the field.
  • Sort by number, largest first sort -nr -k2 sorts from the second field on.
  • Count how often each line occurs sort | uniq -c The uniq command sees only lines that stand together.
  • Count the lines wc -l -w words, -c bytes.
  • Lower case to upper case tr a-z A-Z -d deletes characters.
  • See the output and save it command | tee file -a adds to the file.
  • Compare two files line by line diff a b -u shows lines around each change.
  • Make a symbolic link ln -s target link It points to a name, and may cross file systems.
  • Hard link: what it is A second name for the same file Same file system only. ln without -s makes one.
  • vi: save and leave; leave unsaved :wq; :q! :wq; :q! In command mode. Type i to write, Esc to end.
  • vi: delete, copy, paste a line dd; yy; p /word searches, n goes to the next.
  • File type of an unknown file file name It looks inside, not at the name.
  • Inode, times and mode of a file stat file Access, modify, change, birth.
  • Pack a directory, gzip tar -czf a.tar.gz dir -c create, -z gzip, -f file name.
  • Unpack an archive into /opt tar -xf a.tar.gz -C /opt -x extract, -C the directory. -t only lists.
  • tar with bzip2, with xz -j and -J With gzip it is -z.
  • Mirror a directory over SSH rsync -av --delete src/ host:dst/ --delete removes what the source no longer has.
  • Copy a disk block by block dd if=/dev/sda of=disk.img bs=4M The input is if, the output of. A swap destroys the disk.
  • /etc and /var Settings; data that changes Logs, mail and queues are in /var.
  • /proc and /sys Kernel and devices, as files Nothing of them is on the disk.
  • /boot and /dev Boot files; device files /boot holds what the boot loader needs.

Permissions and users

Manual pages at man7.org. Modes and umasks were computed, read November 29, 2026.

  • chmod 755 rwxr-xr-x Owner, group, others. r is 4, w is 2, x is 1.
  • chmod 644 rw-r--r-- 6 is 4 + 2, read and write; 4 is read. Usual for a text file.
  • chmod 600 rw------- The owner alone: a private SSH key.
  • chmod 700 rwx------ The owner alone, with entry: ~/.ssh.
  • chmod 640 rw-r----- The group may read; others get nothing.
  • chmod 664 rw-rw-r-- Owner and group write.
Show all 33
  • chmod 775 rwxrwxr-x A directory the group works in.
  • chmod 750 rwxr-x--- The group may enter and read, others may not.
  • chmod 444 r--r--r-- Read only for all.
  • umask 022: new file, new directory 644; 755 666 and 777 with the bits of the mask taken out.
  • umask 027: new file, new directory 640; 750 666 and 777 with the bits of the mask taken out.
  • umask 077: new file, new directory 600; 700 666 and 777 with the bits of the mask taken out.
  • chmod u+x,go-w file Owner may run; no write for the rest User, group, others, all: u, g, o, a. + adds, − takes away, = sets.
  • r, w and x on a directory List; add and delete; enter Deleting a file needs w and x on its directory.
  • 4000, 2000, 1000 Setuid, setgid, sticky The digit in front: chmod 4755.
  • -rwsr-xr-x Setuid: runs as the file’s owner The passwd program is one. An S in capitals: no x under it.
  • drwxrwsr-x Setgid: new files take its group 2775. For a directory that a team shares.
  • drwxrwxrwt Sticky: only owners delete 1777, as /tmp has it.
  • Change owner and group, all below chown -R ann:staff dir Also: chgrp changes the group only.
  • Give ann read and write by ACL setfacl -m u:ann:rw file A + at the end of the mode shows that there is an ACL.
  • Show the ACL getfacl file Owner, named users, mask, others.
  • Nobody can change it, not even root chattr +i file Immutable. lsattr shows it.
  • Seven fields of /etc/passwd User, x, UID, GID, note, home, shell Parted by colons. x means the hash is in /etc/shadow.
  • /etc/shadow Password hashes and their ages Days since January 1, 1970. Readable by root.
  • /etc/group Name, x, GID, members Parted by colons. Secondary groups are listed here.
  • New user with home and shell useradd -m -s /bin/bash ann Set a password next: passwd ann.
  • Add a user to a group, keep the others usermod -aG wheel ann Without -a the other groups are lost.
  • Lock and unlock a password usermod -L ann; usermod -U ann Puts a ! before the hash, or takes it away. Other ways to log in stay.
  • Delete a user with the home directory userdel -r ann The mail spool goes too. Files on other file systems stay.
  • Password expires after 90 days chage -M 90 ann Also: chage -l ann shows the dates.
  • Copied into each new home directory /etc/skel Taken by useradd -m.
  • Who am I, and in which groups? id UID, GID, groups.
  • Who is logged in, and doing what? w Also: who is the shorter list, last the history.

Disks and boot

Manual pages at man7.org and manpages.debian.org, read November 29, 2026.

  • Disks and partitions as a tree lsblk -f adds file system and UUID.
  • UUID and type of a partition blkid The UUID goes into /etc/fstab.
  • Partition a disk fdisk /dev/sdb or parted GPT or MBR. partprobe tells the kernel.
  • Put a file system on it mkfs.ext4 /dev/sdb1 Or mkfs.xfs. It erases what was there.
  • Mount a partition mount /dev/sdb1 /mnt Also: umount takes it off again.
  • Six fields of /etc/fstab Device, point, type, options, dump, fsck The last: 1 for root, 2 for others, 0 for never.
Show all 27
  • Mount all of /etc/fstab mount -a Do it after an edit, before a restart.
  • Change a mount to read-only mount -o remount,ro /mnt With rw it turns back.
  • Space left on file systems df -h -i counts inodes.
  • Size of a directory du -sh dir -s is the sum, -h is readable.
  • Disk full, yet space is left No inodes left: df -i Very many small files do it.
  • Make and use swap mkswap, then swapon Also: swapon --show lists it.
  • LVM: mark a disk pvcreate /dev/sdb Physical volume. pvs lists them.
  • LVM: pool of disks vgcreate vg0 /dev/sdb Also: vgextend adds another disk. vgs lists them.
  • LVM: 10 GB volume lvcreate -L 10G -n data vg0 -l 100%FREE takes all that is left.
  • LVM: 5 GB more, file system too lvextend -r -L +5G /dev/vg0/data -r resizes the file system as well.
  • Grow ext4; grow XFS resize2fs; xfs_growfs XFS must be mounted to grow.
  • Repair ext4; repair XFS e2fsck; xfs_repair On a file system that is not mounted.
  • Software RAID 1 of two disks mdadm -C /dev/md/mir -l1 -n2 /dev/sd[bc] -C creates, -l is the level, -n the number of disks. /proc/mdstat shows it.
  • Kernel modules that are loaded lsmod Also: modinfo tells about one.
  • Load a module with what it needs modprobe name Also: modprobe -r takes it out. insmod loads one file only.
  • PCI and USB devices lspci; lsusb -v tells more.
  • Kernel messages dmesg -T shows the clock time, -w waits for more.
  • Kernel release uname -r Also: uname -a tells all.
  • Boot order Firmware, boot loader, kernel, systemd The kernel starts with an initrd; systemd is process 1.
  • Write the GRUB menu anew grub-mkconfig -o /boot/grub/grub.cfg After an edit of /etc/default/grub. Red Hat: grub2-mkconfig.
  • Build the initramfs anew dracut -f Also: update-initramfs -u on Debian.

Processes and services

Manual pages at man7.org and manpages.debian.org, read November 29, 2026.

  • Every process, with CPU and memory ps aux Also: ps -ef is the other style.
  • Processes live, busiest first top Press k to kill, r to renice, M to sort by memory.
  • Find a process by name pgrep -l sshd Also: pkill sends a signal by name.
  • Signal 1 SIGHUP Hang up. Many daemons read their settings again.
  • Signal 2 SIGINT Interrupt: Ctrl+C.
  • Signal 9 SIGKILL Cannot be caught or ignored. The last resort.
Show all 32
  • Signal 15 SIGTERM Ask to end. What kill sends by itself.
  • Signal 19 SIGSTOP Freeze; cannot be caught. CONT (18) goes on.
  • Start with low priority nice -n 10 command −20 is first in line, 19 last. Below 0 needs root.
  • Change priority while it runs renice -n 5 -p PID Ordinary users can only lower a priority.
  • Run in the background; list; bring back command &, then jobs, fg %1 Ctrl+Z stops it, bg lets it go on.
  • Goes on after you log out nohup command & Output goes to nohup.out.
  • Process states R, S, D, T, Z Runs, sleeps, waits, stopped, zombie D waits for a disk and cannot be interrupted.
  • Zombie process Ended, parent has not read its exit It keeps its line in the process table until its parent reaps it.
  • cron: five fields Minute, hour, day, month, weekday Then the command. Sunday is 0 or 7.
  • 30 2 * * 1 Mondays at 02:30 */15 in the first field: every 15 minutes.
  • Edit and list your crontab crontab -e; crontab -l -r removes it, with no question asked.
  • Once, tomorrow at 9 at 9am tomorrow Then atq lists, atrm removes.
  • Start a service now and at each boot systemctl enable --now nginx Without --now it waits for the next boot.
  • Stop it; read its settings again systemctl stop; systemctl reload Also: restart stops it and starts it again.
  • A service nobody can start systemctl mask name Undone by unmask.
  • After editing a unit file systemctl daemon-reload Then restart the service.
  • Units that failed systemctl with the option failed Type systemctl --failed. Then systemctl status name tells why.
  • Boot to text; boot to desktop multi-user.target; graphical.target Chosen by systemctl set-default.
  • Log of one service since boot journalctl -u nginx -b -f follows, -p err shows errors and worse.
  • What slowed the boot systemd-analyze blame Units with the time each took.
  • Memory in use, readable free -h The column available counts what cache can give back.
  • Load average: 1, 5, 15 minutes uptime Compare it with the number of cores: nproc.
  • Memory, swap and I/O, every 2 seconds vmstat 2 Columns si and so are swap in and out.
  • Busy disks iostat -x 2 %util near 100: busy nearly all the time.
  • Files a process has open lsof -p PID Also: lsof +D dir: who uses the directory.
  • System calls of a process strace -p PID Shows where it hangs.

Networking

Manual pages at man7.org and manpages.debian.org, and NetworkManager’s documentation, read November 29, 2026.

  • Addresses of all interfaces ip addr Also: ip -br addr is the short form.
  • Turn an interface on ip link set eth0 up What ip sets is gone after a restart.
  • Give an interface an address ip addr add 10.0.0.5/24 dev eth0 With del it is taken away.
  • Routing table and default gateway ip route The line default via … is the gateway.
  • Set the default gateway ip route add default via 10.0.0.1 Until the next restart.
  • Neighbors and their MAC addresses ip neigh It took the place of arp.
Show all 22
  • Listening TCP and UDP ports, with program ss -tulpn Letters: t TCP, u UDP, l listening, p process, n numbers.
  • Four pings, then stop ping -c 4 host Without -c it goes on.
  • Where the path breaks traceroute host Also: tracepath, with fewer options, and mtr, which goes on.
  • Address of a name, short dig +short name Also: dig @8.8.8.8 asks a given server.
  • Name of an address dig -x 192.0.2.1 Reverse lookup: the PTR record.
  • DNS servers; names before DNS /etc/resolv.conf; /etc/hosts Which comes first stands in /etc/nsswitch.conf.
  • Set the host name for good hostnamectl hostname web1 Older versions: set-hostname. Also: hostnamectl alone shows it.
  • NetworkManager: all connections nmcli connection show Also: nmcli con up name turns one on.
  • Speed and duplex of a card ethtool eth0 Link detected: yes is the first thing to look for.
  • Only the headers of a web page curl -I https://example.com -o file saves, -L follows redirects.
  • Is TCP port 443 open there? nc -zv host 443 -z scans and sends nothing.
  • Packets of port 53 on eth0 tcpdump -i eth0 port 53 -w file saves them, -n leaves names out.
  • Copy a file to another machine scp report.txt ann@host.lan:/tmp Also: sftp for a session, rsync for many.
  • Log in with a key instead ssh-keygen, then ssh-copy-id host The public key goes to ~/.ssh/authorized_keys.
  • Local port 8080 to their port 80 ssh -L 8080:localhost:80 host -R goes the other way, -D makes a SOCKS proxy.
  • Time zone and NTP timedatectl Synchronize with timedatectl set-ntp true.

Packages and containers

Manual pages at man7.org and manpages.debian.org, and the documentation of DNF, pip, Python, Podman, Docker, QEMU and libvirt, read November 29, 2026.

  • Debian: refresh the list, then upgrade apt update, then apt upgrade The update changes no program.
  • Debian: remove with settings apt purge name Settings stay after remove. autoremove clears what nothing needs.
  • Debian: install a .deb file dpkg -i file.deb It does not fetch what the package needs; apt install ./file.deb does.
  • Debian: which package owns a file? dpkg -S /path Also: dpkg -L lists a package’s files.
  • Red Hat: install, update, remove dnf install, upgrade, remove Also: dnf history undo takes a step back.
  • Red Hat: who provides a command? dnf provides "*/dig" Even one that is not installed.
Show all 20
  • RPM: install or upgrade with progress rpm -Uvh file.rpm -i installs only, -e erases.
  • RPM: which package owns a file? rpm -qf /path Also: rpm -ql lists, rpm -qa lists all.
  • RPM: has a file been changed? rpm -V name It compares size, mode, digest and more.
  • Python packages into a file pip freeze > requirements.txt Also: pip install -r reads it.
  • A Python world of its own python3 -m venv env Then source env/bin/activate.
  • Run a container in the background podman run -d -p 8080:80 nginx -p host port:container port. docker takes the same.
  • All containers, stopped ones too podman ps -a Without -a only those that run.
  • A shell in a running container podman exec -it mycontainer /bin/sh -i keeps input open, -t gives a terminal.
  • Keep data outside the container podman run -v /data:/data nginx A bind mount: folder here, folder there. A name in place of /data makes a volume.
  • Build an image podman build -t app dir Reads the Containerfile or Dockerfile in dir.
  • Dockerfile: FROM, RUN, COPY Base; command at build; files in CMD is what runs at the start.
  • ENTRYPOINT and CMD The program; its usual arguments Arguments of run replace CMD.
  • Convert a disk image qemu-img convert -O qcow2 a.img b Also: qemu-img info tells about one.
  • All virtual machines virsh list --all Also: virsh start and shutdown name.

Shell, Git and scripting

Manual pages at man7.org and manpages.debian.org, and docs.python.org, read November 29, 2026.

  • First line of a script #!/bin/bash It names the program that runs the file. chmod +x it.
  • $? in a script Exit code of the last command 0 is success.
  • $#, $@, $0, $1 Count, all, script name, first Of the arguments. "$@" keeps each one whole.
  • $$ and $! PID of the shell; of the last job The job in the background.
  • > and >> Write over; add to the end 2> is for errors.
  • 2>&1 Errors go where output goes As in command > file 2>&1: both in the file. Order matters.
Show all 32
  • a && b; a || b b if a worked; b if it failed ; runs b in any case.
  • $(command) Its output, put in the line As in now=$(date). The old form is `date`.
  • $((3 + 4)) 7 Arithmetic in the shell.
  • Single and double quotes Nothing; variables are replaced '$HOME' stays as it is.
  • export NAME=value Child programs see it too Also: env lists the environment.
  • ~/.bashrc and ~/.bash_profile Each shell; each login The first for an interactive shell that is no login.
  • test -f, test -d and test -x on a name File, directory, may be run -e it exists, -s it is not empty.
  • Compare two numbers in [ ] eq ne lt le gt ge, each with a hyphen As in [ $n -gt 5 ]. Text is compared by = and !=. -z means empty.
  • if … fi if [ … ]; then …; else …; fi For a second test: elif.
  • for f in *.log for f in *.log; do …; done Once for every file.
  • while read line while read l; do …; done < file Once for every line.
  • case case $x in a) …;; *) …;; esac *) catches the rest.
  • set -e, set -x Stop at an error; show each line For a script that misbehaves.
  • *, ?, [abc] Any text, one character, one of these The shell’s patterns. In a regular expression . is any character.
  • ^, $, .* Start, end, anything Regular expression: grep ^root finds lines that begin with root.
  • Feed lines to a command as arguments command | xargs rm -0 with find -print0 for names with blanks.
  • Print the second column awk '{print $2}' -F: makes the colon the separator.
  • Start a repository; copy one git init; git clone URL .git holds the history.
  • Stage, then record git add file; git commit -m "why" Also: git status shows what waits.
  • Send; fetch and merge git push; git pull Also: git fetch looks and merges nothing.
  • New branch, and go to it git switch -c fix Also: git checkout -b does the same.
  • Put work aside for later git stash Also: git stash pop brings it back.
  • Mark a release git tag -a v1.0 -m "…" Also: git push --tags sends it.
  • Files Git should not see .gitignore One pattern a line.
  • Ansible: run a playbook; only look ansible-playbook site.yml; --check YAML; over SSH, with no agent.
  • Python list, tuple, dictionary [1, 2]; (1, 2); {"a": 1} A tuple cannot be changed.

Security

Manual pages at man7.org and manpages.debian.org, and the documentation of nftables, UFW, firewalld, GnuPG, OpenSSL and Kerberos, read November 29, 2026.

  • Edit who may use sudo visudo It checks the file before it saves.
  • %wheel ALL=(ALL) ALL in sudoers Group wheel may do all by sudo Who, host = (as whom) what.
  • sudo -l; su - What may I do; become root Root’s password for su, your own for sudo.
  • No root login over SSH PermitRootLogin no In /etc/ssh/sshd_config. Reload sshd.
  • Keys only over SSH Password login set to no PasswordAuthentication no in sshd_config. Try your key first.
  • No shell for a service account /usr/sbin/nologin As the shell in /etc/passwd.
Show all 29
  • SELinux: three modes Enforcing, permissive, disabled Permissive logs and lets through.
  • SELinux mode: show; set until restart getenforce; setenforce 0 or 1 0 is permissive, 1 enforcing.
  • Put the right SELinux label back restorecon -R -v /var/www/html From the policy’s rules.
  • A label for good semanage fcontext -a -t type path Then restorecon. chcon alone does not last.
  • SELinux denials in the log ausearch -m avc -ts recent for the last minutes.
  • A switch of the policy, for good setsebool -P name on Also: getsebool -a lists them.
  • Watch a file with auditd auditctl -w /etc/passwd -p wa -k pw W write, a attribute. ausearch -k pw finds it. Deprecated: -a rules replace it.
  • iptables: let SSH in iptables -A INPUT … -j ACCEPT In the middle: -p tcp --dport 22. -A adds at the end, -I at the start.
  • iptables: show the rules iptables --list with -n and -v -n numbers, -v counters. iptables-save writes them out.
  • nftables: show all rules nft list ruleset Tables hold chains, chains hold rules.
  • UFW: allow SSH, turn it on ufw allow 22/tcp; ufw enable In that order, if you are there by SSH.
  • firewalld: open HTTPS now firewall-cmd --add-service=https To keep it: the same with --permanent.
  • DROP and REJECT No answer; an error comes back A caller waits on DROP.
  • Hash of a file sha256sum file -c checks a list of them.
  • Encrypt for someone; open gpg -e -r ann file; gpg -d file.gpg --sign and --verify for a signature.
  • Read a certificate openssl x509 -in c.pem -noout -text -dates shows from when to when.
  • Encrypt a partition cryptsetup luksFormat /dev/sdb1 Then cryptsetup open, then mkfs.
  • PAM: four types auth, account, password, session In /etc/pam.d, one file for each service.
  • PAM: required and sufficient Must pass; passing is enough A failed requisite stops at once.
  • Lock after failed logins pam_faillock Let her in again: faillock --user ann --reset.
  • Kerberos: get and list tickets kinit; klist Also: kdestroy throws them away.
  • Has a system file been changed? aide, with the option check Type aide --check. It compares with a database made earlier.
  • Kernel setting now; for good sysctl -w key=value; /etc/sysctl.conf Or a file in /etc/sysctl.d.

How this list was compiled: Cards written for this site in our own words for CompTIA Linux+ V8 (XK0-006), sorted from the objectives summary at comptia.org. Every command and option was looked up on November 29, 2026 in its manual page: man7.org, manpages.debian.org, and the projects' own documentation for APT, DNF, Podman, Docker, Git, Ansible, Python, GnuPG, OpenSSL, nftables, UFW, firewalld, QEMU, libvirt, NetworkManager and Kerberos. Octal modes and umasks were computed.

Checked against: comptia.org. Read November 29, 2026.

How it works

This CompTIA Linux+ study guide is 230 cards in our own words, not CompTIA’s book, for exam XK0-006. It is unofficial and not affiliated with or endorsed by CompTIA.

Read the full guide

What is on the cards

A job and the command for it, with the options that matter. Permissions has chmod 755, 644, 750 and the rest read out letter by letter, umasks with the modes they give, setuid, setgid and sticky.

Which exam it fits

CompTIA’s page, read November 29, 2026, gives V8 (XK0-006), launched July 15, 2025: system management 23%, services and users 20%, security 18%, automation and scripting 17%, troubleshooting 22%. Puppet, LDAP, MFA, timers, CI/CD tools and AI best practices have no cards.

On paper

Choose a set, or All, and press Print: cards for both sides of the sheet. Use the fold-over print where the printer does one side only.

  • Package cards come twice: apt and dpkg for Debian and Ubuntu, dnf and rpm for Red Hat and Fedora.

Questions and answers

Is there a CompTIA Linux+ study guide PDF?

You make it here. Press Print and choose Save as PDF as the printer. Files and text is 35 cards on 3 sheets; All is 230 cards on 16.

What does chmod 755 mean?

rwxr-xr-x: the owner may read, write and run; group and others may read and run. Each digit is a sum of read 4, write 2 and execute 1, for owner, group and others in turn.

How do I learn Linux commands for the exam?

Read the job, type the command in a terminal, then turn the card. Commands that delete or write to a disk (rm, dd, mkfs, fdisk) belong in a virtual machine you can lose.

Is this the official CompTIA Linux+ study guide?

No. CompTIA sells its own training. Each command was looked up in its public manual page or the project’s documentation. Nothing is taken from CompTIA’s books, objectives file or exam.