<?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[Nico Is Writing Blogs]]></title><description><![CDATA[I am a developer in Cyber Security domain]]></description><link>https://nicoiswritingblogs.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Sat, 05 Sep 2026 07:11:55 GMT</lastBuildDate><atom:link href="https://nicoiswritingblogs.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[How to filter the output of a Linux command?]]></title><description><![CDATA[This might be the solution you are searching for. Let me explain more about what I meant by the title.
We all know the famous Linux command given below which lists all the files and subfolders in a directory along with the details.
ls -l

This comman...]]></description><link>https://nicoiswritingblogs.hashnode.dev/how-to-filter-the-output-of-a-linux-command</link><guid isPermaLink="true">https://nicoiswritingblogs.hashnode.dev/how-to-filter-the-output-of-a-linux-command</guid><category><![CDATA[Linux]]></category><category><![CDATA[linux-commands]]></category><category><![CDATA[awk]]></category><category><![CDATA[Filter]]></category><category><![CDATA[automation]]></category><dc:creator><![CDATA[Nico]]></dc:creator><pubDate>Sun, 09 Jul 2023 11:22:48 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1688900823162/a6b8cae3-2333-41fa-bf28-5936766ea044.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>This might be the solution you are searching for. Let me explain more about what I meant by the title.</p>
<p>We all know the famous Linux command given below which lists all the files and subfolders in a directory along with the details.</p>
<p><code>ls -l</code></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1688898079671/18dcbdf3-e919-4e75-9bf5-b8176061533a.png" alt /></p>
<p>This command output contains many details like permission, ownership, size etc.</p>
<p>Now, it turns out that you just need all the file names and corresponding permissions. You want them in a text file to do some subsequent tasks. That's where my blog post comes in, how can you filter the output of a Linux command?</p>
<p>I will use the <code>awk</code> command as shown. <code>awk</code> will accept data from standard input, work on it and send it out via standard output.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1688899725622/97f68660-f696-4c51-95ff-25e843c9bc65.png" alt /></p>
<p>Here the output of the <code>ls -l</code> command is fed to the <code>awk</code> command using the pipe <code>|</code> command. The <code>'{print $1,$9}'</code> part will print the first and ninth columns. You can also use a file as the input for <code>awk</code> command as shown below.</p>
<pre><code class="lang-plaintext">awk '&lt;command&gt;' &lt;input file path&gt;
</code></pre>
<p>If you want to save the output of a command to a text file you can do it by using the <code>&gt;&gt;</code> operator</p>
]]></content:encoded></item></channel></rss>