Working with Files and Directories
You can use the following tools to compare, copy, and examine files.
-
cat
Concatenates and displays files.
-
cd
Changes directory.
-
chflags
Changes file flags.
-
chmod
Changes access modes on files.
-
cmp
Compares two files, byte-by-byte.
-
comm
Compares two sorted files.
-
cp
Copies files.
-
diff
Compares two files, line-by-line.
-
diff3
Compares three files.
-
file
Determines a file’s type.
-
head
Shows the first few lines of a file.
-
less
Serves as an enhanced alternative to
more
.-
ln
Creates symbolic or hard links.
Tip
Symbolic and hard links are not the same as Carbon aliases that you create in the Finder (File → Make Alias). Unix programs cannot follow Carbon aliases, but all Mac OS X applications (Carbon, Cocoa, Classic, and Unix) can follow symbolic or hard links.
-
ls
Lists files or directories.
-
mkdir
Makes a new directory.
-
more
Displays files one screen at a time.
-
mv
Moves or renames files or directories.
-
patch
Merges a set of changes into a file.
-
pwd
Prints the working directory.
-
rcp
Insecurely copies a file to or from a remote machine. Use
scp
instead.-
rm
Removes files.
-
rmdir
Removes directories.
-
scp
Secures alternative to
rcp
.-
sdiff
Compares two files, side-by-side and line-by-line.
-
split
Splits files evenly.
-
tail
Shows the last few lines of a file.
-
vis
Displays nonprinting characters in a readable form.
-
unvis
Restores the output of
vis
to its original form.-
wc
Counts lines, words, and characters.
-
zcmp
Compares two compressed files, ...
Get Mac OS X Panther for Unix Geeks, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.