Davoud Teimouri

Virtualization & Datacenter

[How To]: Linux Cat Command – Usage and Examples

Linux Cat Command


Cat or “concatenate files and print on the standard output” is a Linux command to print file content on the standard output like screen. This is one of most popular Linux commands. I think that every Linux administrator has executed the below command at least one time πŸ˜‰ :

So this is actually very useful and popular command.

Usage and Examples


Cat command has few options but has lot of usages.

Show file content: If Cat command run without options, it will shows you the content of the file or files.

Linux Cat Command - Show Single File Content

Linux Cat Command – Show Single File Content

Show multiple files content: You can view content of multiple files by entering more than one file name in command line, see the below example:

Linux Cat Command - Show Multiple File Content

Linux Cat Command – Show Multiple File Content

Create New File: You be able to create new file by Cat command. Run the below command and then enter some strings and when it’s finished hit Enter, if you are end of a line and then Ctrl+D for save the new file. Please consider that existing files will be overwrite by run same command.

Linux Cat Command - Create New File

Linux Cat Command – Create New File

 

Join Multiple Files: Joining multiple files to a file is possible by Cat command. Here is an example:

Show Line Number: Cat command can show line number and content together. This is useful when you are reading files for debugging:

Read more about “cat” at its man page.

5,563 total views, 104 views today

[How To]: Linux Cat Command – Usage and Examples
5 (100%) 2 Votes
Davoud Teimouri is as a professional blogger, vExpert 2015-2016-2017, VCA, MCITP. This blog is started with simple posts and now, it has large following readers.

Leave a Reply

Teimouri.net © 2012 Frontier Theme
%d bloggers like this:
Read more:
HP Integrated Lights-Out 3 (iLO 3) – ESXi VM’s Showing 100% CPU Usage While Host CPU is Low

If you have read HP or VMware documents about power management on ProLiant servers, both have suggested that configure power...

Close