<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Linux on Nhat Tien</title><link>https://tienldn.online/tags/linux/</link><description>Recent content in Linux on Nhat Tien</description><generator>Hugo</generator><language>en</language><lastBuildDate>Thu, 19 Feb 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://tienldn.online/tags/linux/index.xml" rel="self" type="application/rss+xml"/><item><title>/dev/null trong linux</title><link>https://tienldn.online/blog/dev-null-in-linux/</link><pubDate>Wed, 24 Apr 2024 00:00:00 +0000</pubDate><guid>https://tienldn.online/blog/dev-null-in-linux/</guid><description>&lt;h2 id="1-what-is-devnull">1. What is &lt;code>/dev/null&lt;/code>? 
 
 
&lt;/h2>
&lt;p>Trong hệ thống Linux, device được lưu trữ trong thư mục &lt;code>/dev&lt;/code>. Có hai loại file device là physical và virtual. &lt;code>/dev/null&lt;/code> là một virtual null devices &lt;strong>được dùng để loại bỏ bất kì output nào ta redirect tới nó&lt;/strong>.&lt;/p>
&lt;h2 id="2-how-to-use">2. How to use 
 
 
&lt;/h2>
&lt;p>output can be &lt;code>stdout&lt;/code> or &lt;code>stderr&lt;/code>&lt;/p>
&lt;h3 id="21-with-stdout">2.1 With &lt;code>stdout&lt;/code> 
 
 
&lt;/h3>
&lt;p>This will discard &lt;code>echo&lt;/code> message&lt;/p>
&lt;figure class="highlight">
 &lt;div class="decoration-codeblock__right">
 &lt;button class="copy-btn">
 &lt;svg viewBox="0 0 24 24" height="20px" width="20px"
 fill="none" xmlns="http://www.w3.org/2000/svg">
 &lt;path d="M7.5 3H14.6C16.8402 3 17.9603 3 18.816 3.43597C19.5686 3.81947 20.1805 4.43139 20.564 5.18404C21 6.03969 21 7.15979 21 9.4V16.5M6.2 21H14.3C15.4201 21 15.9802 21 16.408 20.782C16.7843 20.5903 17.0903 20.2843 17.282 19.908C17.5 19.4802 17.5 18.9201 17.5 17.8V9.7C17.5 8.57989 17.5 8.01984 17.282 7.59202C17.0903 7.21569 16.7843 6.90973 16.408 6.71799C15.9802 6.5 15.4201 6.5 14.3 6.5H6.2C5.0799 6.5 4.51984 6.5 4.09202 6.71799C3.71569 6.90973 3.40973 7.21569 3.21799 7.59202C3 8.01984 3 8.57989 3 9.7V17.8C3 18.9201 3 19.4802 3.21799 19.908C3.40973 20.2843 3.71569 20.5903 4.09202 20.782C4.51984 21 5.0799 21 6.2 21Z" stroke="#d3d3d3" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">&lt;/path> 
 &lt;/svg>
 &lt;/button>
 &lt;/div>
 &lt;pre tabindex="0" class="chroma">
 &lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="ln">1&lt;/span>&lt;span class="cl">&lt;span class="nb">echo&lt;/span> &lt;span class="s1">&amp;#39;Hello from JournalDev&amp;#39;&lt;/span> &amp;gt; /dev/null&lt;/span>&lt;/span>&lt;/code>
 &lt;/pre>
&lt;/figure>
&lt;h3 id="22-with-stderr">2.2 With &lt;code>stderr&lt;/code> 
 
 
&lt;/h3>
&lt;p>Discard error output&lt;/p></description></item></channel></rss>