Dreevoo.com | Online Learning and Knowledge Sharing
 
Home | Programs | Other applications | Open source programs | How to count number of words and rows in Linux files
Guest
Click to view your profile
Topics
Programs
Languages
Recipes
Home
Shortcuts
 
 

How to count number of words and rows in Linux files

Linux wc is a simple command that enables you to find out how many words and rows does a text file or output contain.

 
  Author: mat | Version: Ubuntu 12.04 | 24th July 2013 |  
 
 
1.
 

As already mentioned we will use a wc command.

As an example let's take a file names text.txt which contains text you can see on the image.

Recommended tutorial:



 
 
2.
 

Usage of the command is pretty straight forward.

wc file_name

In our case:
wc text.txt

We get three numbers as a result
First number is the number of rows, second number represent the number of words and the third number of characters.

 
 
3.
 

The wc command can also be applied with all other programs or commands that give an output as a result.

In this case we only need to add | wc

Let's take the folder listing ls -al as an example:

ls -al | wc

 
 
 
   
  Please login to post a comment
  Click to open user profile  
thefansbuzz, 19th Feb 2023, 7:46 PM
Get Cheapest SMM Panel social media panel services from Thefansbuzz that provides a wide range of social media services including Facebook advertising, Instagram ads, Google Ads, and much more. Get Cheapest social media panel services helps its customers grow their business by providing them with the best solutions. Visit our website at: https://thefansbuzz.com/
 
 
  Click to open user profile  
activedetaili, 13th Jun 2024, 1:01 PM
Car detailing services include thorough cleaning, polishing, and protection of a vehicle’s interior and exterior.
 
 
  Click to open user profile  
jameseo, 15th Jun 2024, 4:22 PM
I have never worked with a door company this flexible to my preference. They really got what I was looking for. Here's the link to their https://caldwells.com/exterior-doors.
 
 
  Click to open user profile  
Mirada3, 10th Oct 2024, 10:59 AM
In Linux, you can use the
wc
(word count) command to count the number of words, lines (rows), and even characters in a file https://geometry-lite.org
 
   
 
 
online learning made for people
Dreevoo.com | CONTRIBUTE | FORUM | INFO