Linux Subsystem for Windows (WSL): how to hide the error “cannot read symbolic link: Permission denied” in the Bash shell.

Since some days I started to play with the Linux Subsystem for Windows: let me state it clear: I love the native Microsoft foundation of Windows and I try this only to keep me aligned 🙂

Anyway, after having installed the WSL and Ubunt as “distribution”, I found that once I hit an “ls” or “ls -al” in the shell I have some annoying error message of this kind:

ls: cannot read symbolic link 'Application Data': Permission denied
ls: cannot read symbolic link 'Cookies': Permission denied
ls: cannot read symbolic link 'Local Settings': Permission denied
ls: cannot read symbolic link 'My Documents': Permission denied
ls: cannot read symbolic link 'Recent': Permission denied

nothing important, but again, I don’t like to see error in a screen.

If you want to correct it (*) create an alias like this:

alias ls='ls --color=tty 2>/dev/null'

and if you want to apply this by default, add it into your ~/.bash_aliases

(*) I suppose that you haven’t customized anything else, like the default shell, terminal colors and so on …

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: