DirectNET

Data Center Management Solutions including UPS Systems, Data Center Cooling, KVM over IP & IP Power Strips, Server Racks and Server Rack accessories; KVM Switches and KVM Extenders; Rackmount Monitors and Rackmount Keyboards.


NAVIGATION
Home
Store
INSIDE MAC
Television Shows
Broadcast Shows
Daily News Shows
Special Shows
EVENTS
DAILY TIPS
Design
Mac OS X
Mac OS X UNIX
COMMUNITY
Surveys
NEWS
Current
Press
Archive
FEATURES
Editorial
Dr. Mac
Reviews
Reader Reports
RESOURCES
FAQ
Documentation
Learning Center
MAN pages
Glossary
Tutorials
Tips
Links

OUR PARTNERS

OSXFAQ Mac OS X UNIX Tip-of-the-Day   back to index

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


Discuss this trick in the Learning Center forum


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

Copyright © 2000-2010 Inside Mac Media, Inc. All rights reserved.
Apple assumes no responsibility with regard to the selection, performance, or use of the products or services. All understandings, agreements, or warranties, if any, take place directly between the vendors and prospective users.
Apple, the Apple logo, Mac, PowerMac G4, PowerMac G5, Xserve, Xserve RAID, PowerBook, iBook, Airport, AirPort Extreme, iMac, eMac, iLife, iMovie, iCal, iPhoto, iTunes, QuickTime, FireWire, iPod, iSight, AppleWorks, Macintosh, Jaguar, Panther, Mac OS, Mac OS X and Mac OS X Server are trademarks of Apple Computer, Inc.