Linux Commands – cat

Linux Commands – cat

Linux Commands – cat

Hello Everyone

Welcome to CloudAffaire and this is Debjeet.

In the last blog post, we have discussed printf command in Linux which is used to format and print in standard output in Linux.

https://cloudaffaire.com/linux-commands-printf/

In this blog post, we will discuss cat command in Linux. In Linux, cat command is used to copy file contents to standard output. If no file is given, cat command copies standard input to standard output.

Linux Commands – cat:

You can use the cat command to display the content of files in standard output.

You can use cat -n or –number options to display line number along with the file content.

You can use cat -E or –show-ends to display $ at each line ending.

You can use cat -s or –squeeze-blank options to suppress repeated empty output lines.

You can use cat -b or –number-nonblank options to number nonempty output lines, overrides -n option.

You can use cat -v or –show-nonprinting options to display ^ and M- notation wherever a non-printable character appears, except for LFD and TAB.

You can use cat -T or –show-tabs options to display TAB characters as ^I.

You can use cat -A or –show-all options to display non-printing (^ and M-), tab (^I) and $ at the end of line, equivalent to -vET.

You can use cat -e option to display non-printing (^ and M-) and $ at the end of line, equivalent to -vE.

You can use the cat command to display multiple file contents at once. You can use regular expressions for file names.

You can use cat command with input-output redirection operators (> >> <).

Hope you have enjoyed this article. In the next blog post, we will discuss diff command in Linux.

 

Leave a Reply

Close Menu