A+ Command Line Reference

The command line tools A+ Core 2 (220-1202) expects you to recognize on sight, with the switches that get tested. Windows commands first, then the Linux and macOS commands from objective 1.9.

Windows network commands

CommandWhat it does
ipconfigShow IP address, subnet mask and default gateway
ipconfig /allFull adapter detail: MAC, DHCP server, DNS servers, lease times
ipconfig /releaseGive up the current DHCP lease
ipconfig /renewAsk DHCP for a new lease
ipconfig /flushdnsClear the local DNS resolver cache
ipconfig /displaydnsPrint what is currently in the resolver cache
ping -t <host>Ping continuously until you press Ctrl+C
ping -n 10 <host>Send exactly 10 echo requests
tracert <host>List every router hop to the destination
pathping <host>Trace the route, then measure loss at each hop
nslookup <name>Query DNS for a record, or test a specific DNS server
netstat -aAll connections and listening ports
netstat -nShow addresses and ports as numbers, no name lookup
netstat -bShow the executable behind each connection (needs elevation)
net use Z: \\server\shareMap a drive letter to a network share

Windows file and disk commands

CommandWhat it does
dirList the contents of the current directory
cd <path>Change directory (cd .. moves up one level)
md / rdCreate or remove a directory
copyCopy files in one directory; does not touch subdirectories
xcopy /sCopy directories and subdirectories, skipping empty ones
xcopy /eCopy directories and subdirectories, including empty ones
robocopy /mirMirror a tree so the destination matches the source exactly
delDelete one or more files
format <drive> /fs:ntfsFormat a volume with the NTFS file system
chkdsk /fFix file system errors on the volume
chkdsk /rLocate bad sectors and recover readable data (includes /f)
sfc /scannowScan protected system files and repair damaged ones
sfc /verifyonlyScan protected system files and report, with no repair
diskpartInteractive disk, partition and volume management
dism /online /cleanup-image /restorehealthRepair the component store that sfc restores files from

Windows system and policy commands

CommandWhat it does
hostnamePrint the computer name
winverShow the Windows edition, version and build number
tasklistList running processes with their PIDs
taskkill /pid <id> /fForce a process to terminate by PID
gpupdate /forceReapply every Group Policy setting, changed or not
gpresult /rShow which policies actually applied to this user and computer
net userList the local user accounts
net user <name> /addCreate a local user account (needs elevation)
shutdown /s /t 0Shut down now
shutdown /r /t 0Restart now
shutdown /aAbort a shutdown that is still in its timeout
<command> /?Print the built-in help and switch list for any command

Linux and macOS file commands

CommandWhat it does
ls -lLong listing: permissions, owner, group, size, date
pwdPrint the working directory
cd /pathChange directory
cp -r <src> <dst>Copy a directory and everything under it
mv <old> <new>Move a file, or rename it in place
rm -r <dir>Delete a directory and its contents
mkdir -p a/b/cCreate a directory and any missing parents
cat <file>Print a file to the terminal
grep -i <pattern> <file>Print matching lines, ignoring case
find /path -name "*.log"Search a directory tree by file name
chmod 644 <file>Set permissions using an octal value
chown user:group <file>Change the owner and group of a file
nano <file>Edit a file in a terminal text editor

Linux and macOS system commands

CommandWhat it does
sudo <command>Run one command with elevated rights
su -Switch to another user account, root by default
apt-get updateRefresh the package list on Debian and Ubuntu
apt-get install <pkg>Install a package on Debian and Ubuntu
yum install <pkg>Install a package on Red Hat family distributions
ip aShow interfaces and their addresses
dig <name>Query DNS records
df -hFree and used disk space per file system, human readable
du -sh <dir>Total size of one directory
ps auxSnapshot of every running process
topLive view of processes, CPU and memory
man <command>Open the manual page for a command
passwdChange a password

chmod permission values

ValueBitsMeaning
7rwxRead, write, execute
6rw-Read and write
5r-xRead and execute
4r--Read only
3-wxWrite and execute
2-w-Write only
1--xExecute only
0---No access
755rwxr-xr-xOwner full; group and others read and execute
644rw-r--r--Owner read and write; everyone else read
600rw-------Owner read and write; nobody else has access
777rwxrwxrwxEveryone full control, almost never the right answer

Ready to test yourself?

Memorizing a table is a start, practice questions make it stick.