Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Viewing Text Files

A text file is simply a normal file that happens to contain human-readable text. There's nothing special about it otherwise. The other kind of file, a binary file, is meant to be interpreted by the computer.

You can view either kind of file with the less file pager if you have it installed (install it if you haven't, it's quite useful). Type less /etc/profile to view a sample text file. Notice that you can read the characters even if their meaning is obscure. Type less /bin/ls to view a binary file. As you can see, the ls program is not meant to be read by humans.

Sometimes, you'll find files that end with .gz. These files may be viewed with zless; you can run it like so:

zless /usr/doc/ae/changelog.Debian.gz

Tip: zless is great for viewing documentation, which is often shipped in .gz form.

The difference between the two kinds of files is purely a matter of what they contain, unlike in some other systems (such as DOS and MacOS), which actually treat the files differently.

Text files can contain shell scripts, documentation, copyright notices, or any other human-readable text.

Incidentally, this illustrates the difference between source code and binary executables. /bin/ls is a binary executable you can download from Debian, but you can also download a text file that tells the computer how to create /bin/ls. This text file is the source code. Comparing /bin/ls to /etc/profile illustrates how important source code is if someone wants to understand and modify a piece of software. Free software provides you or your consultants with this all-important source code.

John Goerzen / Ossama Othman

 
 
  Published under the terms of the GNU General Public License Design by Interspire