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
| Command | What it does |
|---|---|
| ipconfig | Show IP address, subnet mask and default gateway |
| ipconfig /all | Full adapter detail: MAC, DHCP server, DNS servers, lease times |
| ipconfig /release | Give up the current DHCP lease |
| ipconfig /renew | Ask DHCP for a new lease |
| ipconfig /flushdns | Clear the local DNS resolver cache |
| ipconfig /displaydns | Print 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 -a | All connections and listening ports |
| netstat -n | Show addresses and ports as numbers, no name lookup |
| netstat -b | Show the executable behind each connection (needs elevation) |
| net use Z: \\server\share | Map a drive letter to a network share |
Windows file and disk commands
| Command | What it does |
|---|---|
| dir | List the contents of the current directory |
| cd <path> | Change directory (cd .. moves up one level) |
| md / rd | Create or remove a directory |
| copy | Copy files in one directory; does not touch subdirectories |
| xcopy /s | Copy directories and subdirectories, skipping empty ones |
| xcopy /e | Copy directories and subdirectories, including empty ones |
| robocopy /mir | Mirror a tree so the destination matches the source exactly |
| del | Delete one or more files |
| format <drive> /fs:ntfs | Format a volume with the NTFS file system |
| chkdsk /f | Fix file system errors on the volume |
| chkdsk /r | Locate bad sectors and recover readable data (includes /f) |
| sfc /scannow | Scan protected system files and repair damaged ones |
| sfc /verifyonly | Scan protected system files and report, with no repair |
| diskpart | Interactive disk, partition and volume management |
| dism /online /cleanup-image /restorehealth | Repair the component store that sfc restores files from |
Windows system and policy commands
| Command | What it does |
|---|---|
| hostname | Print the computer name |
| winver | Show the Windows edition, version and build number |
| tasklist | List running processes with their PIDs |
| taskkill /pid <id> /f | Force a process to terminate by PID |
| gpupdate /force | Reapply every Group Policy setting, changed or not |
| gpresult /r | Show which policies actually applied to this user and computer |
| net user | List the local user accounts |
| net user <name> /add | Create a local user account (needs elevation) |
| shutdown /s /t 0 | Shut down now |
| shutdown /r /t 0 | Restart now |
| shutdown /a | Abort 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
| Command | What it does |
|---|---|
| ls -l | Long listing: permissions, owner, group, size, date |
| pwd | Print the working directory |
| cd /path | Change 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/c | Create 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
| Command | What it does |
|---|---|
| sudo <command> | Run one command with elevated rights |
| su - | Switch to another user account, root by default |
| apt-get update | Refresh 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 a | Show interfaces and their addresses |
| dig <name> | Query DNS records |
| df -h | Free and used disk space per file system, human readable |
| du -sh <dir> | Total size of one directory |
| ps aux | Snapshot of every running process |
| top | Live view of processes, CPU and memory |
| man <command> | Open the manual page for a command |
| passwd | Change a password |
chmod permission values
| Value | Bits | Meaning |
|---|---|---|
| 7 | rwx | Read, write, execute |
| 6 | rw- | Read and write |
| 5 | r-x | Read and execute |
| 4 | r-- | Read only |
| 3 | -wx | Write and execute |
| 2 | -w- | Write only |
| 1 | --x | Execute only |
| 0 | --- | No access |
| 755 | rwxr-xr-x | Owner full; group and others read and execute |
| 644 | rw-r--r-- | Owner read and write; everyone else read |
| 600 | rw------- | Owner read and write; nobody else has access |
| 777 | rwxrwxrwx | Everyone full control, almost never the right answer |
Ready to test yourself?
Memorizing a table is a start, practice questions make it stick.