-->
Previous Table of Contents Next


dir......List Directory

dir option(s) directory

PURPOSE

The dir command lists the content of a directory. It’s basically the same as the Is command, but it’s included because MS-DOS uses dir and not Is to list directories.

OPTIONS

-A Does not list. and…
-a Lists hidden files beginning with…
-B Ignores backup files, which begin with a tilde (~)
-b Prints octal escapes for nongraphic characters.
-C Lists enteries by columns.
-c Sorts by change time; displays the change time when combined with -1.
-D Generates output suited to the emacs dired mode.
-d Lists directory enteries instead of contents.
-e Lists both the date and the full time.
-F Appends a character for typing each entry.
-f Does not sort, enabling -aU and disabling -Isto.
-G Inhibits display of group information.
-g Ignored by dir; included for compatibility reasons.
-IPattern Ignores entries matching PATTERN.
-I Prints the index number of each file.
-k Uses 1024 blocks, not 512.
-L Lists enteries pointed to by symbolic links.
-l Uses a long listing format.
-m Fills the width with a comma-separated list of entries.
-N Does not quote entry names.
-n Lists numeric UIDs and GIDs instead of names.
-o Displays files in color according to type.
-p Appends a character for typing each entry.
-Q Encloses entry names in double quotes.
-q Prints a question mark (?) instead of nongraphic characters.
-R Lists subdirectories recursively.
-r Lists in reverse order while sorting.
-S Sorts by file size.
-S Prints the block size of each file.
-Tcols Sets tab stops at each cols instead of 8.
-t Sorts by modification time; displays the modification time when used with -1.
-U List enteries in directory order, without any sorting performed.
-u Sorts by last access time; displays this time when used with -1.
-wcols Assumes a screen width of cols instead of current value.
-X Sorts alphabetically by extension.
-x Lists enteries by lines instead of by columns.
-1 Lists one file per line.

file......Determine File Type

file option(s) filename

PURPOSE

The file command returns the file type of a given file. Sometimes the magic file (/etc/magic) must be consulted. Don’t put a lot of stock into the information returned—the information returned by this command is not always correct, and it works best when detecting text-based or text-oriented file types, like ASCII files, shell scripts, PostScript files, and commands.

OPTIONS

-c Checks the magic file automatically.
-f list Runs the file command on the files in list.
-L Follows symbolic links.
-m file Checks file for file types instead of the magic file.
-z Checks compressed files.

find......Find Files

find pathname(s) condition(s)

PURPOSE

The find command finds a file. It can be just that simple, or it can be as complex as you’d like. You can enter any number of conditions—wildcards relating to the filename, when the file was created or last accessed, what links are present, and so on. It descends the directory tree beginning with the root directory or another directory that you name.

You can use the find command to learn if someone really knows Linux. If they use the find command and always place -print at the end of a command line, that means that know UNIX, not Linux. In standard UNIX, the find command requires -print at the end of the command line, to tell the command to print output to the screen. However, the Linux version of find doesn’t require -print, since the assumption is that you always want to print to the screen. So any 1book or magazine article that includes -print as part of the example command lines shows that the author doesn’t really know Linux.


Previous Table of Contents Next