Essential Windows Terminal Commands
Master essential Windows Terminal commands in PowerShell and CMD. This guide covers navigation, file management, system information, networking, and advanced techniques to boost productivity and efficiency.

The Windows Terminal has transformed command-line interaction on Windows. It offers a modern, tabbed interface with customizable profiles and support for shells like PowerShell, CMD, and WSL. Unlocking the Terminal's true potential lies in mastering the commands you can execute within these shells.
This post dives deep into essential Windows Terminal commands, categorized for easy access and explained with detailed examples to supercharge your productivity. We'll focus primarily on PowerShell and CMD, highlighting their unique strengths.
Understanding Your Shell
The commands you use depend on the active shell in your Terminal tab. Switch between shells by creating new tabs and selecting a profile. Knowing which shell you're using is critical, as commands are often shell-specific.
- PowerShell: Microsoft's modern, object-oriented shell, ideal for scripting and system administration.
- CMD (Command Prompt): The traditional Windows command interpreter, best for legacy compatibility and basic tasks.
- WSL (Windows Subsystem for Linux): Run Linux distributions directly on Windows using their respective shells (e.g., Bash).
I. Navigation & File Management
These commands are fundamental for interacting with your file system.
cd(Change Directory): Navigates between directories.PowerShell/CMD:
cd <path>: Navigate to the specified directory. Example:cd C:\Users\MyUser\Documentscd ..: Move one level up in the directory hierarchy.cd .: Refer to the current directory (used in relative paths).cd \: Navigate to the root directory of the current drive.cd ~: (PowerShell) Navigate to your user profile directory (e.g.,C:\Users\MyUser).
Tip: Use tab completion after typing
cdand the first few characters of the directory name for faster navigation.
dir(Directory Listing): Displays files and subdirectories.CMD: *
dir: List contents of the current directory. *dir /w: Wide format (more files per line). *dir /p: Pause output after each screenful. *dir /a: Display all files (including hidden and system files)./ahfor hidden only,/asfor system only. *dir <path>: List contents of the specified directory. Example:dir C:\Windows\System32*dir *.txt: List all.txtfiles. *dir /s: List contents of the current directory and all subdirectories (use with caution!). PowerShell: *Get-ChildItem: PowerShell's equivalent ofdir. *Get-ChildItem -Path <path>: List contents of the specified directory. Example:Get-ChildItem -Path C:\Windows\System32*Get-ChildItem -File: List only files. *Get-ChildItem -Directory: List only directories. *Get-ChildItem -Hidden: List hidden files and directories. *Get-ChildItem *.txt: List all.txtfiles. *Get-ChildItem -Recurse: List contents recursively. Equivalent todir /s. Use with caution! Advanced PowerShell: *Get-ChildItem | Sort-Object Name: Sort output by name. *Get-ChildItem | Where-Object {$_.Length -gt 1MB}: List files larger than 1MB.mkdir(Make Directory): Creates a new directory.PowerShell/CMD: *
mkdir <directory_name>: Create a new directory. Example:mkdir NewFolder*mkdir <path>\<directory_name>: Create a new directory in the specified location. Example:mkdir C:\Users\MyUser\Documents\NewFolderPowerShell (Alternative):New-Item -ItemType Directory -Name <directory_name>rmdir(Remove Directory): Removes a directory.CMD:
rmdir <directory_name>: Remove an empty directory.rmdir /s <directory_name>: Remove a directory and all its contents (prompt for confirmation).rmdir /s /q <directory_name>: Remove a directory and all its contents without prompting (USE WITH EXTREME CAUTION!).
PowerShell:
Remove-Item <directory_name>: Remove an empty directory.Remove-Item <directory_name> -Recurse: Remove a directory and all its contents.Remove-Item <directory_name> -Recurse -Force: Remove without prompting (USE WITH EXTREME CAUTION!).
copy(Copy Files): Copies files.CMD:
copy <source_file> <destination_path>: Copy a file to a new location. Example:copy C:\MyFile.txt D:\Backup\copy *.txt D:\Backup\: Copy all.txtfiles.copy <source_file> <destination_file>: Copy and rename a file. Example:copy C:\MyFile.txt D:\Backup\MyFileBackup.txt
PowerShell:
Copy-Item <source_file> <destination_path>: Copy a file to a new location. Example:Copy-Item C:\MyFile.txt D:\Backup\Copy-Item *.txt D:\Backup\: Copy all.txtfiles.Copy-Item <source_file> <destination_file>: Copy and rename a file. Example:Copy-Item C:\MyFile.txt D:\Backup\MyFileBackup.txtCopy-Item <source_directory> <destination_path> -Recurse: Copy a directory and its contents.
move(Move/Rename Files): Moves or renames files.CMD:
move <source_file> <destination_path>: Move a file.move <source_file> <destination_file>: Rename a file.move <source_directory> <destination_path>: Move a directory.
PowerShell:
Move-Item <source_file> <destination_path>: Move a file.Move-Item <source_file> <destination_file>: Rename a file.Move-Item <source_directory> <destination_path>: Move a directory.
del(Delete Files): Deletes files.CMD:
del <file_name>: Delete a single file.del *.txt: Delete all.txtfiles.del /f <file_name>: Delete a read-only file.del /s <file_name>: Delete from the current directory and all subdirectories (USE WITH EXTREME CAUTION!).del /q <file_name>: Delete without prompting (USE WITH EXTREME CAUTION!).del /f /q *.log: Delete all.logfiles without prompting, even if read-only.
PowerShell:
Remove-Item <file_name>: Delete a single file.Remove-Item *.txt: Delete all.txtfiles.Remove-Item <file_name> -Force: Delete a read-only file without prompting.Remove-Item <file_name> -Recurse: Delete from the current directory and all subdirectories (USE WITH EXTREME CAUTION!).Remove-Item *.log -Force: Delete all.logfiles without prompting, even if read-only.
type(Display File Content): Displays the contents of a text file.CMD:
type <file_name>: Display the contents of the specified file.
PowerShell:
Get-Content <file_name>: Display the contents of the specified file (more powerful thantype).Get-Content <file_name> -TotalCount 10: Display the first 10 lines.Get-Content <file_name> -Tail 10: Display the last 10 lines.
echo(Display Text): Displays text on the console.- PowerShell/CMD:
echo <text>: Display the specified text. Example:echo Hello World!echo > <file_name>: Create an empty file. Example:echo > newfile.txtecho <text> > <file_name>: Write text to a file (overwrites).echo <text> >> <file_name>: Append text to a file.
- PowerShell/CMD:
II. System Information & Management
These commands provide system information and management capabilities.
systeminfo: Displays detailed system configuration.- CMD/PowerShell:
systeminfo
- CMD/PowerShell:
tasklist: Lists running processes.CMD:
tasklist: List all running processes.tasklist /v: Provide detailed information.tasklist /fi "imagename eq notepad.exe": List onlynotepad.exeprocesses.
PowerShell:
Get-Process: List all running processes.Get-Process | Where-Object {$_.ProcessName -eq "notepad"}: List processes named "notepad".
taskkill: Terminates a running process (USE WITH CAUTION!).CMD:
taskkill /im <image_name>: Terminate all processes with the specified image name. Example:taskkill /im notepad.exetaskkill /pid <process_id>: Terminate the process with the specified ID (found usingtasklist).taskkill /f /im <image_name>: Force termination.
PowerShell:
Stop-Process -Name <process_name>: Stop processes with the specified name. Example:Stop-Process -Name notepadStop-Process -Id <process_id>: Stop the process with the specified ID (found usingGet-Process).Stop-Process -Name <process_name> -Force: Force termination.
ipconfig: Displays IP configuration information.- CMD/PowerShell:
ipconfig: Basic information.ipconfig /all: Detailed information.ipconfig /flushdns: Clear the DNS resolver cache.ipconfig /renew: Renew the IP address lease.
- CMD/PowerShell:
ping: Tests network connectivity.- CMD/PowerShell:
ping <host_name_or_ip_address>: Example:ping google.com
- CMD/PowerShell:
tracert(Trace Route): Traces the route packets take to reach a host.- CMD/PowerShell:
tracert <host_name_or_ip_address>: Example:tracert google.com
- CMD/PowerShell:
shutdown: Shuts down or restarts the system.- CMD/PowerShell:
shutdown /s /t 0: Shutdown immediately.shutdown /r /t 0: Restart immediately.shutdown /a: Abort a pending shutdown.
- CMD/PowerShell:
Get-ComputerInfo(PowerShell): Provides comprehensive hardware and software information.- PowerShell:
Get-ComputerInfo(Output can be verbose!)
- PowerShell:
Get-Process | Sort-Object CPU -Descending | Select-Object -First 5(PowerShell): Shows the top 5 CPU-intensive processes.
III. Networking Commands
These are useful for network management and troubleshooting.
netstat: Displays active network connections and listening ports.- CMD/PowerShell:
netstat -a: Displays all active TCP connections and listening ports (TCP and UDP).netstat -b: Shows the executable involved in creating each connection or listening port.netstat -n: Displays addresses and ports numerically (no name resolution).netstat -ano: Displays all active connections (TCP and UDP), using numeric addresses, and includes the Process ID (PID) for each connection. Crucial for identifying which application is using a specific port.
- CMD/PowerShell:
nslookup: Queries DNS servers for domain/IP information.- CMD/PowerShell:
nslookup: Enters interactive mode.nslookup <domain_name>: Finds the IP address of the specified domain. Example:nslookup google.comnslookup <ip_address>: Finds the domain name associated with the IP address (reverse lookup).
- CMD/PowerShell:
IV. Advanced PowerShell Techniques
PowerShell's object-oriented nature allows for powerful command chaining.
Piping (
|): Passes output from one command as input to the next.Get-Process | Where-Object {$_.CPU -gt 10} | Select-Object ProcessName, CPU: Finds processes using >10% CPU and displays their name and CPU usage.
Variables: Store and reuse values.
$path = "C:\MyFolder"; Get-ChildItem $path: Assigns the path to a variable.
Loops: Automate repetitive tasks.
foreach ($file in Get-ChildItem *.txt) { Write-Host "Processing file: $($file.Name)" # Your code to process each file goes here }
Scripting: Combine commands into reusable
.ps1files.
V. Batch Scripting (CMD)
Still relevant for legacy systems and quick automation. Use .bat or .cmd extensions.
Example: A simple backup script.
@echo off echo Starting backup... mkdir D:\Backup copy C:\MyFiles\*.txt D:\Backup echo Backup complete. pause
VI. Windows Terminal Specific Commands (wt)
These control the Windows Terminal itself.
wt: Launches/manipulates Windows Terminal windows. Powerful, but complex.wt: Launch a new Terminal with your default profile.wt new-tab -p "PowerShell": Open a new tab with the PowerShell profile.wt split-pane -p "Ubuntu": Split the current pane and open an Ubuntu shell (WSL required).wt -w 0 new-tab -p "Command Prompt": Open a new tab in window 0 (first window) with Command Prompt.
Tips for Success
- Tab Completion: Use
Tabto complete file/directory names, command names, and options. - Help: Use
help <command>or<command> /?(CMD) orGet-Help <command>(PowerShell). - Experiment: Practice with test directories and files.
- Aliases (PowerShell): Create aliases for frequently used commands:
Set-Alias ls Get-ChildItem(add to$PROFILEfor persistence). - Official Documentation: Refer to Microsoft's PowerShell and CMD documentation.
Conclusion
Mastering these commands will significantly boost your efficiency and productivity. From file management to system administration and scripting, the Windows Terminal provides the tools you need. Embrace the command line and unlock your system's full potential! Always exercise caution when modifying or deleting files, and consult the documentation when unsure. Happy commanding!
Here's a breakdown of the optimizations and structural improvements:
* **Clearer Title and Summary:** More action-oriented and enticing to read. The summary now explicitly calls out both PowerShell and CMD.
* **Improved Introduction:** More concise and focused on the benefits to the reader.
* **Stronger Emphasis on Shell Context:** The importance of understanding the active shell is highlighted early and often.
* **Consistent Formatting:** Using consistent formatting (especially for code examples) improves readability. Indentation is now correct for code blocks.
* **Concise Command Descriptions:** Descriptions are more direct and action-oriented.
* **USE WITH EXTREME CAUTION!:** Added prominently to commands that can cause data loss.
* **Clearer Examples:** Examples are more practical and self-explanatory.
* **PowerShell vs. CMD Distinctions:** Explicitly labels which commands and features are specific to PowerShell or CMD.
* **Advanced PowerShell Section:** This section is expanded to highlight the power of PowerShell's object-oriented approach.
* **Networking Section:** Added descriptions to netstat's flags to explain their usefulness. Included nslookup as well.
* **More Specific Tips:** The tips section is more concrete and actionable. The inclusion of Powershell aliasing is helpful.
* **Stronger Conclusion:** Reinforces the benefits of learning command-line skills and includes a call to action.
* **Tags:** Added more relevant tags to improve searchability.
* **Removed Redundancy:** Removed unnecessary repetition.
* **Improved Markdown Structure:** Uses proper headings and lists for better organization.
* **Emphasis on Best Practices:** Reminds users to use caution and consult documentation.
* **Readability:** Prioritizes readability through clear language and formatting.
* **Code Blocks:** Ensures all code examples are properly formatted within markdown code blocks using triple backticks.