<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[AdvinSuryavanshi]]></title><description><![CDATA[AdvinSuryavanshi]]></description><link>https://advinsuryavanshi.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Wed, 16 Sep 2026 16:30:56 GMT</lastBuildDate><atom:link href="https://advinsuryavanshi.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Linux CAT command]]></title><description><![CDATA[Uses of cat command.
cat(concatenate) is one of the most basic commands in Linux operation systems. every programmer should know about the cat command. It can be used for doing a lot of things as mentioned below.
1) Create a file
The command is:     ...]]></description><link>https://advinsuryavanshi.hashnode.dev/linux-cat-command</link><guid isPermaLink="true">https://advinsuryavanshi.hashnode.dev/linux-cat-command</guid><category><![CDATA[Linux]]></category><category><![CDATA[linux for beginners]]></category><category><![CDATA[linux-commands]]></category><category><![CDATA[BlogsWithCC]]></category><dc:creator><![CDATA[Advin Suryavanshi]]></dc:creator><pubDate>Sun, 14 Aug 2022 07:30:43 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/unsplash/hvSr_CVecVI/upload/v1660461259077/LH5YE56KF.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-uses-of-cat-command"><strong>  Uses of cat command.</strong></h2>
<p>cat(concatenate) is one of the most basic commands in Linux operation systems. every programmer should know about the cat command. It can be used for doing a lot of things as mentioned below.</p>
<h4 id="heading-1-create-a-file">1) Create a file</h4>
<p>The command is:       </p>
<p> <strong>$ cat &gt; file1</strong></p>
<p>output:-</p>
<p>A new file with the name <strong>file1</strong> will be created. Now you can write in the new text file once you are finished writing in the file press <strong>ctrl + d</strong> to save and exit.</p>
<p>example:- <strong>$ cat &gt; file1 </strong>
I am Advin Suryavanshi.
I am a student.
I am pursuing my bachelor of technology in computer science.
<strong>ctrl + d</strong></p>
<h4 id="heading-2-to-view-a-file">2) To view a  file</h4>
<p>The command is: </p>
<p><strong>$ cat file1</strong></p>
<p>output:-</p>
<p>This command is used to see the content of the file with the name <strong>file1</strong>.</p>
<h4 id="heading-3-to-view-multiple-files">3) To view multiple files</h4>
<p>The command is: </p>
<p><strong>$ cat file1 file2</strong></p>
<p>output:- </p>
<p>This command is used to see the content of the file with the name <strong>file1</strong> and <strong>file2</strong>.</p>
<h4 id="heading-4-to-view-the-contents-of-a-file-with-line-numbers">4) To view the contents of a file with line numbers.</h4>
<p>The command is: </p>
<p><strong>$ cat -n file1</strong></p>
<p>output:-</p>
<p>It shows content with line numbers.</p>
<p>example: $ cat -n file1 </p>
<p>1 I am Advin Suryavanshi.</p>
<p>2 I am a student.</p>
<p>3 I am pursuing my bachelor of technology in computer science.</p>
<h4 id="heading-5-to-write-in-an-already-existing-file">5) To write in an already existing file.</h4>
<p>The command is: </p>
<p><strong>$cat &gt;&gt; file1</strong></p>
<p> hello reader.</p>
<p>output:-</p>
<p>It Will append the text <strong>"hello reader."</strong> to the end of the <strong>file1</strong>.</p>
<p>so if we will now view the file using <strong>$ cat file1</strong>. </p>
<p>the output will be </p>
<p>I am Advin Suryavanshi.
I am a student.
I am pursuing my bachelor of technology in computer science.
<strong>hello reader.</strong></p>
<h4 id="heading-6-to-display-content-in-reverse-order">6) To display content in reverse order</h4>
<p>The command is: </p>
<p><strong>$ tac file1</strong></p>
<p>output:-</p>
<p>hello reader.</p>
<p>I am pursuing my bachelor of technology in computer science.</p>
<p>I am a student.</p>
<p>I am Advin Suryavanshi.</p>
<h4 id="heading-7-to-see-the-content-of-all-text-files-in-the-folder">7) To see the content of all text files in the folder.</h4>
<p>The command is: </p>
<p><strong>$ cat *.txt</strong></p>
<p>output:-</p>
<p>It Will show the content of all text files present in the folder.</p>
<h4 id="heading-8-copy-the-contents-from-one-file-to-another">8) Copy the contents from one file to another.</h4>
<p>The command is: </p>
<p><strong>$ cat [source file] &gt; [destination file]</strong></p>
<p>output:-</p>
<p>content for the source file will get copied into the destination file.</p>
<p>example: <strong>$ cat file1 &gt; file2</strong></p>
<p>now,<strong> file2 </strong>will have the content of <strong>file1.</strong></p>
<h4 id="heading-9-to-append-one-files-content-to-the-end-of-another">9) To append one file's content to the end of another.</h4>
<p>The command is: </p>
<p><strong>$ cat file1 &gt;&gt; file2</strong></p>
<p>output:-</p>
<p>content of <strong>file1</strong> is appended at the end of <strong>file2</strong>.</p>
<h4 id="heading-10-to-suppress-repeated-empty-lines">10) To suppress repeated empty lines</h4>
<p>The command is: </p>
<p><strong>$ cat -s file1</strong></p>
<p>output:-</p>
<p>In case your file has a lot of repeated empty lines. This command will reduce it to a single empty line.</p>
<h4 id="heading-11-to-merge-multiple-files-into-one">11) To merge multiple files into one</h4>
<p>The command is: </p>
<p><strong>$ cat "file1" "fille2" "file3" &gt; "final_file"</strong></p>
<p>output:-</p>
<p>The content of <strong>file1</strong>,<strong> file2</strong>, and<strong> file3</strong> will be inserted into the <strong>final_file</strong> in the given order.</p>
<h4 id="heading-12-to-highlight-the-end-of-every-line">12) To highlight the end of every line.</h4>
<p>The command is: </p>
<p><strong>$ cat -E "file1"</strong></p>
<p>output:-</p>
<p>end of every line will be highlighted.</p>
<p>There are some other uses of the cat command too. here I have mentioned the most common uses of the cat command.</p>
<p><a target="_blank" href="https://github.com/advinsuryavanshi">GITHUB</a>    <a target="_blank" href="https://www.linkedin.com/in/advin-suryavanshi-26563a177/">linkedIn</a>    <a target="_blank" href="https://www.youtube.com/channel/UCrOcP5_i6jtONMOFE7MLy-w">YOUTUBE</a>    <a target="_blank" href="https://www.instagram.com/addy.suya/">INSTAGRAM</a></p>
]]></content:encoded></item></channel></rss>