A+ Command Line Cheat Sheet: Every Windows and Linux Command
CompTIA names the commands explicitly, in two places: Core 2 objective 1.5 for Windows and 1.9 for Linux. This page lists all of them, grouped exactly as the objectives group them, with what each does and the distinction the exam actually tests. Nothing here is padding - if a command is on this page it is named in the objectives, and if it is not named, it is not here.
Find out which of these you can actually pick under pressure
Recognising a command on a list and choosing it from four plausible options against a clock are different skills, and only the second one is on the exam. A full 90-question Core 2 paper, free, with an explanation and an Exam Tip on every item.
APLUS2-EXAM-FULL
Start the free exam
Already have an account? Log in to start · Prefer a 5-question taster? Try the short version.
On this page
Windows commands (objective 1.5)
Navigation
1.5| Command | What it does, and what gets tested |
|---|---|
cd | Change directory. cd .. goes up one level, cd \ to the drive root. Changing drive letter needs the letter on its own (D:), not cd D: - a classic trick option. |
dir | List directory contents. /a shows hidden and system files, /s recurses subdirectories. If a scenario says a file "is not there", /a is usually the answer. |
Network
1.5| Command | What it does, and what gets tested |
|---|---|
ipconfig | Show IP configuration. /all adds MAC address, DHCP server and DNS servers; /release and /renew cycle a DHCP lease; /flushdns clears the resolver cache. A 169.254.x.x address in the output means DHCP failed - that is the most tested single fact here. |
ping | Test reachability with ICMP echo. Pinging the loopback tests the local stack, the gateway tests the local segment, an external IP tests routing, and a hostname tests DNS. That four-step ladder is the exam question. |
netstat | Show active connections and listening ports. -a all connections, -n numeric (faster), -b the executable responsible. Reach for it when a scenario mentions an unexpected connection or a port already in use. |
nslookup | Query DNS directly. The tool for "the site loads by IP but not by name". Distinguishes a DNS fault from a connectivity fault, which is the distinction most network scenarios turn on. |
net use | Map, list and disconnect network drives. net use Z: \\server\share to map, /delete to remove, /persistent:yes to survive a reboot. |
tracert | Trace the route to a destination, hop by hop. Fast. Tells you where the path goes and where it stops. |
pathping | Trace the route, then measure packet loss per hop. Takes minutes rather than seconds, and tells you which hop is losing traffic. If the scenario says "intermittent" or "slow but working", it is pathping, not tracert. |
Disk management
1.5| Command | What it does, and what gets tested |
|---|---|
chkdsk | Check a volume for filesystem errors. /f fixes errors, /r locates bad sectors and recovers readable data (and implies /f). On the system volume it schedules for next boot rather than running immediately. |
format | Format a volume with a filesystem. Destructive. The exam cares that you know a quick format does not check for bad sectors and a full format does. |
diskpart | Interactive partition management - list, select, create, delete, extend. The tool for anything involving partitions rather than files. Selecting the wrong disk here destroys the wrong data; scenarios test whether you list and select before acting. |
File management
1.5| Command | What it does, and what gets tested |
|---|---|
md | Make directory (also mkdir). |
rmdir | Remove directory. Refuses a non-empty directory unless you pass /s - the distinction the exam asks about. |
robocopy | Robust file copy, the one to name for bulk or resumable transfers. Preserves attributes and permissions, retries failures, and can mirror a tree with /mir. If a scenario involves copying a large share or migrating a profile, this is the answer over copy or xcopy. |
Informational
1.5| Command | What it does, and what gets tested |
|---|---|
hostname | Print the computer name. Trivial, and it does appear. |
net user | List or modify local user accounts, including password resets and account creation. |
winver | Show the Windows version and build. The answer to "how do I confirm which feature update is installed". |
whoami | Show the current user context. /groups lists group membership, /priv privileges. The tool for "why am I getting access denied". |
[command] /? | Built-in help for any command. CompTIA lists it explicitly, so it can be the correct answer to "how do you find the right switch". |
OS management
1.5| Command | What it does, and what gets tested |
|---|---|
gpupdate | Reapply Group Policy. /force reapplies every setting rather than only changed ones. The answer to "the policy was changed but the client has not picked it up". |
gpresult | Report which policies actually applied to a user or computer. /r for a summary. Pairs with gpupdate: one pushes, one proves. |
sfc | System File Checker. /scannow scans protected system files and repairs corrupted ones from a cached copy. Appears again in the software troubleshooting domain, because corrupt system files cause the boot and stability faults objective 3.1 covers. |
Linux commands (objective 1.9)
Remember the verb is "Identify". Know what each does; do not learn flags in depth.
File management
1.9| Command | What it does |
|---|---|
ls | List directory contents. -l long format showing permissions and owner, -a includes hidden dotfiles. |
pwd | Print working directory - where you currently are. |
mv | Move or rename. Linux has no separate rename command, which is itself a question. |
cp | Copy files or directories (-r for directories). |
rm | Remove. No recycle bin - removal is immediate and permanent. |
chmod | Change permissions. Know the octal reading: 4 read, 2 write, 1 execute, so 755 is owner full, group and others read and execute. This is the most tested Linux item on the exam. |
chown | Change file owner and group. Permissions versus ownership is the distinction being drawn against chmod. |
grep | Search text for a pattern. The answer to "find which log contains this string". |
find | Search the filesystem for files by name, size, type or age. grep searches inside files, find searches for files - a pairing the exam likes. |
Filesystem, administrative and packages
1.9| Command | What it does |
|---|---|
fsck | Filesystem check and repair - the Linux counterpart to chkdsk. |
mount | Attach a filesystem to the directory tree. Pairs with /etc/fstab below for mounts that persist across reboots. |
su | Switch user, usually to root. Requires the target account's password and gives a full session. |
sudo | Run a single command as another user, usually root, using your own password. The su versus sudo distinction - whole session versus one command, their password versus yours - is reliably asked. |
apt | Package manager on Debian and Ubuntu family distributions. |
dnf | Package manager on Fedora and Red Hat family distributions. Knowing which family each belongs to is the whole question. |
Network and informational
1.9| Command | What it does |
|---|---|
ip | Show and configure addresses, routes and links. The modern replacement for ifconfig - and Linux's answer to ipconfig. |
ping | Reachability test, same as Windows. Note it runs continuously until interrupted rather than stopping after four. |
curl | Transfer data to or from a URL. The tool for testing whether a web service responds from the command line. |
dig | DNS lookup - Linux's nslookup, with more detail. |
traceroute | Trace the route to a destination. Note the spelling: Windows abbreviates to tracert, Linux does not. |
man | Manual pages - the Linux equivalent of /?. |
cat | Print a file's contents, or concatenate files. |
top | Live view of running processes and resource use - Linux's Task Manager. |
ps | Snapshot of running processes. top is live, ps is a moment - that contrast is the question. |
du | Disk usage of files and directories - "what is filling this folder". |
df | Disk free space per filesystem - "which volume is full". du versus df is the other reliably confused pair. |
nano | Simple terminal text editor, the one CompTIA names. |
Configuration files and OS components
1.9| Path | What it holds |
|---|---|
/etc/passwd | User account records. Despite the name it holds no passwords - that is the trap, and it is asked directly. |
/etc/shadow | The hashed passwords, readable only by root. The pairing with /etc/passwd is the point. |
/etc/hosts | Static hostname-to-IP mappings, checked before DNS. Same role as the Windows hosts file. |
/etc/fstab | Filesystems to mount at boot. The persistent counterpart to a manual mount. |
/etc/resolv.conf | DNS resolver configuration - which nameservers this host queries. |
systemd | The init system and service manager on most modern distributions. |
kernel | The core of the OS, managing hardware and processes. |
bootloader | Loads the kernel at startup - GRUB on most distributions. |
Commands are 1 of 36 objectives. Find the other 35.
A cheat sheet fixes one objective. A full-length paper tells you which of the other thirty-five are costing you marks - on an exam where 64% of objectives demand application rather than recall. Free, no credit card.
APLUS2-EXAM-FULL
Redeem the code
Already have an account? Log in to redeem
The six pairs that get confused
Almost every command question on Core 2 is built from one of these. If you learn nothing else on this page, learn these:
tracertvspathping- route quickly, versus route plus per-hop packet loss over minutes. "Intermittent" or "slow" in the scenario means pathping.gpupdatevsgpresult- one pushes policy, one proves what applied. "Has it taken effect?" is gpresult.suvssudo- whole session using their password, versus one command using yours.duvsdf- what is filling this directory, versus which volume is full.grepvsfind- search inside files, versus search for files.chmodvschown- change what can be done, versus change who owns it.
ipconfig maps to ip, nslookup to dig, tracert to traceroute, chkdsk to fsck, Task Manager to top, and /? to man. Learning them as pairs halves the work and answers the comparison questions directly.Test yourself: 5 free questions
No account needed. Each explanation works through why the other three options fail.
Frequently asked questions
Which commands are on the A+ exam?
Two objectives name them explicitly. Core 2 objective 1.5 covers the Microsoft tools: cd, dir, ipconfig, ping, netstat, nslookup, net use, tracert, pathping, chkdsk, format, diskpart, md, rmdir, robocopy, hostname, net user, winver, whoami, gpupdate, gpresult, sfc and the help switch. Objective 1.9 covers Linux: ls, pwd, mv, cp, rm, chmod, chown, grep, find, fsck, mount, su, sudo, apt, dnf, ip, ping, curl, dig, traceroute, man, cat, top, ps, du, df and nano.
What is the difference between tracert and pathping?
Both map the path to a destination. tracert reports each hop quickly and tells you the route. pathping traces the route and then measures packet loss at each hop, taking minutes rather than seconds, and tells you which hop is actually dropping traffic. Speed versus per-hop loss statistics - if a scenario says intermittent or slow, it is pathping.
Do I need to memorise the syntax?
You need to know what each command does and when to reach for it, not every switch. Objective 1.5 is phrased "Given a scenario", so the format is a described problem with four commands as options. The handful of switches genuinely worth knowing are the ones on this page: /all, /flushdns, /f, /r, /s, /force, /scannow, /mir.
Is Linux heavily tested on A+?
No. Linux is one sub-objective out of the eleven in the Operating Systems domain, and it uses "Identify", the shallowest verb on the exam. Learn the command names, their purpose and the five configuration file paths, then stop. Windows takes six of the eleven sub-objectives and is where the marks are.
What does sfc do?
System File Checker scans protected Windows system files and repairs corrupted ones from a cached copy, normally run as sfc /scannow. It is in objective 1.5 as an OS management tool and reappears in the software troubleshooting domain, since corrupt system files cause the boot and stability faults objective 3.1 covers. One of the few commands spanning two domains.
Is this list complete?
Yes, for objectives 1.5 and 1.9 as CompTIA publishes them for 220-1202. Commands appear elsewhere in the objectives incidentally - remote access in 4.9, scripting in 4.8 - but 1.5 and 1.9 are the two that name commands as testable content. Always confirm against the current objectives PDF on CompTIA's own site.