6

I have installed WSL on Windows 10 Pro. And I need to execute bash commands from Windows Command Line like this:

bash -c ll 

Expected: ll command output in Command Line console

In practice: /bin/bash: ll: command not found

But its work for some commands like ls or apt.

Please, see :

screenshot with example

What could be the problem?

3 Answers 3

13

ll is a common alias (for ls -alF in WSL; defined in the default .bashrc). Depending on how you invoke bash will determine whether the scripts which set up your system aliases are run. See the INVOCATION section of the bash manual.

You can use bash -i -c ll to invoke bash in an appropriate way for WSL.

Sign up to request clarification or add additional context in comments.

Comments

1

Apparently ll is an alias you defined in some of your configuration files. You should start bash as follows:

bash -ilc ll 

Depending on where you defined the aliases, you can omit the -i or -l flag.

Comments

1

ll is usually an alias of 'ls -l and can't (shouldn't) be used in script or command line.

Instead use directly the command itself: bash -c 'ls -l'.

To see if a certain command is an alias use the command type:

type ll ll is aliased to `ls -l' 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.