Using the ls command
Written by Adam
I created a brief video providing an introduction and overview of using the ls command with Terminal.
Stumble It! |
Submit to reddit |
Digg it! |
Mixx it! | Slashdot It!
Facebook |
Save to Del.icio.us |
Technorati Favorite It! |
E-mail this!
October 7th, 2008 at 5:28 pm
One essential option you didn’t discuss is -d. In your example, what if you want to look at the owner or permissions for directory1? You would type ls -l and look in the long list. This does not work very well if your directory contains many items. If you had directory1 through directory1000 and wanted to see who owns directory500 you might first type “ls -l directory500″ hoping to see that information. But all you will see is a long listing of the contents of directory500, not the owner, permissions, etc of the directory itself. Typing ls -ld directory500 will prevent ls from recursing into the directory and will print information about the directory itself. This also applies to symbolic links. If you want to see information about a link and where it points rather than seeing information about the object the link points to, you can use -d.
This comes up often when inspecting links or on a multiuser system when you want to check the permissions of someone’s home directory.