DEV Community

Cover image for Windows Terminal Commands Cheat Sheet For Beginners
Tech Webster
Tech Webster

Posted on

Windows Terminal Commands Cheat Sheet For Beginners

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

PowerShell

PowerShell is more powerful and modern. It supports many advanced commands and scripting features.

Example:

Get-ChildItem
Enter fullscreen mode Exit fullscreen mode

PowerShell also supports many short aliases. For example:

ls
dir
gci
Enter fullscreen mode Exit fullscreen mode

All of these can show files and folders in PowerShell.


Basic Windows Terminal Commands


1. Show Files and Folders

CMD

dir
Enter fullscreen mode Exit fullscreen mode

PowerShell

dir
Enter fullscreen mode Exit fullscreen mode

or

Get-ChildItem
Enter fullscreen mode Exit fullscreen mode

Use

This command displays all files and folders inside the current directory.

Example:

dir
Enter fullscreen mode Exit fullscreen mode

Output may show files, folders, size, date, and time.


2. Show Hidden Files and Folders

CMD

dir /a
Enter fullscreen mode Exit fullscreen mode

PowerShell

Get-ChildItem -Force
Enter fullscreen mode Exit fullscreen mode

Use

This command shows hidden files and folders also.

Useful when you want to see files like:

.git
.env
.vscode
Enter fullscreen mode Exit fullscreen mode

3. Change Directory

CMD and PowerShell

cd foldername
Enter fullscreen mode Exit fullscreen mode

Example

cd Desktop
Enter fullscreen mode Exit fullscreen mode

Use

This command moves you inside a folder.


4. Go Back to Previous Folder

CMD and PowerShell

cd ..
Enter fullscreen mode Exit fullscreen mode

Use

This command moves one step back from the current folder.

Example:

C:\Users\Ahmad\Desktop\Project
Enter fullscreen mode Exit fullscreen mode

After running:

cd ..
Enter fullscreen mode Exit fullscreen mode

You will move to:

C:\Users\Ahmad\Desktop
Enter fullscreen mode Exit fullscreen mode

5. Go to Root Directory

CMD and PowerShell

cd \
Enter fullscreen mode Exit fullscreen mode

Use

This command moves you to the root directory of the current drive.

Example:

C:\
Enter fullscreen mode Exit fullscreen mode

6. Show Current Location

CMD

cd
Enter fullscreen mode Exit fullscreen mode

PowerShell

pwd
Enter fullscreen mode Exit fullscreen mode

or

Get-Location
Enter fullscreen mode Exit fullscreen mode

Use

This command shows your current folder path.


7. Create a New Folder

CMD and PowerShell

mkdir foldername
Enter fullscreen mode Exit fullscreen mode

Example

mkdir my-project
Enter fullscreen mode Exit fullscreen mode

Use

This command creates a new folder.


8. Create Multiple Folders

CMD and PowerShell

mkdir folder1 folder2 folder3
Enter fullscreen mode Exit fullscreen mode

Example

mkdir html css js
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

or

New-Item filename.txt
Enter fullscreen mode Exit fullscreen mode

CMD

type nul > filename.txt
Enter fullscreen mode Exit fullscreen mode

Example

ni index.html
Enter fullscreen mode Exit fullscreen mode

or

type nul > index.html
Enter fullscreen mode Exit fullscreen mode

Use

This command creates a new empty file.


10. Create a File with Text

CMD

echo Hello World > file.txt
Enter fullscreen mode Exit fullscreen mode

PowerShell

"Hello World" > file.txt
Enter fullscreen mode Exit fullscreen mode

Use

This creates a file and adds text inside it.

Example:

echo Welcome to Windows Terminal > notes.txt
Enter fullscreen mode Exit fullscreen mode

11. View File Content

CMD

type filename.txt
Enter fullscreen mode Exit fullscreen mode

PowerShell

Get-Content filename.txt
Enter fullscreen mode Exit fullscreen mode

or

cat filename.txt
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

PowerShell

Rename-Item oldname.txt newname.txt
Enter fullscreen mode Exit fullscreen mode

Example

ren index.txt index.html
Enter fullscreen mode Exit fullscreen mode

Use

This command renames a file or folder.


13. Copy a File

CMD

copy file.txt backup.txt
Enter fullscreen mode Exit fullscreen mode

PowerShell

Copy-Item file.txt backup.txt
Enter fullscreen mode Exit fullscreen mode

Use

This command copies a file from one place to another.

Example:

copy index.html index-backup.html
Enter fullscreen mode Exit fullscreen mode

14. Copy a Folder

CMD

xcopy foldername newfoldername /E /I
Enter fullscreen mode Exit fullscreen mode

PowerShell

Copy-Item foldername newfoldername -Recurse
Enter fullscreen mode Exit fullscreen mode

Use

This command copies a folder with its files and subfolders.


15. Move a File or Folder

CMD

move filename.txt foldername
Enter fullscreen mode Exit fullscreen mode

PowerShell

Move-Item filename.txt foldername
Enter fullscreen mode Exit fullscreen mode

Example

move index.html html
Enter fullscreen mode Exit fullscreen mode

Use

This command moves a file or folder from one location to another.


16. Delete a File

CMD

del filename.txt
Enter fullscreen mode Exit fullscreen mode

PowerShell

rm filename.txt
Enter fullscreen mode Exit fullscreen mode

or

Remove-Item filename.txt
Enter fullscreen mode Exit fullscreen mode

Example

rm notes.txt
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

PowerShell

Remove-Item foldername
Enter fullscreen mode Exit fullscreen mode

Use

This deletes an empty folder.


18. Delete a Folder with Files

CMD

rmdir /s foldername
Enter fullscreen mode Exit fullscreen mode

PowerShell

Remove-Item foldername -Recurse
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

PowerShell Shortcut

Ctrl + L
Enter fullscreen mode Exit fullscreen mode

Use

This clears the terminal screen.


20. Show Command History

PowerShell

history
Enter fullscreen mode Exit fullscreen mode

or

Get-History
Enter fullscreen mode Exit fullscreen mode

CMD

doskey /history
Enter fullscreen mode Exit fullscreen mode

Use

This shows previously used commands in the current terminal session.


21. Open Current Folder in File Explorer

CMD and PowerShell

start .
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

Example

notepad notes.txt
Enter fullscreen mode Exit fullscreen mode

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 .
Enter fullscreen mode Exit fullscreen mode

Use

This opens the current folder in Visual Studio Code.

Note: This works only if VS Code is installed and the code command is added to your system path.


24. Check IP Address

CMD and PowerShell

ipconfig
Enter fullscreen mode Exit fullscreen mode

Use

This command shows network information such as:

  • IP address
  • Default gateway
  • Subnet mask
  • Network adapter details

Example:

ipconfig
Enter fullscreen mode Exit fullscreen mode

25. Test Internet Connection

CMD and PowerShell

ping google.com
Enter fullscreen mode Exit fullscreen mode

Use

This command checks whether your computer can connect to a website or server.

Example:

ping google.com
Enter fullscreen mode Exit fullscreen mode

26. Show System Information

CMD and PowerShell

systeminfo
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

Use

This shows all running processes on your computer.


28. Stop a Running Task

CMD and PowerShell

taskkill /IM appname.exe /F
Enter fullscreen mode Exit fullscreen mode

Example

taskkill /IM notepad.exe /F
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

Example

where node
Enter fullscreen mode Exit fullscreen mode

Use

This shows where a command or program is installed.

Useful for checking tools like:

where node
where npm
where git
where python
Enter fullscreen mode Exit fullscreen mode

30. Check Version of Installed Tools

Many developer tools support the --version command.

Examples

node --version
Enter fullscreen mode Exit fullscreen mode
npm --version
Enter fullscreen mode Exit fullscreen mode
git --version
Enter fullscreen mode Exit fullscreen mode
python --version
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

Shows files and folders.

cd foldername
Enter fullscreen mode Exit fullscreen mode

Moves inside a folder.

cd ..
Enter fullscreen mode Exit fullscreen mode

Moves back one folder.

mkdir foldername
Enter fullscreen mode Exit fullscreen mode

Creates a new folder.

ni filename.txt
Enter fullscreen mode Exit fullscreen mode

Creates a new file in PowerShell.

cls
Enter fullscreen mode Exit fullscreen mode

Clears the terminal.

del filename.txt
Enter fullscreen mode Exit fullscreen mode

Deletes a file in CMD.

rm filename.txt
Enter fullscreen mode Exit fullscreen mode

Deletes a file in PowerShell.

history
Enter fullscreen mode Exit fullscreen mode

Shows command history in PowerShell.

start .
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

PowerShell

pwd
Enter fullscreen mode Exit fullscreen mode

2. Be Careful with Delete Commands

Commands like these can permanently remove files or folders:

del filename.txt
Enter fullscreen mode Exit fullscreen mode
rmdir /s foldername
Enter fullscreen mode Exit fullscreen mode
Remove-Item foldername -Recurse
Enter fullscreen mode Exit fullscreen mode

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"
Enter fullscreen mode Exit fullscreen mode
mkdir "New Folder"
Enter fullscreen mode Exit fullscreen mode
del "my file.txt"
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode
cd terminal-practice
Enter fullscreen mode Exit fullscreen mode

For PowerShell:

ni notes.txt
Enter fullscreen mode Exit fullscreen mode

For CMD:

type nul > notes.txt
Enter fullscreen mode Exit fullscreen mode

Then write text into the file:

echo Hello Terminal > notes.txt
Enter fullscreen mode Exit fullscreen mode

View the file:

type notes.txt
Enter fullscreen mode Exit fullscreen mode

Go back:

cd ..
Enter fullscreen mode Exit fullscreen mode

Delete the folder:

rmdir /s terminal-practice
Enter fullscreen mode Exit fullscreen mode

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)