>The ls command is used to list the contents of directories. It takes this general form:
ls [options] [directory-names]
If no directory names are given, it lists the files in the current directory.
Table A.3 shows some of the options that can be used with ls (note that these options are case sensitive).
Some ls Options | |
---|---|
Option | Meaning |
-a | Lists all files, including hidden files |
-d | Reports only on a directory, not its contents |
-f | Displays the directory contents in the current order, without attempting to sort |
-l | Displays a long-format listing, which includes permissions, owner, size, and modification time |
-n | Like -l, but shows group ID numbers and user ID numbers rather than names |
-t | Sorts files according to when they were modified (most recent first) |
-x | Formats in rows, going across the screen |
-B | Ignores backup files (those ending with a ~) |
-R | Recursively lists subdirectories, as well as the current directory |
-X | Sorts by file extension |