Language: EN


Linux Commands Aliases in Windows

I leave you a collection of Windows command aliases, transforming some of the Linux commands into their Windows equivalents.

Many times using the terminal is the fastest and simplest way to solve a problem. Without being an obsessive fanatic of doing everything through the console (there are some out there), the truth is that I use it quite a bit.

On the other hand, I am much more accustomed to Linux commands than to Windows commands. Probably because in Linux their use is much more frequent, and once you get used to it, they stick in your head.

To make my life easier in Windows, and not suffer all day when switching from one OS to another, a “trick” I have is to create certain aliases for Linux commands to their Windows equivalent.

For example, ls, mv, grep… Simply because it is easier for me to think of ‘grep’ than ‘findstr’.

It is also easier for me to port scripts to other machines, or even adapt those I find on the Internet.

How to set the Aliases

To set up aliases on your computer, there are different ways. The simplest is to create a command file (.bat or .ps) and copy it to the system32 folder.

For example with this CMD command

xcopy *.bat %systemroot%/system32

If you don’t like having “your trash” in system32, you can create another folder to store the scripts, and simply add them to the Path environment variable. For each person, the one you like the most.

Linux Commands Aliases

Here is a list of the Linux command aliases that I create to use in Windows.

Alias command clear

Clear the screen

cls %*

Alias command cp

Copy files

copy %*

Alias command grep

Search for text in a file

findstr %*

Alias command ls

List folders and files

dir %*

Alias command mv

Move file

move %*

Alias command rm

Delete a file

del %*

Alias command run

Run a command or file

cmd /c %*

Alias command touch

Create a new empty file

type nul > %*

Alias command nano

Launch Notepad++

"C:\Program Files\Notepad++\notepad++.exe" %* &
exit /b

Other Interesting Aliases

And here are other commands that I create, and that usually simplify my life.

Alias command ps

Launch PowerShell from CMD

powershell -noexit & cd %*

Alias command vsc

Launch Visual Studio Code

cmd /c code .
exit /b

Alias command pap

Open the Recycle Bin

start shell:RecycleBinFolder 

I leave the repo on Github with the commands GitHub - luisllamasbinaburo/alias-terminal-linux-en-windows

If I think of any more, or you suggest any, we can expand the list with your favorite commands. Until next time!