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.

Windows (1.5)23 commands
Linux (1.9)27 commands
1.5 verbGiven a scenario
1.9 verbIdentify
Read the verbs before you read the list. Objective 1.5 says "Given a scenario, use the appropriate Microsoft command-line tools" - so Windows commands arrive as a described fault with four commands as options, and you need to pick the right tool. Objective 1.9 says "Identify common features and tools of the Linux client/desktop", the shallowest verb on the exam. Learn Windows to the level of choosing under pressure. Learn Linux to the level of recognition, and no further.
Your free A+ Core 2 exam code

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.

Windows commands (objective 1.5)

Navigation

1.5
CommandWhat it does, and what gets tested
cdChange 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.
dirList 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
CommandWhat it does, and what gets tested
ipconfigShow 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.
pingTest 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.
netstatShow 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.
nslookupQuery 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 useMap, list and disconnect network drives. net use Z: \\server\share to map, /delete to remove, /persistent:yes to survive a reboot.
tracertTrace the route to a destination, hop by hop. Fast. Tells you where the path goes and where it stops.
pathpingTrace 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
CommandWhat it does, and what gets tested
chkdskCheck 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.
formatFormat 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.
diskpartInteractive 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
CommandWhat it does, and what gets tested
mdMake directory (also mkdir).
rmdirRemove directory. Refuses a non-empty directory unless you pass /s - the distinction the exam asks about.
robocopyRobust 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
CommandWhat it does, and what gets tested
hostnamePrint the computer name. Trivial, and it does appear.
net userList or modify local user accounts, including password resets and account creation.
winverShow the Windows version and build. The answer to "how do I confirm which feature update is installed".
whoamiShow 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
CommandWhat it does, and what gets tested
gpupdateReapply 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".
gpresultReport which policies actually applied to a user or computer. /r for a summary. Pairs with gpupdate: one pushes, one proves.
sfcSystem 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
CommandWhat it does
lsList directory contents. -l long format showing permissions and owner, -a includes hidden dotfiles.
pwdPrint working directory - where you currently are.
mvMove or rename. Linux has no separate rename command, which is itself a question.
cpCopy files or directories (-r for directories).
rmRemove. No recycle bin - removal is immediate and permanent.
chmodChange 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.
chownChange file owner and group. Permissions versus ownership is the distinction being drawn against chmod.
grepSearch text for a pattern. The answer to "find which log contains this string".
findSearch 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
CommandWhat it does
fsckFilesystem check and repair - the Linux counterpart to chkdsk.
mountAttach a filesystem to the directory tree. Pairs with /etc/fstab below for mounts that persist across reboots.
suSwitch user, usually to root. Requires the target account's password and gives a full session.
sudoRun 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.
aptPackage manager on Debian and Ubuntu family distributions.
dnfPackage manager on Fedora and Red Hat family distributions. Knowing which family each belongs to is the whole question.

Network and informational

1.9
CommandWhat it does
ipShow and configure addresses, routes and links. The modern replacement for ifconfig - and Linux's answer to ipconfig.
pingReachability test, same as Windows. Note it runs continuously until interrupted rather than stopping after four.
curlTransfer data to or from a URL. The tool for testing whether a web service responds from the command line.
digDNS lookup - Linux's nslookup, with more detail.
tracerouteTrace the route to a destination. Note the spelling: Windows abbreviates to tracert, Linux does not.
manManual pages - the Linux equivalent of /?.
catPrint a file's contents, or concatenate files.
topLive view of running processes and resource use - Linux's Task Manager.
psSnapshot of running processes. top is live, ps is a moment - that contrast is the question.
duDisk usage of files and directories - "what is filling this folder".
dfDisk free space per filesystem - "which volume is full". du versus df is the other reliably confused pair.
nanoSimple terminal text editor, the one CompTIA names.

Configuration files and OS components

1.9
PathWhat it holds
/etc/passwdUser account records. Despite the name it holds no passwords - that is the trap, and it is asked directly.
/etc/shadowThe hashed passwords, readable only by root. The pairing with /etc/passwd is the point.
/etc/hostsStatic hostname-to-IP mappings, checked before DNS. Same role as the Windows hosts file.
/etc/fstabFilesystems to mount at boot. The persistent counterpart to a manual mount.
/etc/resolv.confDNS resolver configuration - which nameservers this host queries.
systemdThe init system and service manager on most modern distributions.
kernelThe core of the OS, managing hardware and processes.
bootloaderLoads the kernel at startup - GRUB on most distributions.
Your free A+ Core 2 exam code

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:

  1. tracert vs pathping - route quickly, versus route plus per-hop packet loss over minutes. "Intermittent" or "slow" in the scenario means pathping.
  2. gpupdate vs gpresult - one pushes policy, one proves what applied. "Has it taken effect?" is gpresult.
  3. su vs sudo - whole session using their password, versus one command using yours.
  4. du vs df - what is filling this directory, versus which volume is full.
  5. grep vs find - search inside files, versus search for files.
  6. chmod vs chown - change what can be done, versus change who owns it.
💡
And one cross-platform mapping worth holding: 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.