Essential DOS Commands for Network Security Beginners
Working Directory and Root Directory Concepts
Working Directory
The working directory represents the current location where operations are being performed. When executing commands, the system operates from this location.
For example, if operations occur within C:\intel\logs, then this path becomes the active working directory.
The command prompt interface displays the current working directory directly.
Root Directory
The root directory represents the topmost level of a storage device. Each disk partition has its own root directory.
For instance, when accessing the C drive directly, you're viewing the C drive's root directory.
Commonly Used DOS Commands
1. MKDIR Command
Purpose: Create new empty directories (directories are equivalent to folders)
Example 1: Create a directory named 007
mkdir 007
Example 2: Create directory 008 within E:\pte
Method One: Specify complete path
mkdir e:\\pte\\008
Method Two: Navigate first, then create
e:
cd pte
mkdir 008
2. CD Command
Purpose: Change the working directory
CD command variations include:
cd .. Move up one level to parent directory
cd \ Navigate to current drive's root directory
d: Switch to D drive
c: Switch to C drive
Examples:
Example 1: Navigate to C drive root
First step: c:
Second step: cd \\
Example 2: Navigate to D drive root
d:
Example 3: Navigate to C:\windows\system32
Step 1: c:
Step 2: cd \\
Step 3: cd windows\\system32
3. CLS Command
Purpose: Clear the screen display
Note: CLS does not support keyboard shortcuts
4. DIR Command
Purpose: Display all files and directories in the current working directory
5. IPCONFIG Command
Purpose: Display IP address configuration for network adapters
Additional Options:
ipconfig Display basic IP address information
ipconfig /all Show detailed IP configuration
ipconfig /release Release current IP address
ipconfig /renew Obtain new IP address
ipconfig /flushdns Refresh DNS cache
Note: IP release and renewal do not affect static IP configurations
- Dynamic IP: Automatically assigned
- Static IP: Manually configured
6. PING Command
Functions:
- Test connnectivity between local and target hosts
Sends packets to the destination host and receives responses, indicating successful communication between systems.
Note: Default ping sends 4 packets
- Perform domain name resolution [Converting domain names to IP addresses]
PING can send continuous packets using: ping -t
Press Ctrl+C to stop transmission
Domain Name Resolution
Domain names represent web addresses, and resolution converts these domains to corresponding IP addresses.
DNS servers facilitate domain name resolution.
DNS Resolution Process: Step 1: Check DNS cache for existing records Step 2: Examine local hosts file (hosts file located at: c:\windows\system32\drivers\etc\hosts) To modify the hosts file, copy it to desktop, make changes, then return it to the original location Step 3: Send request to DNS server
7. NETSTAT Command
NETSTAT provides network connection status information.
Local address includes the server port number as the final decimal value, similarly for remote addresses.
Port States:
LISTEN: Local port is open but no connections established
ESTABLISHED: Active communication with remote host [Connection established]
NETSTAT Additional Options: -a: Display all connections -n: Show numeric port numbers. Without -n, the command performs reverse DNS lookup, slowing execution. -t: Display TCP protocol connections -u: Display UDP protocol connections -o: Show associated process IDs. Use -o to identify procesess for termination. -l: Display listening network services
Common Computer Ports:
80, 443, 3389, 3306, 5433, 111, 9000, 53, 20, 21, 22, 445, etc.
8. TASKLIST Command
Purpose: Display all currently running processes (similar to Task Manager)
Additional parameters: /v: Show detailed process information
Commands:
tasklist
tasklist /v
9. TASKKILL Command
Purpose: Terminate specified processes
Format 1: Kill by executable name: taskkill /F /IM application.exe
Format 2: Kill by process PID: taskkill /PID [PROCESS_ID]
10. FINDSTR Command
Purpose: Filter content, typically used with pipe operator (|)