6.2 KiB
OS-4: Windows Command Line
Status: not started
Domain:
- 1.0 Operating Systems
Objective alignment:
- 1.5 Windows command-line tools
- 1.7 Windows networking basics
- 3.1 Windows troubleshooting support
What You Need To Know
Core 2 command questions usually ask, "Which command would you use?"
Think in buckets:
- Navigation: move around files and folders.
- Network: check IP address, connectivity, DNS, routes, and connections.
- Disk/file repair: check file systems and system files.
- Identity/system info: computer name, signed-in user, Windows version.
- Group Policy: update or report applied policies.
- Help: find command syntax.
Some commands are safe to run anytime. Others can change disks or files, so use them carefully.
Memory Tricks
ipconfig= IP configuration.ping= "Are you alive?"tracert= trace route.nslookup= name server lookup.netstat= network statistics.chkdsk= check disk.sfc= system file checker.gpupdate= Group Policy update.gpresult= Group Policy result./?= "How do I use this?"
Commands To Enter
Enter these on Windows PowerShell or Command Prompt.
Navigation
dir
What it does:
- Lists files and folders in the current directory.
- Similar Linux command:
ls.
cd
What it does:
- Shows or changes the current directory.
cd ..moves up one folder.
mkdir test-folder
What it does:
- Creates a folder named
test-folder. mddoes the same thing.
rmdir test-folder
What it does:
- Removes an empty folder.
rddoes the same thing.
Network
ipconfig
What it does:
- Shows IP address, subnet mask, and default gateway for network adapters.
ipconfig /all
What it does:
- Shows detailed adapter info, including MAC address, DNS servers, DHCP status, and lease details.
ping 127.0.0.1
What it does:
- Tests the local TCP/IP stack using the loopback address.
- If this fails, the local networking stack has a problem.
ping 8.8.8.8
What it does:
- Tests basic IP connectivity to an external address.
- If this works but names do not, suspect DNS.
nslookup example.com
What it does:
- Queries DNS for a hostname.
- Useful when websites fail by name but IP connectivity works.
tracert example.com
What it does:
- Shows the router hops toward a destination.
- Useful for finding where a path may stop.
pathping example.com
What it does:
- Combines route tracing with packet-loss statistics.
- Takes longer than
tracert.
netstat -ano
What it does:
- Shows active connections and listening ports.
-ashows all connections/listeners.-nkeeps addresses numeric.-oshows process IDs.
Disk and File Repair
chkdsk
What it does:
- Checks the disk file system status.
chkdsk /f
What it does:
- Fixes logical file system errors.
- May need to run at startup if the drive is locked.
chkdsk /r
What it does:
- Looks for bad sectors and recovers readable information.
- Includes
/f. - Can take a long time.
sfc /scannow
What it does:
- Scans protected Windows system files and repairs them when possible.
Identity and System Info
hostname
What it does:
- Shows the computer name.
whoami
What it does:
- Shows the current user.
whoami /all
What it does:
- Shows current user, groups, privileges, and security identifier details.
winver
What it does:
- Opens the Windows version/build dialog.
Group Policy
gpupdate /force
What it does:
- Forces a Group Policy refresh.
- Most relevant on domain-joined business systems.
gpresult /r
What it does:
- Shows Resultant Set of Policy summary for the user/computer.
- Use it to verify what policies applied.
Help
ipconfig /?
What it does:
- Shows help and syntax for
ipconfig. - Most Windows commands support
/?.
help dir
What it does:
- Shows help for the
dircommand.
Commands To Know But Treat Carefully
format
What it does:
- Formats a volume.
- Warning: this can erase data.
diskpart
What it does:
- Opens a powerful disk partitioning tool.
- Warning: incorrect commands can erase partitions or make a system unbootable.
robocopy
What it does:
- Copies files and folders robustly.
- Useful for backups and migrations.
- Be careful with mirror options because they can delete destination files.
Linux Comparison Commands
ls
pwd
cd
mkdir test-folder
rmdir test-folder
ip addr
ping 127.0.0.1
traceroute example.com
dig example.com
df -h
du -h
ps aux
top
Why this matters:
- Linux command practice helps you understand the same troubleshooting ideas across operating systems.
- Exact commands differ, but the goal is often the same: identify the system, check network state, inspect storage, and view running processes.
Mini Lab
Goal:
- Practice safe command-line troubleshooting.
Windows:
- Run
hostname. - Run
whoami. - Run
winver. - Run
ipconfig. - Run
ipconfig /all. - Run
ping 127.0.0.1. - Run
nslookup example.com. - Run
netstat -ano. - Run
sfc /scannow. - Run
ipconfig /?.
Record:
- Computer name:
- Current user:
- IPv4 address:
- Default gateway:
- DNS server:
- Did loopback ping work?
- Did DNS lookup work?
- One listening port from
netstat -ano:
Linux:
- Run
hostname. - Run
whoami. - Run
ip addr. - Run
ping -c 4 127.0.0.1. - Run
df -h. - Run
ps aux. - Run
top, then pressq.
Record:
- Hostname:
- Current user:
- IP address:
- Root filesystem free space:
- One running process:
Quick Check Before Quiz
You are ready for the OS-4 quiz when you can answer these without looking:
- Which command shows full Windows IP configuration?
- Which command tests DNS name resolution?
- Which command shows active connections and process IDs?
- Which command repairs protected Windows system files?
- Which command forces Group Policy refresh?
- Which commands can erase data if misused?