I am new to unix scripting, learning it experimenting my own ways. But then I was trying to list the directory and found numbers like 1000 and 1001.

I google and understood that those are the userid's I verified the same. But then I wish to display the username for readability on the unix ls command.

Please help me and guide on the same.

Thanks ^_^

-- Edit_1

When I type the "ls -al" the out put of that was as mentioned below.

Image of ls -al output

But then in that there were id's like 1000 of the owner and I wanted the name of the user instead of the id.


I have logged in as root user and used the below command.

sudo chown -R :

And the above solution worked and I am able to see the username instead of userid.

The link to the actual answer is [this][2]

Thank you all for the help :)

  • 2
    What exact command did you run? Was it ls -l? Could it have been ls -n? What is the output of type ls? – terdon Jun 5 at 10:30
  • 2
    As always it is best to see your question with the command entered and output displayed when you copy and paste your screen into your question. – WinEunuuchs2Unix Jun 5 at 11:03
  • Can you post an answer and accept it? Otherwise your question can keep reappearing as unanswered. – WinEunuuchs2Unix Jun 6 at 12:29
  • Apologies. Please check I have posted the answer also I included the image in the question but then it appears as a link is that the right way of displaying image ? – Karan Jun 9 at 6:58
  • your answer doesn't appear because link #2 is broken... – WinEunuuchs2Unix Jun 9 at 16:04

When you first install Windows Subsystem for Linux there are no user IDs setup. You need to create one first:

There are times when User IDs cannot get created properly in which case installing the most recent version of WSL from Microsoft Store is best course of action:


To get the username instead of the userid we need to own the directory for that the below is the command which needs super user access.

sudo chown -R username:usergroup dirname

Once you own the dir try ls -al then the result will display your name as owner of the dir instead of userid.

Thank you all for the help and support :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.