LINUX command [wc edition] Usage example

wc command

-Displays the "number of lines", "number of words", and "number of bytes" of the file.

$wc


$ $wc /etc/passwd

Execution result


[hkoen@localhost ~]$ wc /etc/passwd
  44  101 2433 /etc/passwd

44: Number of lines 101: Number of words 2433: Number of bytes

Optional commands

・ -L: Only the number of lines ・ -W: Only the number of words -C: Only the number of bytes

Execution result(-l)


[hkoen@localhost ~]$ wc -l /etc/passwd
 44 /etc/passwd

How do you actually use it? !!

The procedure for counting the number of lines with wc -l is It is often used before cating or greping a file whose contents are unknown. If you suddenly cat or grep a file you do not know, This is because there is a risk that a huge number of lines will be output on the terminal.

It is also used for log analysis purposes in combination with grep with specific wording. It is also useful for investigating the number of accesses to a specific application on the WEB server and investigating the result of batch processing.

Recommended Posts

LINUX command [wc edition] Usage example
LINUX command [wc edition] Usage example
Keras usage example: Input (Embedding + Flatten)
linux sar command CPU usage
Linux command # 4
Linux command # 3
Linux command # 5
Linux command list
linux at command
[Linux] Search command
Linux command <Basic 2>
Linux server command
Linux # Command Memo 1
Linux command [read]
Linux Command Summary
[Basic] linux command
Linux [shell command]
[Linux] Command / Knowledge
My linux command
Linux command <Basic 1>
Linux command collection
Linux mkdir command
Linux command basics
[Linux] Git command
Linux (command memory)
[Linux] Volume configuration command
Linux command cheat sheet
Linux command (sequential update)
Linux basic command memorandum
Linux command [File operation]
[Linux] Basic command summary
Linux command for self-collection
linux command error collection 1
Linux command line shortcut
[Linux] tar.gz compression / decompression command
What is Linux? [Command list]
Monitor disk usage on Linux
Convenient diff command usage notes
virtualenv Basic command usage memo
Easy df command on Linux
Linux tar xz command memo
Linux Command Dictionary (for myself)
linux: create original Terminal command
[Note] Useful linux command collection
Linux command memorandum [for beginners]
Linux PC spec check command
[Linux] User / group command summary
Check server I / O device usage with the Linux iostat command