Unix Manual PagesAn introductory tutorial on Unix... Regular Expressions... Perl and Unix... Help with vi... Shell scripting... The 10 Unix commands every beginner needs to know... The 10 most misunderstood commands... Alphabetic list of commands... Copyright/Copyleft info... |
lsList Contents of a Directory
Examples
List the contents of a given directory:
List the contents of a directory in the long format:
List the contents of the current directory in the long format, and with full time information:
Options-A List all entries except for `.' and `..'. Always set for the super-user. -B Force printing of non-graphic characters in file names as \xxx, where xxx is the numeric value of the character in octal. -C Force multi-column output; this is the default when output is to a terminal. -F Display a slash (/) immediately after each pathname that is a directory, an asterisk (*) after each that is executable, an at sign (@) after each symbolic link, an equals sign (=) after each socket, a percent sign (%) after each whiteout, and a vertical bar (|) after each that is a FIFO. -H Symbolic links on the command line are followed. This option is assumed if none of the -F, -d, or -l options are specified. -L If argument is a symbolic link, list the file or directory the link references rather than the link itself. This option cancels the -P option. -P If argument is a symbolic link, list the link itself rather than the object the link references. This option cancels the -H and -L options. -R Recursively list subdirectories encountered. -T Display complete time information for the file, including month, day, hour, minute, second, and year. -W Display whiteouts when scanning directories. -a Include directory entries whose names begin with a dot (.). -b As -B, but use C escape codes whenever possible. -c Use time when file status was last changed for sorting or printing. -d Directories are listed as plain files (not searched recursively). -f Output is not sorted. -g This option is deprecated and is only available for compatibility with 4.3BSD; it was used to display the group name in the long (-l) format output. -i For each file, print the file's file serial number (inode num- ber). -k If the -s option is specified, print the file size allocation in kilobytes, not blocks. This option overrides the environment variable BLOCKSIZE. -l (The lowercase letter ``ell.'') List in long format. (See be- low.) If the output is to a terminal, a total sum for all the file sizes is output on a line before the long listing. -o Include the file flags in a long (-l) output. -q Force printing of non-graphic characters in file names as the character `?'; this is the default when output is to a terminal. -r Reverse the order of the sort to get reverse lexicographical or- der or the oldest entries first. -s Display the number of file system blocks actually used by each file, in units of 512 bytes, where partial units are rounded up to the next integer value. If the output is to a terminal, a to- tal sum for all the file sizes is output on a line before the listing. The environment variable BLOCKSIZE overrides the unit size of 512 bytes. -t Sort by time modified (most recently modified first) before sort- ing the operands by lexicographical order. -u Use time of last access, instead of last modification of the file for sorting (-t) or printing (-l). -1 (The numeric digit ``one.'') Force output to be one entry per line. This is the default when output is not to a terminal. | |
| © 1999-2004 Matchstick Consulting |