A beginner-friendly guide to the most useful terminal commands for Windows users.
If you are learning web development, programming, networking, or basic computer operations, terminal commands are very important. They help you work faster, manage files, navigate folders, run programs, check system information, and perform many tasks without using the mouse.
In Windows, you may commonly use:
-
Command Prompt also called
CMD - PowerShell
- Windows Terminal, which can open CMD, PowerShell, Git Bash, WSL, and more
This article covers the most useful basic commands for Windows users.
Note: Some commands work in both CMD and PowerShell, but some are different. I will mention both where needed.
What is a Terminal?
A terminal is a text-based interface where you can type commands to control your computer.
Instead of opening folders, clicking buttons, or using menus, you can simply type a command and press Enter.
For example:
dir
This command shows files and folders in the current location.
CMD vs PowerShell
Before learning commands, it is important to understand the difference.
Command Prompt
Command Prompt is the older Windows command-line tool.
Example:
dir
PowerShell
PowerShell is more powerful and modern. It supports many advanced commands and scripting features.
Example:
Get-ChildItem
PowerShell also supports many short aliases. For example:
ls
dir
gci
All of these can show files and folders in PowerShell.
Basic Windows Terminal Commands
1. Show Files and Folders
CMD
dir
PowerShell
dir
or
Get-ChildItem
Use
This command displays all files and folders inside the current directory.
Example:
dir
Output may show files, folders, size, date, and time.
2. Show Hidden Files and Folders
CMD
dir /a
PowerShell
Get-ChildItem -Force
Use
This command shows hidden files and folders also.
Useful when you want to see files like:
.git
.env
.vscode
3. Change Directory
CMD and PowerShell
cd foldername
Example
cd Desktop
Use
This command moves you inside a folder.
4. Go Back to Previous Folder
CMD and PowerShell
cd ..
Use
This command moves one step back from the current folder.
Example:
C:\Users\Ahmad\Desktop\Project
After running:
cd ..
You will move to:
C:\Users\Ahmad\Desktop
5. Go to Root Directory
CMD and PowerShell
cd \
Use
This command moves you to the root directory of the current drive.
Example:
C:\
6. Show Current Location
CMD
cd
PowerShell
pwd
or
Get-Location
Use
This command shows your current folder path.
7. Create a New Folder
CMD and PowerShell
mkdir foldername
Example
mkdir my-project
Use
This command creates a new folder.
8. Create Multiple Folders
CMD and PowerShell
mkdir folder1 folder2 folder3
Example
mkdir html css js
Use
This creates multiple folders at once.
9. Create a New File
Creating a file is different in CMD and PowerShell.
PowerShell
ni filename.txt
or
New-Item filename.txt
CMD
type nul > filename.txt
Example
ni index.html
or
type nul > index.html
Use
This command creates a new empty file.
10. Create a File with Text
CMD
echo Hello World > file.txt
PowerShell
"Hello World" > file.txt
Use
This creates a file and adds text inside it.
Example:
echo Welcome to Windows Terminal > notes.txt
11. View File Content
CMD
type filename.txt
PowerShell
Get-Content filename.txt
or
cat filename.txt
Use
This command shows the content of a file directly in the terminal.
12. Rename a File or Folder
CMD
ren oldname.txt newname.txt
PowerShell
Rename-Item oldname.txt newname.txt
Example
ren index.txt index.html
Use
This command renames a file or folder.
13. Copy a File
CMD
copy file.txt backup.txt
PowerShell
Copy-Item file.txt backup.txt
Use
This command copies a file from one place to another.
Example:
copy index.html index-backup.html
14. Copy a Folder
CMD
xcopy foldername newfoldername /E /I
PowerShell
Copy-Item foldername newfoldername -Recurse
Use
This command copies a folder with its files and subfolders.
15. Move a File or Folder
CMD
move filename.txt foldername
PowerShell
Move-Item filename.txt foldername
Example
move index.html html
Use
This command moves a file or folder from one location to another.
16. Delete a File
CMD
del filename.txt
PowerShell
rm filename.txt
or
Remove-Item filename.txt
Example
rm notes.txt
Use
This command deletes a file.
Be careful while deleting files from the terminal because deleted files may not always go to the Recycle Bin.
17. Delete a Folder
CMD
rmdir foldername
PowerShell
Remove-Item foldername
Use
This deletes an empty folder.
18. Delete a Folder with Files
CMD
rmdir /s foldername
PowerShell
Remove-Item foldername -Recurse
Use
This deletes a folder and everything inside it.
Warning: Use this carefully. It can delete all files inside the folder.
19. Clear the Terminal
CMD and PowerShell
cls
PowerShell Shortcut
Ctrl + L
Use
This clears the terminal screen.
20. Show Command History
PowerShell
history
or
Get-History
CMD
doskey /history
Use
This shows previously used commands in the current terminal session.
21. Open Current Folder in File Explorer
CMD and PowerShell
start .
Use
This opens the current terminal location in File Explorer.
Very useful when you are working inside a project folder.
22. Open a File in Notepad
CMD and PowerShell
notepad filename.txt
Example
notepad notes.txt
Use
This opens a file in Notepad.
If the file does not exist, Notepad may ask if you want to create it.
23. Open VS Code from Terminal
CMD and PowerShell
code .
Use
This opens the current folder in Visual Studio Code.
Note: This works only if VS Code is installed and the
codecommand is added to your system path.
24. Check IP Address
CMD and PowerShell
ipconfig
Use
This command shows network information such as:
- IP address
- Default gateway
- Subnet mask
- Network adapter details
Example:
ipconfig
25. Test Internet Connection
CMD and PowerShell
ping google.com
Use
This command checks whether your computer can connect to a website or server.
Example:
ping google.com
26. Show System Information
CMD and PowerShell
systeminfo
Use
This command displays details about your computer, such as:
- OS name
- OS version
- System manufacturer
- Processor details
- RAM information
- Boot time
27. Show Running Tasks
CMD and PowerShell
tasklist
Use
This shows all running processes on your computer.
28. Stop a Running Task
CMD and PowerShell
taskkill /IM appname.exe /F
Example
taskkill /IM notepad.exe /F
Use
This command forcefully closes a running program.
Be careful while using this command because it can close apps without saving your work.
29. Find Location of a Command
CMD and PowerShell
where commandname
Example
where node
Use
This shows where a command or program is installed.
Useful for checking tools like:
where node
where npm
where git
where python
30. Check Version of Installed Tools
Many developer tools support the --version command.
Examples
node --version
npm --version
git --version
python --version
Use
This checks the installed version of a tool.
Windows Terminal Commands Table View
| Task | CMD Command | PowerShell Command |
|---|---|---|
| Show files and folders | dir |
dir or Get-ChildItem
|
| Show hidden files | dir /a |
Get-ChildItem -Force |
| Change folder | cd foldername |
cd foldername |
| Go back one folder | cd .. |
cd .. |
| Go to root directory | cd \ |
cd \ |
| Show current location | cd |
pwd or Get-Location
|
| Create folder | mkdir foldername |
mkdir foldername |
| Create file | type nul > file.txt |
ni file.txt or New-Item file.txt
|
| View file content | type file.txt |
Get-Content file.txt |
| Rename file | ren old.txt new.txt |
Rename-Item old.txt new.txt |
| Copy file | copy file.txt backup.txt |
Copy-Item file.txt backup.txt |
| Move file | move file.txt foldername |
Move-Item file.txt foldername |
| Delete file | del file.txt |
rm file.txt or Remove-Item file.txt
|
| Delete folder | rmdir foldername |
Remove-Item foldername |
| Delete folder with files | rmdir /s foldername |
Remove-Item foldername -Recurse |
| Clear terminal | cls |
cls or Ctrl + L
|
| Show command history | doskey /history |
history or Get-History
|
| Open current folder | start . |
start . |
| Open Notepad | notepad file.txt |
notepad file.txt |
| Check IP address | ipconfig |
ipconfig |
| Test connection | ping google.com |
ping google.com |
| System information | systeminfo |
systeminfo |
| Show running tasks | tasklist |
tasklist |
| Stop a task | taskkill /IM app.exe /F |
taskkill /IM app.exe /F |
| Find command location | where node |
where node |
Most Useful Commands for Beginners
If you are just starting, learn these commands first:
dir
Shows files and folders.
cd foldername
Moves inside a folder.
cd ..
Moves back one folder.
mkdir foldername
Creates a new folder.
ni filename.txt
Creates a new file in PowerShell.
cls
Clears the terminal.
del filename.txt
Deletes a file in CMD.
rm filename.txt
Deletes a file in PowerShell.
history
Shows command history in PowerShell.
start .
Opens the current folder in File Explorer.
Safety Tips While Using Terminal
Terminal commands are powerful, but you should use them carefully.
1. Check Your Current Folder First
Before deleting or moving files, check where you are:
CMD
cd
PowerShell
pwd
2. Be Careful with Delete Commands
Commands like these can permanently remove files or folders:
del filename.txt
rmdir /s foldername
Remove-Item foldername -Recurse
Always double-check the file or folder name.
3. Use Quotes for Folder Names with Spaces
If a folder or file name has spaces, use quotes.
Example:
cd "My Projects"
mkdir "New Folder"
del "my file.txt"
4. Use Tab for Auto-Complete
When typing a file or folder name, press Tab.
The terminal will auto-complete the name for you.
This helps avoid spelling mistakes.
Practice Example
Try these commands step by step:
mkdir terminal-practice
cd terminal-practice
For PowerShell:
ni notes.txt
For CMD:
type nul > notes.txt
Then write text into the file:
echo Hello Terminal > notes.txt
View the file:
type notes.txt
Go back:
cd ..
Delete the folder:
rmdir /s terminal-practice
Final Thoughts
Learning terminal commands is one of the best habits for developers and computer users.
At first, commands may look confusing, but with daily practice they become easy. Once you understand basic commands like dir, cd, mkdir, cls, del, and history, you can work faster and manage files more efficiently.
Start with simple commands, practice them daily, and slowly learn more advanced commands.
The terminal is not just for advanced users. It is a powerful tool for everyone who wants to work smarter on Windows.
Top comments (0)