<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>head command Archives - Linux Windows and android Tutorials</title>
	<atom:link href="https://www.osradar.com/tag/head-command/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.osradar.com</link>
	<description>tutorials and news and Seurity</description>
	<lastBuildDate>Sat, 22 Feb 2020 23:43:22 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.8.12</generator>
	<item>
		<title>The Linux head command</title>
		<link>https://www.osradar.com/the-linux-head-command/</link>
					<comments>https://www.osradar.com/the-linux-head-command/#respond</comments>
		
		<dc:creator><![CDATA[angeloma]]></dc:creator>
		<pubDate>Wed, 26 Feb 2020 23:42:00 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[command]]></category>
		<category><![CDATA[commands]]></category>
		<category><![CDATA[head command]]></category>
		<category><![CDATA[terminal]]></category>
		<guid isPermaLink="false">https://www.osradar.com/?p=18457</guid>

					<description><![CDATA[<p>Hi, folks. We&#8217;re still exploring the terminal and this time we&#8217;re going to focus on the Linux head command. So let&#8217;s go for it. If you&#8217;re new to Linux you probably won&#8217;t like the terminal, and that&#8217;s understandable but I&#8217;m also telling you that it&#8217;s a very powerful tool and it&#8217;s not as complicated as [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/the-linux-head-command/">The Linux head command</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Hi, folks. We&#8217;re still exploring the terminal and this time we&#8217;re going to focus on the Linux head command. So let&#8217;s go for it.</p>
<p>If you&#8217;re new to Linux you probably won&#8217;t like the terminal, and that&#8217;s understandable but I&#8217;m also telling you that it&#8217;s a very powerful tool and it&#8217;s not as complicated as it seems. Also, many sysadmin users use it almost every day and this is because it is very efficient.</p>
<p>Yes, it is true, there are more complicated commands to use but in this case, the head command is quite simple.</p>
<h2>Introduction</h2>
<p>The head command is the complement of the <a href="https://www.osradar.com/the-linux-tail-command/" target="_blank" rel="noopener noreferrer">Tail command</a>. It is used to display the first few lines of a text file. Therefore, the use of this command is very useful for sysadmin that needs to check logs constantly.</p>
<p>Like the Tail command, the head command belongs to GNU utils which is a range of tools for processing files and folders by the terminal. So this command is for sure available in your favorite Linux distribution.</p>
<p>Now we will show you how to use it with some simple examples.</p>
<h2>Using the Linux Head command</h2>
<p>The Head command is one of the simplest there is. The basic syntax of the command is as follows:</p>
<pre>~$ head [OPTION]... [FILE]..</pre>
<p>As you can see there are options that alter the behavior of the command. To see all the available options, just use this command:</p>
<pre>:~$ head --help</pre>
<figure id="attachment_18475" aria-describedby="caption-attachment-18475" style="width: 812px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-18475" src="https://www.osradar.com/wp-content/uploads/2020/02/1-16.png" alt="1.- The head command" width="812" height="502" srcset="https://www.osradar.com/wp-content/uploads/2020/02/1-16.png 812w, https://www.osradar.com/wp-content/uploads/2020/02/1-16-300x185.png 300w, https://www.osradar.com/wp-content/uploads/2020/02/1-16-768x475.png 768w, https://www.osradar.com/wp-content/uploads/2020/02/1-16-356x220.png 356w, https://www.osradar.com/wp-content/uploads/2020/02/1-16-696x430.png 696w, https://www.osradar.com/wp-content/uploads/2020/02/1-16-679x420.png 679w" sizes="(max-width: 812px) 100vw, 812px" /><figcaption id="caption-attachment-18475" class="wp-caption-text">1.- The head command</figcaption></figure>
<p>And as you can see in the image, they are few and this reaffirms what I said about it being a pretty simple command to use.</p>
<p>To better demonstrate the use of the command, I have created a text file called <strong>example.txt</strong> and added certain names.</p>
<figure id="attachment_18389" aria-describedby="caption-attachment-18389" style="width: 791px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-18389" src="https://www.osradar.com/wp-content/uploads/2020/02/2-12.png" alt="2.- Example file" width="791" height="297" srcset="https://www.osradar.com/wp-content/uploads/2020/02/2-12.png 791w, https://www.osradar.com/wp-content/uploads/2020/02/2-12-300x113.png 300w, https://www.osradar.com/wp-content/uploads/2020/02/2-12-768x288.png 768w, https://www.osradar.com/wp-content/uploads/2020/02/2-12-696x261.png 696w" sizes="(max-width: 791px) 100vw, 791px" /><figcaption id="caption-attachment-18389" class="wp-caption-text">2.- Example file</figcaption></figure>
<p>option. For example, display the first 3 lines of the file.</p>
<pre>:~$ head -n 3 example.txt</pre>
<figure id="attachment_18476" aria-describedby="caption-attachment-18476" style="width: 784px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-18476" src="https://www.osradar.com/wp-content/uploads/2020/02/2-15.png" alt="3.- Using the Linux head command" width="784" height="147" srcset="https://www.osradar.com/wp-content/uploads/2020/02/2-15.png 784w, https://www.osradar.com/wp-content/uploads/2020/02/2-15-300x56.png 300w, https://www.osradar.com/wp-content/uploads/2020/02/2-15-768x144.png 768w, https://www.osradar.com/wp-content/uploads/2020/02/2-15-696x131.png 696w" sizes="(max-width: 784px) 100vw, 784px" /><figcaption id="caption-attachment-18476" class="wp-caption-text">3.- Using the Linux head command</figcaption></figure>
<p>We can even use the head command to display a number of bits of the file. This is made possible by the -c option.</p>
<pre>:~$ head -c 10 example.txt</pre>
<figure id="attachment_18477" aria-describedby="caption-attachment-18477" style="width: 819px" class="wp-caption alignnone"><img loading="lazy" class="wp-image-18477 size-full" src="https://www.osradar.com/wp-content/uploads/2020/02/3-12.png" alt="4.- Using -c option on the head command" width="819" height="144" srcset="https://www.osradar.com/wp-content/uploads/2020/02/3-12.png 819w, https://www.osradar.com/wp-content/uploads/2020/02/3-12-300x53.png 300w, https://www.osradar.com/wp-content/uploads/2020/02/3-12-768x135.png 768w, https://www.osradar.com/wp-content/uploads/2020/02/3-12-696x122.png 696w" sizes="(max-width: 819px) 100vw, 819px" /><figcaption id="caption-attachment-18477" class="wp-caption-text">4.- Using -c option on the head command</figcaption></figure>
<p>Finally, it is possible to use the -v option to display the title of the file. Use it in some cases.</p>
<pre>:~$ head -v example.txt</pre>
<figure id="attachment_18478" aria-describedby="caption-attachment-18478" style="width: 643px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-18478" src="https://www.osradar.com/wp-content/uploads/2020/02/4-12.png" alt="5.- Verbose mode" width="643" height="249" srcset="https://www.osradar.com/wp-content/uploads/2020/02/4-12.png 643w, https://www.osradar.com/wp-content/uploads/2020/02/4-12-300x116.png 300w" sizes="(max-width: 643px) 100vw, 643px" /><figcaption id="caption-attachment-18478" class="wp-caption-text">5.- Verbose mode</figcaption></figure>
<p>And well, that&#8217;s it. The head command is quite useful and simple to use and using it with the tail command makes an extraordinary combination.</p>
<p>Please, share this post and join our <a href="https://t.me/osradar" target="_blank" rel="noopener noreferrer">Telegram channel</a>.</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/the-linux-head-command/">The Linux head command</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.osradar.com/the-linux-head-command/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
