Unix File Commands

Few file related commands in Unix Operating System.

  • The “wc” can be used to count the number of lines, words and characters in a file.

Example:

wc filename -> will list the number of lines, words and characters.

wc -l filename -> will list the number of lines.

wc -w filename -> will list the number of words

wc -c filename -> will list the number of characters.

  • To find the duplicate lines in a file, we can use the “uniq” command.

Example:

uniq filename -> will list the distinct lines (removes the duplicate lines in a consecutive order).

Comments are closed.