Set alias in terminal

Answered

How can I set an alias for python to abbreviate common commands?

e.g:

alias pm="python manage.py"
0
4 comments

Hi, doesn't .bashrc or .bash_profile work?

0
Avatar
Permanently deleted user

On Windows, apparently it doesn't read either of the two, while with MINGW they work correctly.

.bashrc and .bash_profile are placed at the root of my user's folder.

BTW I had noticed the same on PHPStorm

0

Hi Info, do you mean PyCharm built-in terminal? By default it uses cmd on Windows and it is expected to ignore .bashrc of course. See Settings | Tools | Terminal. Or did you change it to some other shell?

0

For Windows terminal there's a workaround:

- in any PATH location, for example C:\Program Files\Docker\Docker\resources\bin or whatever you defined, create a file named by your alias desired name, for example dc-down.bat for alias dc-down

- inside this file define full command, for example docker-compose down -v

- now when you type dc-down command in IDEA Windows terminal, then command docker-compose down -v is run

You don't even need to restart your terminal for changes to take effect

 
0

Please sign in to leave a comment.