Windows ↔ Linux command cheatsheet
Switching from Windows? Every command you already know has a Linux equivalent. This is the reference page to bookmark — 87 commands across 9 categories.
New to Linux? Find your distro →
Jump to:
Navigation & files
Finding things
System info
Networking
Packages & software
Permissions & users
Disk & storage
Text & output
Shutdown & power
Navigation & files
| Windows | Linux | What it does |
|---|---|---|
dir |
ls -la |
List files in current directory |
cd <folder> |
cd <folder> |
Change directory |
cd .. |
cd .. |
Go up one directory |
cd %USERPROFILE% |
cd ~ or cd |
Go to home directory |
mkdir <name> |
mkdir <name> |
Create a new directory |
rmdir /s /q <name> |
rm -rf <name> |
Delete a directory and its contents |
del <file> |
rm <file> |
Delete a file |
copy <src> <dst> |
cp <src> <dst> |
Copy a file |
move <src> <dst> |
mv <src> <dst> |
Move or rename a file |
ren <old> <new> |
mv <old> <new> |
Rename a file |
type <file> |
cat <file> |
Print file contents to screen |
more <file> |
less <file> |
View file contents page by page |
where <cmd> |
which <cmd> |
Find the location of a command |
tree |
tree |
Show directory tree (install if needed) |
Advertisement
Finding things
| Windows | Linux | What it does |
|---|---|---|
dir /s /b <pattern> |
find . -name "<pattern>" |
Search for files by name |
findstr "<text>" <file> |
grep "<text>" <file> |
Search for text in a file |
findstr /i "<text>" <file> |
grep -i "<text>" <file> |
Case-insensitive search |
findstr /r /s "<text>" * |
grep -r "<text>" . |
Recursive search in all files |
findstr /r /s /i "<text>" * |
grep -ri "<text>" . |
Recursive, case-insensitive |
findstr /n "<text>" <file> |
grep -n "<text>" <file> |
Show line numbers in results |
findstr /v "<text>" <file> |
grep -v "<text>" <file> |
Show lines that do NOT match |
findstr /c:"<t1>" /c:"<t2>" |
grep -E "<t1>|<t2>" <file> |
Match multiple patterns (OR) |
| — | grep -l "<text>" * |
List only filenames with a match |
| — | grep -c "<text>" <file> |
Count matching lines |
| — | grep -A 3 "<text>" <file> |
Show 3 lines after each match |
| — | grep -B 3 "<text>" <file> |
Show 3 lines before each match |
| — | grep -C 3 "<text>" <file> |
Show 3 lines either side of match |
| — | grep -w "<word>" <file> |
Match whole words only |
| — | grep -x "<line>" <file> |
Match entire lines only |
| — | grep -P "<regex>" <file> |
Use Perl-compatible regex |
| — | grep -o "<text>" <file> |
Print only the matched part |
| — | grep -e "<p1>" -e "<p2>" <file> |
Multiple patterns in one command |
| — | grep --include="*.php" -r "<t>" . |
Recurse only in matching file types |
| — | grep -z "<text>" <file> |
Handle null-delimited input (e.g. find -print0) |
where /r . <name> |
find or -name "<name>" 2> or dev or null |
Find a file anywhere on the system |
Advertisement
System info
| Windows | Linux | What it does |
|---|---|---|
systeminfo |
uname -a or hostnamectl |
Show system information |
ver |
uname -r |
Show OS / kernel version |
hostname |
hostname |
Show computer name |
whoami |
whoami |
Show current user |
echo %USERNAME% |
echo $USER |
Print current username |
echo %PATH% |
echo $PATH |
Print the PATH variable |
set |
env or printenv |
List all environment variables |
set VAR=value |
export VAR=value |
Set an environment variable |
tasklist |
ps aux |
List running processes |
taskkill /PID <n> /F |
kill -9 <PID> |
Force-kill a process by PID |
wmic cpu get name |
lscpu |
Show CPU info |
wmic memorychip get |
free -h |
Show memory info |
wmic diskdrive get |
lsblk or df -h |
Show disk info |
Advertisement
Networking
| Windows | Linux | What it does |
|---|---|---|
ipconfig |
ip addr or ifconfig |
Show network interfaces and IP addresses |
ipconfig /all |
ip addr show |
Show full network details |
ipconfig /flushdns |
sudo systemd-resolve --flush-caches |
Flush DNS cache |
ping <host> |
ping <host> |
Ping a host |
tracert <host> |
traceroute <host> |
Trace route to a host |
nslookup <host> |
dig <host> or nslookup |
DNS lookup |
netstat -an |
ss -tuln or netstat -tuln |
Show open ports and connections |
curl <url> |
curl <url> |
Fetch a URL (curl available on both) |
Advertisement
Packages & software
| Windows | Linux | What it does |
|---|---|---|
winget install <pkg> |
sudo apt install <pkg> |
Install a package (Debian/Ubuntu) |
winget install <pkg> |
sudo dnf install <pkg> |
Install a package (Fedora/RHEL) |
winget install <pkg> |
sudo pacman -S <pkg> |
Install a package (Arch) |
winget uninstall <pkg> |
sudo apt remove <pkg> |
Remove a package |
winget upgrade --all |
sudo apt upgrade |
Upgrade all packages |
winget list |
apt list --installed |
List installed packages |
winget search <term> |
apt search <term> |
Search available packages |
| — | sudo apt update |
Refresh package list (run before install) |
Advertisement
Permissions & users
| Windows | Linux | What it does |
|---|---|---|
runas /user:Administrator |
sudo <command> |
Run a command as administrator/root |
net user |
cat or etc or passwd or getent passwd |
List user accounts |
net user <name> <pass> /add |
sudo adduser <name> |
Add a new user |
net user <name> /delete |
sudo deluser <name> |
Delete a user |
icacls <file> |
ls -l <file> |
View file permissions |
icacls <file> /grant |
chmod <perms> <file> |
Change file permissions |
takeown /f <file> |
sudo chown <user> <file> |
Change file owner |
Advertisement
Disk & storage
| Windows | Linux | What it does |
|---|---|---|
chkdsk |
fsck |
Check filesystem for errors |
format <drive> |
mkfs.<type> <device> |
Format a drive |
diskpart |
fdisk or parted or gparted |
Partition management |
df |
df -h |
Show disk space usage |
| — | du -sh <folder> |
Show folder size |
compact /c |
gzip or tar |
Compress files |
Advertisement
Text & output
| Windows | Linux | What it does |
|---|---|---|
echo <text> |
echo <text> |
Print text to screen |
cls |
clear |
Clear the terminal |
<cmd> > file.txt |
<cmd> > file.txt |
Redirect output to a file |
<cmd> >> file.txt |
<cmd> >> file.txt |
Append output to a file |
<cmd1> | <cmd2> |
<cmd1> | <cmd2> |
Pipe output to another command |
notepad <file> |
nano <file> or vim <file> |
Edit a text file |
Advertisement
Shutdown & power
| Windows | Linux | What it does |
|---|---|---|
shutdown /s /t 0 |
sudo shutdown now or sudo poweroff |
Shut down immediately |
shutdown /r /t 0 |
sudo reboot |
Restart immediately |
shutdown /l |
logout or exit |
Log out current user |
| — | sudo suspend |
Suspend / sleep the system |
Ready to make the switch?
Now you know the commands — pick a distro and take it for a spin. Our quiz matches you to the right one based on your hardware and how you'll use it.