December 4, 2019

Setup Bash "ll" Alias in Windows

I'm used to ll more than ls. To get it working for bash in Windows (not WSL, but for bash that's usually installed in Windows, such as with git), follow the steps below:

  1. Start a bash shell prompt, e.g., via VS Code terminal or Git Bash prompt.
  2. Set the current directory to the your home directory (if not set already):
cd ~
  1. Add the alias to .bashrc:
echo "alias ll='ls --color=auto -alF'" >> .bashrc
  1. Restart the bash shell, and ll should now work. Here's an example:
$ ll
total 43775
drwxr-xr-x 1 dusklight 1049089        0 Nov 19 11:26  ./
drwxr-xr-x 1 dusklight 1049089        0 Dec  4 20:33  ../
drwxr-xr-x 1 dusklight 1049089        0 Nov  7 11:10  assembly/
-rwxr-xr-x 2 dusklight 1049089    67072 Jan  1  2018  bfsvc.exe*
drwxr-xr-x 1 dusklight 1049089        0 Jan  1  2018  Boot/
-rw-r--r-- 1 dusklight 1049089    67584 Dec  4 20:31  bootstat.dat
drwxr-xr-x 1 dusklight 1049089        0 Jan  1  2018  debug/
-rw-r--r-- 1 dusklight 1049089     8143 Nov  1  2018  setup.log
...

When you restart the shell, you might see a warning about .bash_profile not being found. If it was Git Bash, it will create it for you automatically.

To have colors for ls as well, create a separate alias for ls as ls --color=auto then set the ll alias after that with just -ilF parameters. For additional information, search for "default Ubuntu .bashrc".

For more ls options, check out the man page.

No comments:

Post a Comment