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

wc

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

1. Name

wc [man page] - print newline, word, and byte counts for each file

2. Synopsis

wc [OPTION]... [FILE]...
wc [OPTION]... --files0-from=F

3. Frequently used options

-c, --bytes      print the byte counts
-m, --chars print the character counts
-l, --lines print the newline counts
-w, --words print the word counts

4. Examples

By default if you pass file as a argument to wc command it prints number of lines, words and characters:

wc /etc/passwd 

wc default output
To instruct wc command to print only number of words contained within file we can use -w option:

wc -w /etc/passwd 

wc words output
Similarly if we need only number of lines we would use -l option:

wc -l /etc/passwd 

wc lines output
For number of characters we need to use -c option:

wc -m /etc/passwd 

wc characters output
wc can also print out a number of bytes within file:

wc -c /etc/passwd 

wc bytes output

Share this linux post:

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


Linux eBooks FREE Download