Ls #ls Command In Hindi | Linux Directory Commands | Linux Command | class #3


Ls command In Linux 

How to Use the ls Command

The ls command has the following syntax:

watch video for more details 





ls [OPTIONS] [FILES]

ls displays a list of the names of all files in the current working directory when used without any options or arguments:

ls

The files are listed alphabetically in as many columns as your terminal will allow:

cache  db  empty  games  lib  local  lock  log  mail  opt  run  spool  tmp

To list files in a single directory, use the ls command with the directory path as an input. To list the contents of the /etc directory, for example, type:

ls /etc

You can also use space to separate several directories and files:

ls /etc /var /etc/passwd

You'll get a notice claiming that ls can't open the directory because the user you're logged in with doesn't have read permissions:

ls /root
Output

ls: cannot open directory '/root': Permission denied

There are several options for the ls command. We'll go over the most popular solutions in the sections below.



Please Share this course

It Looks like you have completed your course!! We have created Online series based on the above content. You can give a test and check your skill.




Be a Part of CollegeSpike by giving your precious comment here and help us in improving our content.