alias-comandos-linux-en-windows

Linux Commands Aliases in Windows

  • 3 min

Here is a collection of Windows command aliases, transforming some Linux commands to their Windows equivalents.

Often, using the terminal is the quickest and easiest way to solve a problem. Without being an obsessive fanatic of those who do everything by console (and there are “those”), the truth is I use it quite a bit.

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

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

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

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

How to Set Up the Aliases

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

For example with this CMD command

xcopy *.bat %systemroot%/system32

If you don’t like having “your junk” in system32, you can create another folder to store the scripts, and simply add it to the Path environment variable. To each their own, whichever you prefer.

Linux Command Aliases

Here is a list of the Linux command aliases I create, to be able to use them in Windows.

Alias command clear

Clears the screen

cls %*

Alias command cp

Copy files

copy %*

Alias command grep

Search for text in a file

echo. 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

Execute a command or file

echo. cmd /c %*

Alias command touch

Create a new empty file

type nul > %*

Alias command nano

Launch Notepad++

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

Other Interesting Aliases

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

Alias command ps

Launch PowerShell from CMD

echo. powershell -noexit & cd %*

Alias command vsc

Launch Visual Studio Code

echo. cmd /c code . exit /b

Alias command pap

Open the Recycle Bin

start shell

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

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