RSS Subscription
Linux Howtos & Tutorials

Enter your email:

Delivered by


NOTE:New tutorials are from LinuxCareer.com

Poll

Do you own or wish to have iPhone?
 


Linux eBooks FREE Download
A guide to programming Linux kernel modules
Introduction to Linux - A Hands on Guide
A Newbie's Getting Started Guide to Linux

Linux from Scratch - Create Your Own Linux System - Free eBook

Linux: The Hacking Solution (v.3.0)

SQLite 3 with PHP Essential Training – Free Video Training Tutorials

This guide will introduce you to the world of GNU/Linux

The GNU/Linux Advanced Administration

A Complete Beginner's Manual for Ubuntu 10.04 (Lucid Lynx)

Advanced Bash-Scripting Guide

Set up, maintain, and secure a small office email server

Partner Linux Sites:
How-To.LinuxCareer.com
Jobs.LinuxCareer.com
TuxMachines
Monsterb
LinuxBloggers
AdamsInfo
LinuxScrew
All For Linux

cat

Article Index
1. Name
2. Synopsis
3. Frequently used options
4. Examples

1. Name

cat [man page] - concatenate files and print on the standard output

2. Synopsis

cat [OPTION] [FILE]... 

3. Frequently used options

-n, --number        number all output lines 

4. Examples

cat read content of a file(s) and print then on standard output which is in many cases our terminal. Lets suppose that our file samba.txt contain text:
Samba file and printer sharing is supported by all Linux Distributions: Suse Linux, Debian Linux,
Mandrake Linux, Red Hat Linux, Fedora Linux, Gentoo Linux
When we cat file cat.txt cat will read content of a file a spit it out to stdout:
cat samba.txt 
cat will read content of a file
As a description of this command suggest we can also concatenate two files. Our second file ubuntu.txt contain:
and Ubuntu Linux. 
Lets see what happens when we cat both files at once:
$ cat samba.txt ubuntu.txt 
cat both files at once
Now we can use cat to concatenate two files and create new file samba_support.txt.
$ cat samba.txt ubuntu.txt > samba_support.txt 
concatenate two files with cat command
With use of pipe we can redirect output of cat command to another command such us bc:
$ echo '2+2' > '2+2.txt' $ cat 2+2.txt | bc 
redirect output of cat command
by -n option we also tell cat to number lines:
$ cat -n samba_support.txt 
cat can number lines

Share this linux post:

Submit cat in Delicious Submit cat in Digg Submit cat in FaceBook Submit cat in Google Bookmarks Submit cat in Stumbleupon Submit cat in Technorati Submit cat in Twitter
 
Comments for this page are closed !!!
Please visit our new Linux Forum for additional help or discussion.


Linux eBooks FREE Download