|
OSXFAQ Mac OS X UNIX Tip-of-the-Day

Week 101 - Unix Commands Reference (7 March 2005)
by
Adrian Mayo - Editor, OSXFAQ
Tuesday - Commands to View Files
cat ... display a file
Cat actually concatenates many files and writes the result to standard out (the screen)
Redirect to a file to actually join files
Option -b to number non-blank lines
Option -s to collapse multiple blank lines
Option -v to display non-printing characters so they are visible
more ... display a file in a paged manner
Scroll up and down with the cursor keys
Page up and down with the 'u' and 'd' keys
Search for text with /text-to-search-for
And lots, lots *more*, see 'man more'
less ... display a file in a paged manner
Like more, but much more than more
See 'man less'
lesskey ... specify key binding for less
Specify alternative key binding for controlling less
head ... display the first 10 lines of a file
Option -n specifies a different number of lines to display
tail ... display the last 10 lines of a file
Option -n specifies a different number of lines to display
(See tips week 4)
zcat, zmore ... cat and more zipped files
bzcat, bzmore, bzless ... cat, more, less on bzipped files
wc ... line, word, and character count files
Options -l, -w, and -c to control what is counted
file ... determine the type of a file
pr ... display files with pagination
Display files page by page with headers and footers
vis ... display files with non-printable characters
Does a better job than 'cat -v'
strings ... search a binary file for printable strings
Option -a to search the whole file, not just binary sections (applicable mainly to executables)
hexdump ... display binary files
The output shows the hexadecimal value of each byte
Option -n len to display only the first 'len' bytes
xxd ... display binary files
Like 'hexdump' but displays both the hexadecimal and character representation of each byte (or '.' for non-printable characters)
(See tips week 95)
emacs ... powerful text editor
vi/vim ... the best text editor
(See tips weeks 50, 53, and 69)
pico ... a simple text editor
If you want to learn more about Mac OS X Unix visit the Learning Center
click.
- For beginners: Mac OS X Unix Tutorials
- For detailed information on specific topics: Advanced Unix
- For OS X in gereral: Mac OS X Tutorials
|