Cartoon Edmund

Home

Calendar

Contact

Knight Vision

Sitemap



Edmund J. Sutcliffe
Thoughtful Solutions, Creatively Implemented and Communicated

Edmund's UNIX Quick Reference - 1 2 3
Click here for a printable version of this page.

File Management Commands

Wildcards - Pattern Matching
? any single character
[nmp] any character from list
[a-z] any character from range
[!a-z] any character not in range/list
* any group of characters inc. none
?(p1|p2) zero or one of pattern p1 or p2
@(p1|p2) exactly one of pattern p1 or p2
*(p1|p2) zero or more of pattern p1 or p2
!(p1|p2) any pattern other than p1 or p2
+(p1|p2) one or more of pattern p1 or p2

Tilde Expansion - Pattern Matching
~ Your home directory ($HOME)
~user user's home directory
~+ absolute path of current directory
~- absolute path of previous directory ($OLDPWD)

cd - Changing directory
cd .. moves you to the directory above current
cd / moves you to the root of the file systems

cat - Display the contents of a file
cat
filename

more - Display a file one screenful at a time
more filename

rm - Remove files
rm filename
Removes the specified filename from the directory.

- Show files in a directory
-a list all files including '.' files
-d list the directory file
-F

list files in 'fast format'
trailing '/' is a directory
trailing * is executable
trailing @ is a symbolic link

-g lists group ownership
-l long format
-n numeric ownership
-t sort by modified time

cp - Copy Files
cp sourcefile destinaion

sourcefile - any valid, existing filename
destination - any valid file or directory name

If destination is a directory, the copy is stored there with the same name; otherwise, it is stored in a file with the specified destination name.

mv - Move or rename files
mv sourcefile destination

Similar to the cp command. If the destination is a directory, the file is moved there. If the destination is another file in another directory, the moved file will assume the specified name in the specified directory. If the destination is another name but in the same directory as the source, the file is renamed.

Examples: assume "temp" is a directory
mv test temp        - moves "test" to "temp"
mv test temp/new - moves to "temp" as "new"
mv test new         - renames "test" to "new"

compress - Compress files
compress filename

Compresses the file and stores the result in filename.Z

uncompress - Uncompress file
uncompress filename.Z

Decompress filename.Z and restore the original file.

gzip - Compress files
gzip
filename

Compresses the file and stores the result in filename.gz. Uses a better algorithm than compress, and is the recommended version.

gunzip - Uncompress gzip files
gunzip filename.gz
gunzip filename.Z

Decompresses filename.gz or filename.Z and restores the original file.

zcat - Decompress and display file
zcat filename.gz
zcat filename.Z

Decompresses filename.Z or filename.gz and displays the original file on the screen. May be piped to more or less.
(Not available on all UNIX systems, check yours)

© Copyright Edmund J. Sutcliffe.


Cartoon Edmund

Quick Ref

Tech Tips

Travel Tips

Tech News

Images