I am able to run ll command with my user but not with sudo, it giving me error as command not found!
-
1how about `ls -al` – Lei Yang Nov 17 '17 at 06:41
-
3`ll` is *not* a Linux command. But *your* system is configured to have it as some `alias` (however, mine is not). I recommend removing that confusing alias from your `~/.bashrc` – Basile Starynkevitch Nov 20 '17 at 12:42
8 Answers
Create an alias for ll
.
alias ll="ls -al"

- 10,183
- 5
- 36
- 51
-
5that's seems very helpful, I have added it in /etc/profile so that everyone can run that command. Thanks!! – Abid Khan Dec 10 '20 at 08:10
-
Got error that `'"ls -al"' is not recognized as an internal or external command, operable program or batch file.` – Yogi Ghorecha Jun 01 '21 at 14:01
Try sudo ls -l
.
As ll
is a shorthand for ls -l
.

- 4,011
- 5
- 27
- 32

- 1,063
- 14
- 30
-
1
-
Might be he doesn't have permission on a specific path but he is the sudoer user. – Vikash Pareek Sep 16 '20 at 08:37
-
1> permission is not an excuse to have a shorthand for `ls -l` since it would fail likewise – woodz Jan 27 '21 at 13:44
As it has been explained:
ll
is actually an alias to ls -l
In your prompt, I would recommend using the following 3 commands when you are not sure about a command that you input:
type <command_name>
will give you information about the command, in our particular case, the output will be:ll is aliased to 'ls -l'
which <command_name>
will show you the path of the command you are going to usewhatis <command_name>
will give you basic information about the command
Last but not least, alias ll="ls -al"
will allow you to create the alias you are looking for. However to avoid redefining your aliases every single time you open a new shell. You will have to save them in your .profile
or add them in your .bashrc
file (use .bash_aliases
file for this purpose and uncomment that section in your .bashrc
) in the home directory
of your user.
For additional information, please have a look at the following link:
https://unix.stackexchange.com/questions/183496/how-to-create-permanent-aliases-on-unix-like-systems

- 12,117
- 3
- 27
- 51
I am quite late, but ... In Debian 10 the command ll
is commented (#).
To make ll
available just change yourr .bashrc
file:
su
gedit .bashrc
After in your text editor uncommnet as you wish:
# some more ls aliases
alias ll='ls -l'
#alias la='ls -lA'
Do not forget to restart your terminal emulator.

- 359
- 6
- 5
That's expected because ll is defined in your profile (.bashrc in Ubuntu, for instance).
grep "alias ll" ~/.bashrc
alias ll='ls -alF'
Your .bashrc will not run when you sudo.

- 1,555
- 8
- 12
-
1It will if the *profile* for `root` (e.g. `/root/.profile` or `/root/.bash_profile` distro depending) sources `root`'s *resource* file (e.g. `.bashrc`). (depending on your security tolerance, you may need to create them...) – David C. Rankin Nov 17 '17 at 06:51
1. alias ll=ls -als
(create an alias without QUOTES)
2. ll
(Now run this command and it will list all files)
OR
1. alias ll="ls -al"
(create an alias with QUOTES)
2. ll
(Now run this command and it will list all files)
Note: If this doesn't work, then give it a try with sudo

- 190
- 4
- 15

- 1,584
- 1
- 19
- 26
-
-
@DanielW. I have updated my answer for what issue I faced, and what solution I applied, in my system I was having issue with Single/double quotes. – Yogi Ghorecha Jun 01 '21 at 14:38
Check if the alias exists in ~/.bashrc which should be something like
alias ll = ls -al
sometimes after a bunch of changes (in my case installing python3.6 and it's libraries, etc) the bashrc file wasn't sourced to pick up the changes to it so just source the bashrc file using the command
source ~/.bashrc
Just doing this worked like a charm.

- 33
- 5
In order to run ll
with sudo, the user that is sudo'ed (superuser or another user, as specified by the security policy) needs an alias ll='ls -al'
in his profile.
Note that even if defined, you may not be allowed to execute it by the security policy. To find out which commands you may execute type sudo -l

- 4,660
- 2
- 25
- 41