Viewing files with cat, more, less, head, and tail


Article from Issue 64/2006

Practical tools such as cat, less, and head are convenient for viewing text.

You don’t always need to launch an editor to view text files at the console. More often than not, a simple viewer is far quicker. But the programs we will be looking at in this month’s issue have a lot more tricks up their sleeves. If you are looking for a fast approach to concatenating multiple files in a single file, cat is the tool you need. This article also looks at tips for the more and less pagers, showing you more convenient approaches to using these tools. And if you are just interested in grabbing the first or last few lines of a file, head and tail are the tools you need. Catwalk

cat lets you output a text file via standard output:

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Most Is More Than Less

    If you like to customize your command-line file pager, check out most.

  • Command Line: Viewing Files

    If you just want to peek into a text file, Linux has an abundance of commands to satisfy your curiosity.

  • Command Line: Archives

    Gzip and bzip2 not only compress files, they also provide lean and powerful tools for viewing, searching, and comparing text files.

  • Logfile Viewers

    While users are surfing the web, listening to music, and writing documents, the kernel and various background daemons write information to logfiles. KSystemLog, Gnome System Log Viewer, and MultiTail will help you read and process logfile data.

  • Command Line: Diffutils

    The Diffutils tool set helps you compare text files, discover and display the differences between files, and even automatically synchronize files.

comments powered by Disqus

Direct Download

Read full article as PDF:

Command_Line_File_Viewers.pdf (39.46 kB)