Command Prompt Commands

Windows Command Prompt (cmd.exe). Options start with / (dir /s, ipconfig /all), and commands are not case-sensitive.

Practice these in Terminal Practice

Moving around

cd
Shows or changes the current folder. cd .. goes up.
dir
Lists files and folders. /s includes subfolders, /b shows names only.
tree
Shows folders as a tree. /f includes files.

Reading and searching

type
Shows the contents of a text file.
more
Shows text one screen at a time.
findstr
Finds lines containing text, like grep. /i ignores case.
find
Finds lines containing a "quoted string". /c counts them, /i ignores case.
sort
Sorts lines of text.

Changing files

md
Makes a folder (also: mkdir). Creates missing parent folders too.
rd
Removes a folder (also: rmdir). /s removes everything inside, /q skips the question.
copy
Copies a file: copy <source> <destination>.
move
Moves a file or folder: move <source> <destination>.
ren
Renames a file: ren <old> <new>.
del
Deletes files (also: erase). Wildcards like *.tmp work.

Network

ipconfig
Shows IP settings. /all for everything, /flushdns clears the DNS cache.
ping
Checks whether another computer answers. -n sets the count.
tracert
Shows each router (hop) on the way to another computer.
nslookup
Asks DNS for the IP address of a name.
netstat
Shows network connections and listening ports. -an = numbers, -ano adds the process ID.
arp
Shows the ARP cache (IP → MAC addresses on this network). Use arp -a.
getmac
Shows this computer's MAC address.

Processes, services, users

tasklist
Lists running programs. tasklist /fi "imagename eq notepad.exe" filters.
taskkill
Ends a program: taskkill /im notepad.exe or taskkill /pid 1234. /f forces it.
sc
Service control: sc query <name>, sc config <name> start= demand|auto|disabled.
net
net user, net localgroup, net start/stop <service>, net use.

About this PC

systeminfo
Shows OS version, memory, domain, and more.
hostname
Shows this computer's name.
whoami
Shows who you are logged in as.
ver
Shows the Windows version.
date
Shows the date (date /t).
time
Shows the time (time /t).

Repair and policy

sfc
System File Checker: sfc /scannow checks and repairs Windows files.
chkdsk
Checks a disk for errors (read-only unless /f).
gpupdate
Refreshes Group Policy. /force re-applies every policy.
gpresult
Shows which Group Policies apply. Use gpresult /r.
shutdown
Restarts or shuts down the computer (blocked in this simulation).

The console

help
Lists the commands for this question (HELP ALL = every command).
echo
Prints text.
cls
Clears the screen.
exit
Closes the Command Prompt (not in this simulation).

From localhostmonkey.com/learn/cheat-sheets/cmd/