Overview for wc

How to count number of folders in folder|directory in Linux?

To count number of folders/directories/files in folder/directory is possible using wc command with a parameter -l. But we have to be sure, that we are counting only folders, so let's filter only folder using ls command, and then count then.

My example:

$ pwd
/home/dima/

Then let's take a look, which files and folders we have:

Read more

Written by Administrator on Saturday April 11, 2020

How to count characters in file in openSUSE Linux using terminal

Linux command line is very powerful tool even for string and character operations without installing any third-party applications.

To count number of characters in some file, containing text, you can use wc command with -m parameter using following scheme:

$ wc -m <file_name>

Examples:

$ wc -m nata-ubuntu-settings 
21 nata-ubuntu-settings

$ wc -m it-slang-v-rustine 
1019 it-slang-v-rustine

$ wc -m rongta-files-installation 
389 rongta-files-installation

Read more

Written by Administrator on Saturday April 11, 2020