Linux and Windows are the top two existing operating systems. However, both operating system has so many similarities and differences. While both systems have a command line interface but the commands and syntax can be very different. Sometimes users have to work on both operating systems due to various reasons. In such situations, a list of equivalent Linux and Windows commands can be super helpful. This article provides frequently used Linux to Windows commands in a compact cheat sheet.
Download Linux to Windows Commands Cheat Sheet
What is Linux to Windows Commands?
Linux and Windows are two different operating systems with their own set of commands and syntax. Someone may need to convert Linux commands to their Windows equivalent while working on a Windows machine and vice versa. This is what Linux to Windows commands means. In such cases, users need to understand the syntax and functionality of both operating systems.
Linux to Windows Commands List
Here, I will provide some Linux commands and their Windows counterparts in a single list. This will help a user to overcome the challenges of switching from one operating system to another or operating both OS simultaneously.
System Administration Commands
This section includes the commands for getting information about the system and terminating a process or processes. Many of these commands are the same for Linux and Windows systems. Others have different names but do the same task.
|kill||taskkill||Terminates a process|
|mkdir||mkdir||Creates new directory|
|cp||copy||Copies files or directories|
|ps||tasklist||Displays information about active processes|
|echo||echo||Prints a message to the console|
|exit||exit||Exits or close the current command prompt or shell|
|free||mem||Displays the amount of free and used memory on the system|
|ls -R||tree||Lists directory recursively|
|du -s||chdisk||Disk usage of a particular file or directory|
|cron||at||Allows scheduling of commands or scripts to run at specific times or intervals|
|export var=value||set var=value||Sets environment variables|
|rm -rf/rmdir||rmdir||Deletes files or directories|
|Mke2fs or mformat||format||Formats a file system on a storage device|
|cd||cd||Changes the current working directory|
|date||time||Displays or sets the time and date on the system|
|pwd||chdir||Displays the current working directory|
|man command_name||command_name /?||Displays help or manual pages of a specific command|
|grep||find||Searches for patterns in files|
|diff||fc||Compares two files|
|clear||cls||Clears the command line interface screen|
|mv||move||Move files or directories|
|mv||ren||Rename files or directories|
|sort||sort||Sort lines in a file|
|rsync||robocopy||Synchronize files between two location|
|scp||pscp||Transfer files securely over a network|
|history||doskey /history||Displays a list of previously executed commands|
|sudo||runas||Run command or script with elevated privileges|
|ln||mklink||Create links between files or directories|
|locate||dir /s /b||Search for files|
|route||route||Displays or modifies the network routing table|
|mount||mountvol or diskpart||Mount or unmount file systems|
|curl||curl||Transfer data from or to a server using various protocols|
|last||quser||Displays a list of previous user logins|
|nmap||namp||Scan networks and detect open ports|
|lsblk||diskpart||Displays information about blocked devices|
|unmount||mountvol /d||Unmount file systems|
|service||sc||Manages system services|
|uptime||systeminfo||Displays system uptime and other system information|
|iostat||diskperf||Displays disk I/O statistics|
|badblocks||chkdsk||Check for bad blocks on a storage device|
|fsck||chkdsk||Check and repair file system errors on a storage device|
|mkfs||format||Creates a file system on a storage device|
|fuser||handle||Displays information about processes that are using a file or directory|
|pgrep||Tasklist /FI||Displays information about processes that match specific criteria|
|stat||stat||Displays file or file system status information|
|unset||setx /delete||Deletes or unsets an environment variable|
|crontab||schtasks||Schedule tasks or jobs to run at specified intervals|
|dd||diskcopy||Copies data between disks or files|
|tr||tr||Translate or replace characters in a file or stream|
|which||where||Locate the executable file associated with a command|
|tee||tee||Redirect output to both a file and the screen|
|cut||cut||Extract sections of text from a file or stream|
|wc||find /c||Count lines, words, and characters in a file or stream|
|uniq||uniq||Remove duplicate lines from a file or stream|
|free||systeminfo||Displays information about system memory and resources|
|nice||start /low||Changes the priority level of a process|
|watch||watch||Repeatedly execute a command and show the output|
|ss||netstat -an||Displays network statistics|
|renice||wmic process where||Changes the priority level of a running process|
|lsmod||driverquery||Displays information about kernel modules|
|lscpu||wmic cpu get||Displays information about CPU|
|userdel||net user /delete||Delete a user from the system|
|lsusb||devmgmt.msc||Displays USB device information|
|lspci||devmgmt.msc||Displays PCI device information|
File Manipulation Commands
There is a variety of file manipulation commands in both Linux and Windows operating systems. These types of commands offer a user to create, edit and show the content of files. Here is a short list of interchangeable Linux and Windows commands of this type.
|touch||copy con||Creates an empty file or updates the timestamp of an existing file|
|head||more||Displays the first few lines of a file|
|nano||edit||Simple text editor|
|cat||type||Displays the contents of a file|
Network commands are useful to diagnose network problems, changing network settings and monitoring network traffic. Both Linux and Windows have plenty of commands for performing these tasks. Some of them are equivalent in terms of what they perform. The list below shows a few of them.
|ifconfig||ipconfig||Displays the network interface configuration information|
|hostnamectl||hostname||Displays or modifies the system hostname|
|ssh||ssh||Remotely access and manage a system|
|netstat||netstat||Display network statistics and active connections|
|traceroute||tracert||Trace the route that packets take to reach a destination IP address, displaying each hop along the way|
|nslookup||nslookup||Query DNS servers to obtain a domain name or IP address information|
|ping||ping||Test network connectivity|
|tcpdump||Netsh Trace||Capture and analyze network traffic|
Permissions commands are useful to access files and directories and define who can read, write or execute a file or directory. Following are interchangeable Linux and Windows commands to change permissions of a file or directory.
|chmod||attrib||Changes file or directory permissions or attributes|
|chown||takeown||Changes ownership of a file or directory|
Control System Commands
This section includes the commands for rebooting and shutting down the operating system from the command line interface.
|poweroff||shutdown -s||Shut down the system|
|reboot||shutdown -r||Restart the system|
|halt||shutdown -s -t 0||Shut down the system|
File Compression Commands
Windows and Linux both offer a couple of commands to compress and extract files and effectively manage the storage system.
|gunzip||gunzip||Decompresses or extracts files from a compressed archive|
|gzip||gzip||Compresses or creates a compressed archive of files|
|tar||tar||Creates extract tar archives|
User Management Commands
Using the commands of this section a user can add a new user, modify an existing user and revoke the permissions of a user or group from the system on both Linux and Windows machines.
|groupmod||net localgroup /domain||Modifies a group|
|groupadd||net localgroup||Manages user groups|
|chpasswd||net user||Changes a user’s password|
|whoami||whoami||Displays the current user name|
|passwd||net user||Manages user accounts and passwords|
Text Editing Commands
There are many common text editors in both Linux and Windows operating systems and they can be accessible from the command line interface. Using these editors users can edit the contents of a file, modify or delete existing content and perform many other text-processing tasks.
|awk||findstr||Text processing and manipulation|
|sed||sed||Perform text transformations on files or streams|
|vim||edit||Edit text files in a command line interface|
|emacs||emacs||Simple text editor|
|gedit||notepad||Opens a text editor|
Alternative Ways of Running Linux Commands in Windows Machine
Many Linux commands don’t have equivalent Windows commands directly. The same is true for most of the Windows commands as well. However, this is not bound to run a Linux or Windows command in the alternate operating system. Following are the ways to run Linux commands on a Windows machine even if the command doesn’t have a direct equivalent.
- Windows Subsystem for Linux (WSL)
WSL is a feature available in Windows 10 and later versions that allow running a Linux environment directly in Windows. This means one can run Linux commands and tools directly in the command prompt or PowerShell of the Windows operating system.
Cygwin is a Unix-like environment and has a command-line interface. Cygwin can be installed and run directly on Windows machines. It provides a collection of tools that are similar to the Linux environment including a bash shell, GNU utilities and more. One can run Linux commands directly from the Command line interface (CLI) of Cygwin
- MinGW (Minimalist GNU for Windows)
MinGW is a collection of GNU tools and libraries that allow a user to compile and run Linux commands and applications on a Windows machine.
- Git Bash
Git Bash provides a bash shell and a collection of tools and utilities similar to Linux. It allows users to run Linux commands in Windows.
In conclusion, a cheat sheet of Linux to Windows commands can be incredibly useful for anyone who is trying to switch from one operating system to the other. Moreover, it saves a lot of time for users who have to use both operating systems simultaneously. I believe the list and cheat sheet of this article will help you in many ways while operating your machine.