Here’s a complete list of must-know CMD (Command Prompt) commands — grouped by category — useful for everyone whether you are developers, IT pros, ethical hackers or students.
Basic Navigation Commands
| Command | Description |
|---|
dir | Lists files and folders in the current directory |
cd <folder> | Changes the directory |
cd .. | Moves up one directory |
cd / | Moves to the root directory |
cls | Clears the screen |
exit | Closes the Command Prompt |
echo <text> | Displays a line of text |
help | Lists all available commands |
help <command> | Shows detailed info for a command |
File & Folder Management
| Command | Description |
|---|
md <folder> or mkdir <folder> | Creates a new directory |
rd <folder> or rmdir <folder> | Removes an empty directory |
del <file> | Deletes a file |
copy <source> <destination> | Copies files |
xcopy <source> <destination> /s /e | Copies directories including subfolders |
move <source> <destination> | Moves or renames files |
rename <old> <new> | Renames a file or folder |
type <file> | Displays file content |
attrib | Displays or changes file attributes |
tree | Shows folder structure graphically |
System Information & Management
| Command | Description |
|---|
systeminfo | Displays detailed system information |
hostname | Displays computer name |
ver | Shows Windows version |
tasklist | Lists all running processes |
taskkill /IM <processname> /F | Kills a running process |
wmic cpu get name | Displays CPU name |
wmic logicaldisk get size,freespace,caption | Shows disk space |
driverquery | Lists all installed drivers |
set | Displays or sets environment variables |
path | Displays or sets search path for executables |
Networking Commands
| Command | Description |
|---|
ipconfig | Displays IP address, subnet, and gateway |
ipconfig /all | Shows detailed network info |
ping <hostname> | Tests connectivity |
tracert <hostname> | Traces route to a host |
netstat | Displays network connections and ports |
nslookup <domain> | Looks up DNS info for a domain |
getmac | Shows MAC address |
arp -a | Displays ARP cache |
netsh wlan show profiles | Lists saved Wi-Fi networks |
netsh wlan show profile name="<SSID>" key=clear | Shows Wi-Fi password |
net use | Shows shared network resources |
net view | Lists computers on the same network |
User & Access Control
| Command | Description |
|---|
net user | Lists all user accounts |
net user <username> | Displays user details |
net user <username> <password> /add | Creates new user |
net localgroup administrators <username> /add | Adds user to admin group |
net user <username> /delete | Deletes user |
whoami | Displays current logged-in user |
runas /user:<username> cmd | Runs a command as another user |
Disk & File Utilities
| Command | Description |
|---|
chkdsk | Checks disk for errors |
diskpart | Opens disk partition tool |
format <drive>: | Formats a drive |
label | Changes drive label |
vol | Displays volume label and serial number |
sfc /scannow | Scans and repairs system files |
defrag <drive>: | Defragments a disk |
Advanced / Admin Commands
| Command | Description |
|---|
powershell | Opens PowerShell |
gpupdate /force | Refreshes group policies |
shutdown /s /t 0 | Shuts down computer immediately |
shutdown /r /t 0 | Restarts computer |
cipher /w:<drive> | Wipes deleted data securely |
net start | Lists running Windows services |
net stop <service> | Stops a service |
sc query | Lists all services |
taskschd.msc | Opens Task Scheduler |
regedit | Opens Windows Registry Editor |
Ethical Hacking / Diagnostic (For Learning)
| Command | Description |
|---|
netstat -ano | Shows open ports and process IDs |
ipconfig /displaydns | Displays cached DNS entries |
arp -a | Shows local network connections |
route print | Displays routing table |
nslookup -type=mx gmail.com | Finds mail servers of a domain |
tracert google.com | Trace network hops |
| `systeminfo | find "Time Zone"` |
Useful Shortcuts
| Shortcut | Description |
|---|
↑ / ↓ | Scroll through command history |
Tab | Auto-complete file or folder names |
Ctrl + C | Stop running command |
Ctrl + A | Select all text in CMD |
Ctrl + M | Enables mark mode (select text manually) |
-------------------------------------------------------------------------------------------------------------------------------------------------------
List of common Windows tasks that can be done both from the CMD and from the graphical interface (UI):-
1. Creating or Deleting Files/Folders
| Task | UI Method | CMD Command |
|---|
| Create a folder | Right-click → New → Folder | mkdir MyFolder |
| Delete a folder | Right-click → Delete | rmdir /s /q MyFolder |
| Create a file | Right-click → New → Text Document | echo Hello > file.txt |
| Delete a file | Select → Delete | del file.txt |
2. Checking Network Connectivity
| Task | UI Method | CMD Command |
|---|
| Check Internet connection | Open Settings → Network Status | ping google.com |
| View IP address | Control Panel → Network → Details | ipconfig |
| View all network connections | Network & Sharing Center | netstat -an |
3. Opening Applications
| Task | UI Method | CMD Command |
|---|
| Open Notepad | Search → Notepad | notepad |
| Open Calculator | Search → Calculator | calc |
| Open Paint | Search → Paint | mspaint |
| Open Control Panel | Click Start → Control Panel | control |
4. Searching Files or Folders
| Task | UI Method | CMD Command |
|---|
| Search file by name | File Explorer search bar | dir filename.txt /s |
| Search files by extension | File Explorer filters | dir *.jpg /s |