Git Bash on Windows: adding a permanent alias

Hafiz Jaafar - Jul 28 '20 - - Dev Community

If you are using Git Bash on Windows and you're used to Linux bash commands, chances are that you'd like to add aliases that help making your jobs easier.

These two are my favorite aliases:

$ alias cll='clear; ls -lah'
$ alias countFiles='ls -1 | wc -l'
Enter fullscreen mode Exit fullscreen mode

How to add an alias permanently for the Git Bash

  1. To add an alias permanently, you'd need to edit the file
    /C/Program Files/Git/etc/profile.d/aliases.sh .

  2. Run your text editor as an administrator and open that file.

  3. Add your alias and save the file.

  4. Open the Git Bash. Execute 'alias', and you're done. Have fun.

$ alias
alias cll='clear; ls -lah'
alias countFiles='ls -1 | wc -l'
alias ll='ls -lah'
alias ls='ls -F --color=auto --show-control-chars'
Enter fullscreen mode Exit fullscreen mode
. . . . . . . . . . .
Terabox Video Player