file filename
    -- guess the file type
ls -l filename
    -- show the file's size (bytes)
wc filename
    -- show line/word/character count (text files only)
strings filename | more
    -- display the strings embedded in a binary file
more filename
    -- display text by the screenfull (text files only)
|
In general, you can name files and directories any way
you want in Unix, as long as you do not include
any blank spaces or any of these characters (which have
special meaning in Unix):
& ( ) < > $ ' " ` ; / | \ * ! ? In addition, in Unix we traditionally use lowercase letters for file names, but it is often handy to use uppercase characters in file names and directory names.Finally, some (not all) Unix programs/commands expect certain kinds of files to be named with particular suffixes. For example, PostScript files of the kind ready to be printed, are generally named using the suffix .ps, such as ``mydoc.ps''. The following is a guide to conventional file naming on Unix systems; it is descriptive, not prescriptive. |
| suffix | kind of file | ASCII or binary? | comments | |
|---|---|---|---|---|
| .ps | PostScript file | text | Don't try to text-edit this unless you are prepared to deal with the PostScript page-description language; normally such files are to view or print only | |
| .eps | Encapsulated PostScript file | text | a single-page single-image PostScript file | |
| PDF file (read by Acrobat Reader) | binary/mixed | Always transfer as binary! | ||
| suffix | kind of file | ASCII or binary? | comments | |
| .html | HTML (web page) file | text | usual web page | |
| .txt | plain text (ASCII) file | text | don't add the .txt unless you really want to emphasize the fact that it's plain text | |
| .bin | a binary file (non-ASCII) | binary | this says nothing about the actual use of the file; just that you can't treat it like text | |
| .asc | ASCII (plain text) file | text |   | |
| suffix | kind of file | ASCII or binary? | comments | |
| .png | PNG-format image file | binary | best format (on web pages) for icons and drawings | |
| .jpg | JPEG-format image file | binary | best format (on web pages) for photos | |
| .gif | GIF-format image file | binary | widespread, but for web use being supplanted by the non-proprietary PNG format | |
| suffix | kind of file | ASCII or binary? | comments | |
| .c | C program source file | text | human readable/editable; must be compiled with cc | |
| .h | C header file | text |   | |
| .f or .f90 | Fortran program source file | text | human readable/editable; must be compiled with f90 | |
| .o | compiled but unlinked binary file | binary | must be linked to other libraries/routines to make an executable file | |
| .a | compiled binary library | binary | contains pre-compiled routines, ready to be used | |
| suffix | kind of file | ASCII or binary? | comments | |
| .m, .nb | Mathematica source file, notebook | text | read/run using mathematica | |
| .m, .mat | Matlab source file, workspace | text | read/run using matlab | |
| .mpl, .mws | Maple source file, worksheet | text | read/run using xmaple | |
| .pro | IDL program file | text | read/run using idl | |
| suffix | kind of file | ASCII or binary? | comments | |
| .gz | file compressed with gzip | binary | decompress using gunzip | |
| .Z | file compressed with compress | binary | decompress using uncompress | |
| .tar | archive file created with tar | binary | read man page for tar | |
| suffix | kind of file | ASCII or binary? | comments | |
| .sh | Bourne shell (sh) script | text | executed using sh | |
| .pl | Perl script | text | uses powerful scripting language Perl; useful for text manipulation, web pages | |
| .awk | awk script | text | text filter; see man page for awk | |
| .dat | data file | either |   | |
| .sav | data file from IDL | either |   | |
| .man | manual page | text |   | |
| suffix | kind of file | ASCII or binary? | comments | |
| .o | compiled but unlinked binary file | binary | must be linked to other libraries/routines to make an executable file | |
| .a | compiled binary library | binary | contains pre-compiled routines, ready to be used | |
| .so | static object (binary) file | binary | precompiled routines, ready to be used | |
| suffix | kind of file | ASCII or binary? | comments | |
| .bak | a backup (copy) file | either |   | |
| .orig | backup (copy) file | either |   | |
| .dat | data file | either |   | |
| .log | log file (usually text) | either | records what happens | |
| suffix | kind of file | ASCII or binary? | comments | |
| .fig | xfig image file | text | use xfig for drawing diagrams, especially to be included in documents | |
| .tif | TIFF-format image file | binary | bitmap image format, great for printing but not for web pages | |
| .wav | WAV-format audio file | binary |   | |
| .mpg | MPEG-format animation file | binary | view with xanim or mpeg_play or with QuickTime | |
| .xbm | XBM-format image file | text | old-fashioned format for smallish icons | |
| .ppm | PPM-format image file | text | old-fashioned format for smallish icons | |
| suffix | kind of file | ASCII or binary? | comments | |
| .sdw | StarOffice document | binary | you should probably use the .doc or .xls suffix | |
| .doc | Word or StarOffice document | binary |   | |
| .xls | Excel or StarOffice spreadsheet | binary |   | |
| suffix | kind of file | ASCII or binary? | comments | |
| .tex | TeX or LaTeX source file | text | top-quality mathematical typesetting | |
| .dvi | DVI file (from TeX or LaTeX) | binary | intermediate file produced by latex | |
| .aux | AUX file (from TeX or LaTeX) | text | intermediate file produced by latex | |
| .sty | LaTeX style file | text | a file of macros | |
| .bib | bibliography file (from LaTeX) | text | the all-purpose format for storing bibliographic information (example) | |
| .bst | bibliography style (LaTeX) | text | file describes a specific way to display the bibliographic information in *.bib file | |
| .toc | table of contents file (LaTeX) | text | intermediate file produced by latex | |
| .tfm | font specification file | binary |   | |
| .afm | font specification file | binary |   | |
| suffix | kind of file | ASCII or binary? | comments | |
| .sit | Mac ``StuffIt'' file | binary | not useful on Unix or Windows computer | |
| .exe | DOS/Windows executable binary | binary | not useful on Unix or Mac computer | |