<?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>tail Archives - Linux Windows and android Tutorials</title>
	<atom:link href="https://www.osradar.com/tag/tail/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.osradar.com</link>
	<description>tutorials and news and Seurity</description>
	<lastBuildDate>Thu, 20 Feb 2020 20:59:23 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.8.13</generator>
	<item>
		<title>The Linux tail command</title>
		<link>https://www.osradar.com/the-linux-tail-command/</link>
					<comments>https://www.osradar.com/the-linux-tail-command/#respond</comments>
		
		<dc:creator><![CDATA[angeloma]]></dc:creator>
		<pubDate>Mon, 24 Feb 2020 00:11:00 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[linux command]]></category>
		<category><![CDATA[tail]]></category>
		<category><![CDATA[tail command]]></category>
		<category><![CDATA[terminal]]></category>
		<guid isPermaLink="false">https://www.osradar.com/?p=18387</guid>

					<description><![CDATA[<p>Hey, buddy. This time we will explain in detail the Linux tail command. Quite used by many sysadmin. One of the most feared tools for newcomers is the Linux terminal. However, its use is decreasing every day thanks to the incredible improvements that the system has received. But in the administration of servers, there are [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/the-linux-tail-command/">The Linux tail 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>Hey, buddy. This time we will explain in detail the Linux tail command. Quite used by many <a href="https://www.osradar.com/tag/sysadmin" target="_blank" rel="noreferrer noopener" aria-label="sysadmin (opens in a new tab)">sysadmin</a>.</p>



<p>One of the most feared tools for newcomers is the <a href="https://www.osradar.com/tag/linux" target="_blank" rel="noreferrer noopener" aria-label="Linux (opens in a new tab)">Linux</a> terminal. However, its use is decreasing every day thanks to the incredible improvements that the system has received. But in the administration of servers, there are no graphical interfaces to manage the system, for security reasons. So it&#8217;s up to you to familiarize yourself with the console and the commands.</p>



<p>And if we talk about commands there are many, but many syadmins use some more than the novice users. Tail is one of them and today we will help you to use it and tell you what it is used for.</p>



<h2>The Tail command</h2>



<p><a href="https://www.gnu.org/software/coreutils/" target="_blank" rel="noreferrer noopener" aria-label="Tail (opens in a new tab)">Tail</a> is a command to show the last lines of a text file. It is quite useful for exploring log files that generate services on Linux. Also, it is used to monitor changes that may have happened to this file.</p>



<pre class="wp-block-preformatted">:~$ tail [OPTION]… [FILE]…</pre>



<p>Of course, this syntax is the basic form of usage. The behavior of the command is modifiable thanks to the options it has. To see them, use this command:</p>



<pre class="wp-block-preformatted">:~$ tail --help</pre>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" src="https://www.osradar.com/wp-content/uploads/2020/02/1-13.png" alt="1.- The tail command help" class="wp-image-18388" width="696" height="413" srcset="https://www.osradar.com/wp-content/uploads/2020/02/1-13.png 936w, https://www.osradar.com/wp-content/uploads/2020/02/1-13-300x178.png 300w, https://www.osradar.com/wp-content/uploads/2020/02/1-13-768x456.png 768w, https://www.osradar.com/wp-content/uploads/2020/02/1-13-696x413.png 696w, https://www.osradar.com/wp-content/uploads/2020/02/1-13-707x420.png 707w" sizes="(max-width: 696px) 100vw, 696px" /><figcaption>1.- The tail command help</figcaption></figure>



<p>However, I will explain with some examples of how easy and useful it is to use the Tail command.</p>



<h2>Using the Linux tail command &#8211; examples</h2>



<p>First, I created a text file containing several random names for this example. It is called <code>example.txt</code> and has the following content:</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="791" height="297" src="https://www.osradar.com/wp-content/uploads/2020/02/2-12.png" alt="2.- Example file" class="wp-image-18389" 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>2.- Example file</figcaption></figure>



<p>Now let&#8217;s get started.</p>



<p>To display the last 10 lines of the file, just use the following command:</p>



<pre class="wp-block-preformatted">:~$ tail example.txt
tom
david
joseph
clancy
richard
robert
henry
harry
paul</pre>



<figure class="wp-block-image size-large"><img loading="lazy" width="508" height="226" src="https://www.osradar.com/wp-content/uploads/2020/02/3-10.png" alt="3.- Using the Linux tail command" class="wp-image-18390" srcset="https://www.osradar.com/wp-content/uploads/2020/02/3-10.png 508w, https://www.osradar.com/wp-content/uploads/2020/02/3-10-300x133.png 300w" sizes="(max-width: 508px) 100vw, 508px" /><figcaption>3.- Using the Linux tail command</figcaption></figure>



<p>This is the most basic use of the command.</p>



<p>However, it is possible to change this behavior. For example, we can indicate how many lines to show. If we want to show the last 3 lines, just use it:</p>



<pre class="wp-block-preformatted">:~$ tail -n 3 example.txt
harry
paul
</pre>



<figure class="wp-block-image size-large"><img loading="lazy" width="767" height="125" src="https://www.osradar.com/wp-content/uploads/2020/02/4-9.png" alt="4.- using the command with options" class="wp-image-18391" srcset="https://www.osradar.com/wp-content/uploads/2020/02/4-9.png 767w, https://www.osradar.com/wp-content/uploads/2020/02/4-9-300x49.png 300w, https://www.osradar.com/wp-content/uploads/2020/02/4-9-696x113.png 696w" sizes="(max-width: 767px) 100vw, 767px" /><figcaption>4.- using the command with options</figcaption></figure>



<p>Simply replace the 3 with the number you want to display. Remember we&#8217;re always talking about the last few lines of the file.</p>



<p>On the other hand, we can show the lines that are after a specific line. For example, to show the lines after the 7th line:</p>



<pre class="wp-block-preformatted">:~$ tail +7 example.txt
clancy
richard
robert
henry
harry
paul
</pre>



<figure class="wp-block-image size-large"><img loading="lazy" width="368" height="128" src="https://www.osradar.com/wp-content/uploads/2020/02/5-9.png" alt="5.- The tail command" class="wp-image-18392" srcset="https://www.osradar.com/wp-content/uploads/2020/02/5-9.png 368w, https://www.osradar.com/wp-content/uploads/2020/02/5-9-300x104.png 300w" sizes="(max-width: 368px) 100vw, 368px" /><figcaption>5.- The tail command</figcaption></figure>



<p>It&#8217;s super useful this option.</p>



<p>However, sysadmin uses this command to monitor log files. And it is possible to do it in real-time using the -f option. That is, the last lines of the file are displayed, but as it is modified, the output will be updated:</p>



<pre class="wp-block-preformatted">:~$ tail -f example.txt</pre>



<figure class="wp-block-image size-large"><img loading="lazy" width="733" height="220" src="https://www.osradar.com/wp-content/uploads/2020/02/6-7.png" alt="6.- Monitoring files with tail" class="wp-image-18393" srcset="https://www.osradar.com/wp-content/uploads/2020/02/6-7.png 733w, https://www.osradar.com/wp-content/uploads/2020/02/6-7-300x90.png 300w, https://www.osradar.com/wp-content/uploads/2020/02/6-7-696x209.png 696w" sizes="(max-width: 733px) 100vw, 733px" /><figcaption>6.- Monitoring files with tail</figcaption></figure>



<p>Tail will monitor the file constantly, so press CTRL + C to exit.</p>



<p>Finally, you can display the command version as follows:</p>



<pre class="wp-block-preformatted">:~$ tail --version
tail (GNU coreutils) 8.28
 Copyright (C) 2017 Free Software Foundation, Inc.
 License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html.
 This is free software: you are free to change and redistribute it.
 There is NO WARRANTY, to the extent permitted by law.
 Written by Paul Rubin, David MacKenzie, Ian Lance Taylor,
 and Jim Meyering.</pre>



<p>And that is it.</p>



<h2>Conclusion</h2>



<p>The Tail command is a very useful terminal command. Widely used by many sysadmin for daily work it is also used for all those who wish to quickly view the contents of a file. Thanks to the examples, shown, you can see the potential of it and take advantage of it.</p>



<p>Please share this post and join <a href="https://t.me/osradar" target="_blank" rel="noreferrer noopener" aria-label="our Telegram channel (opens in a new tab)">our Telegram channel</a>.</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/the-linux-tail-command/">The Linux tail 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-tail-command/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
