This command is probably one of the most used commands when navigating through a Unix/Linux file system. You can open up the Command Line Interface(CLI) in Linux and type ls. This is a sample of what'd you see.
ls
ls *
This is a good start to see what's going on, but we can get pretty fancy. Typing in will give you the current list and a one level down on each folder. It gives you the list of the current directory and lists the contents one level into each folder. Quite useful.
ls -a
The
-a
is good for displaying all files and folders including hidden ones. In Linux, hidden files/folders are perpended with a ".
". These files/folders aren't displayed by default.ls -l
Another useful feature is the -l option. This gives more detail. It's alittle intimidating at first but it's not all complicated.
If you haven't messed with Linux file-system permissions the leftmost column will be the most confusing.
In this example :
drwxr-xr-x 2 root root 4096 2010-07-04 08:09 bin
The first d means that 'bin' is a directory.
drwxr-xr-x
Owner:
drwxr-xr-x
the following 3 characters are the owner permissions:
r
, w
, and x
mean that the owner has permission to read, write, and execute.Group:
drwxr-xr-x
the next three characters(
r-x
in this example) are for the group. Here, r
give the group permission to read, x
gives the group permission to execute. The dash '-'
is shown in place of the write permission because writing data to this directory is not available to the group.Others:
drwxr-xr-x
The last three characters represent the permissions available to others, or everyone else that has access to the system. As you can see, everybody else has the same privileges to that directory as the group.
The next column is for the number of directories, followed by the owner, group, size, date/time last modified, and finally, the actual filename.
So this was a in plain English overview of the
So this was a in plain English overview of the
ls
command. Is there something else I should have included? What kinds of things would you like to see? Leave a comment.