In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how to use the wc command in Linux. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Linux commonly used command wc command is used to calculate the word count, using the wc instruction we can calculate the Byte number, word number, or column number of the file. If the file name is not specified, or the file name given is "-", the wc instruction will read data from the standard input device.
Syntax wc [- clw] [--help] [--version] [file.]
Parameters:
-c or-bytes or-chars displays only the number of Bytes. -l or-lines displays the number of rows. -w or-words displays only the number of words. -help online help. -version displays version information. Example
By default, wc calculates the number of lines, words, and bytes of the specified file. The commands used are:
Wc testfile
If you look at the contents of the testfile file first, you can see:
$cat testfile Linux networks are becoming more and more common, but scurity is often an overlooked issue. Unfortunately, in today's environment all networks are potential hacker targets, fro0m tp-secret military research networks to small home LANs. Linux Network Securty focuses on securing Linux in a networked environment, where the security of the entire network needs to be considered rather than just isolated machines. It uses a mix of theory and practicl techniques to teach administrators how to install and use security applications, as well as how the applcations work and why they are necesary. Using wc statistics, the results are as follows: statistics of $wc testfile # testfile file 392 598 testfile # testfile file has 3 lines, 92 words and 598 bytes
The three numbers represent the number of lines, words, and bytes of the testfile file, respectively.
If you want to count the information of multiple files at the same time, such as testfile, testfile_1 and testfile_2, you can use the following command:
Wc testfile testfile_1 testfile_2 # Statistics the information of three files
The output is as follows:
$wc testfile testfile_1 testfile_2 # Statistics the information of three files 392 598 testfile # the first file has lines 3, words 92, bytes 598 9 18 78 testfile_1 # the second file has lines 9, words 18, bytes 78 3 6 32 testfile_2 # the third file has lines 3, words 6, Total number of bytes 32 15 116 708 # the total number of lines of the three files is 15, the number of words is 116, and the number of bytes is 708
Thank you for reading! This is the end of the article on "how to use wc commands in Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.