<?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>linux command Archives - Linux Windows and android Tutorials</title>
	<atom:link href="https://www.osradar.com/tag/linux-command/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.12</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>
		<item>
		<title>The wget command</title>
		<link>https://www.osradar.com/the-wget-command/</link>
					<comments>https://www.osradar.com/the-wget-command/#respond</comments>
		
		<dc:creator><![CDATA[angeloma]]></dc:creator>
		<pubDate>Thu, 17 Oct 2019 23:34:35 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[linux command]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[wget]]></category>
		<guid isPermaLink="false">https://www.osradar.com/?p=14538</guid>

					<description><![CDATA[<p>Downloading files from the Internet is something quite common and normal in the daily use of a computer. People who use their computer in a basic way, download these files using a graphical interface. Usually, this graphical interface is within the same browser. And other users a little more experienced, use download managers but always [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/the-wget-command/">The wget 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>Downloading files from the Internet is something quite common and normal in the daily use of a computer. People who use their computer in a basic way, download these files using a graphical interface. Usually, this graphical interface is within the same browser. And other users a little more experienced, use download managers but always with a graphical interface. But if we use a server, how can we do it? Or if we like to use the terminal, we could download a file through the terminal? the answer is yes. That is why we will explain <strong>the wget command</strong> to you.</p>
<p><a href="https://www.gnu.org" target="_blank" rel="noopener noreferrer">GNU</a> wget is a CLI (command-line interface) utility that allows you to download files from the internet if you know its link. It is very efficient in the management of computer resources because it is practically unnoticeable its use. In addition, this allows you to rename the downloaded files quickly.</p>
<p>On the other hand, although it is a program that is used in the terminal, it is quite complete. Here is a list of the main features of the application:</p>
<ul>
<li>Wget supports downloads through proxies</li>
<li>IPv6 is fully supported by wget.</li>
<li>It allows limiting the bandwidth used for downloads.</li>
<li>Wget works with SSL/TSL to secure downloads.</li>
</ul>
<p>Finally, wget is available for many UNIX systems but also for <a href="https://www.osradar.com/tag/windows/" target="_blank" rel="noopener noreferrer">Windows</a>. And obviously being developed by GNU, we are talking about an open-source application.</p>
<h2>Using the Wget Command</h2>
<p>Now we will explain its basic use. Certainly, <strong>wget is very simple to use</strong>. The first thing we need to know is that almost all Linux distributions have it installed by default. But if not, just invoke the package manager of your distribution and install it. I assure you that it will be in the official repositories.</p>
<p>The most basic way to use the command is as follows:</p>
<pre>:~$ wget [file_link]</pre>
<p>This will download the file in the directory where we are.</p>
<p>A huge advantage of wget is that we will be able to download multiple files whose links are in a text file. For example:</p>
<pre>:~$ nano files.txt</pre>
<pre>https://osradar.com/file1.zip

https://osradar.com/file2.tar

https://osradar.com/file3.mp3</pre>
<p>And to make wget able to <strong>download them all simultaneously</strong> just add the option -i and indicate the path of the text file with the links. If the file is in the same directory just put the name.</p>
<pre>:~$ wget -i [text_file_path]</pre>
<h2>More options to use the Wget command</h2>
<p>The option -c it is quite useful. If for any reason the download is interrupted we will be able <strong>to restart it in the size where it has remained</strong>. For example, if we download a 100Mb file and when we had 80Mb downloaded the download is interrupted, we don&#8217;t have to download everything again just run the command again.</p>
<pre>:~$ wget -c [Link]</pre>
<p>As I said before, wget can limit bandwidth usage. We define this with the &#8211;limit-rate option and assign it a value. For example:</p>
<pre>:~$ wget --limit-rate=700K [link]</pre>
<p>With this, the download will not exceed 700K.</p>
<p>If the download requires a password and a user name, we can also specify it:</p>
<pre>:~$ wget --http-user=[user] --http-password=[password] http://osradar.com/hello.mp4</pre>
<p>Obviously hello.mp4 is an example. There you have to put the link of the file.</p>
<p>By default wget makes 20 attempts to establish the connection and start downloading. If your internet connection is bad, you can increase that number with the -t option.</p>
<pre>:~$ wget -t 60 [link]</pre>
<p>Wget also allows download via FTP with the same syntax as above. If you need a password and user, you can specify it as follows:</p>
<pre>:~$ wget --ftp-user=[user] --ftp-password=[password] ftp://osradar.com/example.tar</pre>
<p>Finally it is possible that wget works in the background. For this there is the option -b.</p>
<pre>:~$ wget -b [link]</pre>
<p>It is useful to download big files. It should be noted that all the options mentioned in the post can be used together.</p>
<p>And that is it.</p>
<h2>Conclusion</h2>
<p>Using servers requires knowledge of many different commands. Today you have learned how to use in a basic way the wget command that will allow you to download files to a computer using the terminal. It is also useful if you like to use the terminal or in low resources equipment.</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/the-wget-command/">The wget 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-wget-command/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		<enclosure url="https://osradar.com/file3.mp3" length="0" type="audio/mpeg" />
<enclosure url="http://osradar.com/hello.mp4" length="0" type="video/mp4" />

			</item>
		<item>
		<title>The Linux systemctl command</title>
		<link>https://www.osradar.com/the-linux-systemctl-command/</link>
					<comments>https://www.osradar.com/the-linux-systemctl-command/#respond</comments>
		
		<dc:creator><![CDATA[angeloma]]></dc:creator>
		<pubDate>Thu, 10 Oct 2019 22:08:29 +0000</pubDate>
				<category><![CDATA[Desktop]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[command]]></category>
		<category><![CDATA[linux command]]></category>
		<category><![CDATA[systemctl]]></category>
		<category><![CDATA[systemctl command]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[Tutorial]]></category>
		<guid isPermaLink="false">https://www.osradar.com/?p=14256</guid>

					<description><![CDATA[<p>In many of our tutorials we have to manage services but what are these services? How are they handled? Well, basically they can be handled with the systemctl command. And in this post, I will teach you how to use the Linux systemctl command. At least so that you can manage the computer services in [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/the-linux-systemctl-command/">The Linux systemctl 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>In many of our tutorials we have to manage services but what are these services? How are they handled? Well, basically they can be handled with the systemctl command. And in this post, I will teach you how to use the Linux systemctl command. At least so that you can manage the computer services in a fast and basic way.</p>
<h2>What is a system service?</h2>
<p>A system service is usually an application that runs in the background. That is to say that it is not necessary that they have a constant interaction with the user to be able to work. This concept is vital to any modern operating system. Some of the most essential applications of a server are managed as services, for example, <a href="https://www.osradar.com/termius-is-a-powefull-ssh-client/" target="_blank" rel="noopener noreferrer">SSH</a> or <a href="https://osradar.com/tag/mysql/" target="_blank" rel="noopener noreferrer">MySQL</a>.</p>
<p>Well, services are handled in Linux with a command that is systemctl. This is because, since recent versions of the kernel and the main current Linux distributions, Systemd is in charge of managing the services.</p>
<p>So we will see how to use the Linux systemctl command.</p>
<h2>The Linux systemctl command</h2>
<p>Within our Linux system, the main function of the systemctl command is to administer the system services. Or those applications that are managed as a service.</p>
<p>First, it is a command that requires root privileges to function. This means that either we enable sudo for our user or we will have to be the root user.</p>
<p><a href="https://www.osradar.com/how-to-enable-sudo-on-debian-10/" target="_blank" rel="noopener noreferrer">How to enable sudo on Debian 10?</a></p>
<p>How to enable sudo on CentOS 8?</p>
<p>Now, we will be able to list all the services that are in our system, for it uses the following command</p>
<pre>:~# systemctl -t list-unit-files --all</pre>
<p>It is also useful to list all active services. To do this, just use:</p>
<pre>:~# systemctl list-unit</pre>
<p>Once we know what the services are, we can work with them.</p>
<p>To start a service that is stopped the syntax is as follows:</p>
<pre>:~# systemctl start [service_name]</pre>
<p>For example:</p>
<pre>:~# systemctl start apache2</pre>
<p>To stop it:</p>
<pre>:~# systemctl stop [service_name]</pre>
<p>Sometimes we make changes to the service and for them to take effect it is necessary to restart it. To do this, we use the following command:</p>
<pre>~# systemctl restart [service_name]</pre>
<p>However, many of these changes are at the configuration level. In this case, the service has to be recharged.</p>
<pre>:~# systemctl reload [service_name]</pre>
<p>It is also possible to restart a service that is currently running:</p>
<pre>:~# systemctl condrestart [service_name]</pre>
<p>And if you want to know the status of a service:</p>
<pre>:~# systemctl status [service_name]</pre>
<p>This function is quite interesting about the status of the service. Because we will be able to have in detail if a service is running or not. And if at the moment of initiating it gives an error, also with this command we will be able to make the pursuit of him.</p>
<p>If you want a service to run automatically with the system, you can do it with the following command:</p>
<pre>:~# systemctl enable [service_name]</pre>
<p>If you no longer wish it to be so, reverse it with this other command:</p>
<pre>:~# systemctl disable [service_name]</pre>
<p>And that is it. I hope this little guide can help you with systemctl.</p>
<h2>Conclusion</h2>
<p>Using and managing the system&#8217;s services on Linux is not a completely simple task, but it is not as difficult as we think. In this sense, systemctl is a relatively simple command that will help us with the management of them.</p>
<p>Please share this post, with your friends and join <a href="https://t.me/osradar" target="_blank" rel="noopener noreferrer">our Telegram channel</a>.</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/the-linux-systemctl-command/">The Linux systemctl 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-systemctl-command/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>The Linux uptime command</title>
		<link>https://www.osradar.com/the-linux-uptime-command/</link>
					<comments>https://www.osradar.com/the-linux-uptime-command/#respond</comments>
		
		<dc:creator><![CDATA[angeloma]]></dc:creator>
		<pubDate>Tue, 21 May 2019 00:22:46 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[linux command]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[unix]]></category>
		<guid isPermaLink="false">https://www.osradar.com/?p=12185</guid>

					<description><![CDATA[<p>The Linux terminal is one of the most versatile tools in the operating system. Many professionals use it every day to manage servers or work with networks and other things. In other words, it is a tool for all professions. That is why, in this opportunity, I will teach you a basic command, a very [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/the-linux-uptime-command/">The Linux uptime 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>The Linux terminal is one of the most versatile tools in the operating system. Many professionals use it every day to manage servers or work with networks and other things. In other words, it is a tool for all professions. That is why, in this opportunity, I will teach you a basic command, a very simple one to learn that can be very profitable. In this post, I will introduce you to the Linux uptime <a href="https://www.osradar.com/tag/linux-command/" target="_blank" rel="noopener noreferrer">command</a>.</p>
<h2>Basic usage of the Linux uptime command</h2>
<p>The uptime command is one of the most basic of all <a href="https://www.osradar.com/tag/terminal/" target="_blank" rel="noopener noreferrer">Linux</a> shells. It is a command that allows you to know how long the system has been running.</p>
<p>Thanks to this command we will be able to program system restarts based on the time the system has been running. Personally, I use it for that. Also, to know when a workstation corresponds to a reboot.</p>
<p>Also, uptime gives a one line display of the following information. The current time, how long the system has been running, how many users are currently logged on, and the system load averages for the past 1, 5, and 15 minutes.</p>
<p>So, if you use the uptime command like this without any parameters, you will get the following.</p>
<pre>:~$ uptime
16:55:12 up  1:41,  1 user,  load average: 1,62, 1,19, 1,04</pre>
<p>Now, I will explain briefly what the output obtained means:</p>
<ul>
<li><strong>16:55:12 -&gt; </strong>This is the local time of the computer where we are running the command.</li>
<li><strong>up 1:41 -&gt; </strong>This is the amount of time the system has been running. In my case, it is about 2 hours.</li>
<li><strong>1 user </strong>is active.</li>
<li><strong>Load Average -&gt; </strong>Displays last minute system load, last 5 minutes and last 15 minutes. This is taken based on the average of processes waiting to do disk I/O tasks. The lower the value, the more inactive the system has been.</li>
</ul>
<p>On the other hand, the Linux uptime command has few options. If you want to display the information in a more readable format, use the -p option.</p>
<pre>:~$ uptime -p
up 2 hours, 12 minutes</pre>
<p>Or use the -s option to only show from when the system is active.</p>
<pre>:~$ uptime -s
2019-05-17 15:13:47</pre>
<p>If you want more information about the command, you can use the -h option.</p>
<pre>:~$ uptime -h</pre>
<p>So, that is it.</p>
<h2>Conclusion</h2>
<p>The uptime command is one of those commands quite easy to use but that can be useful in many cases. This way you will improve your use of the terminal and you can use that information in a bash script.</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/the-linux-uptime-command/">The Linux uptime 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-uptime-command/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Run Command as Other Users on Linux</title>
		<link>https://www.osradar.com/run-command-as-other-users-on-linux/</link>
					<comments>https://www.osradar.com/run-command-as-other-users-on-linux/#respond</comments>
		
		<dc:creator><![CDATA[osradar_editor]]></dc:creator>
		<pubDate>Tue, 11 Dec 2018 09:54:30 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[linux command]]></category>
		<category><![CDATA[run command]]></category>
		<category><![CDATA[run linux command as other user]]></category>
		<guid isPermaLink="false">https://www.osradar.com/?p=8269</guid>

					<description><![CDATA[<p>In Linux, there are a number of situations where running a certain command as another user is necessary. It’s especially true in the professional/enterprise environment where there are a number of users. This method is also useful if one user doesn’t have any particular shells. Running command For performing the action, you have to follow [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/run-command-as-other-users-on-linux/">Run Command as Other Users on Linux</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>In Linux, there are a number of situations where running a certain command as another user is necessary. It’s especially true in the professional/enterprise environment where there are a number of users. This method is also useful if one user doesn’t have any particular shells.</p>
<h1>Running command</h1>
<p>For performing the action, you have to follow the following structure –</p>
<pre class="">su -s &lt;shell_path&gt; &lt;user_name&gt; -c &lt;command&gt;</pre>
<p>For example, I have Apache installed and there’s a PHP file at the location “/var/www/html”. In order to run the file as user “viktor”, the following command will be necessary –</p>
<pre class="">su -s /bin/sh viktor -c "/usr/bin/php /var/www/html/php_demo.php"</pre>
<p><img loading="lazy" class="size-full wp-image-8273 aligncenter" src="https://www.osradar.com/wp-content/uploads/2018/12/user-1.png" alt="" width="1051" height="264" srcset="https://www.osradar.com/wp-content/uploads/2018/12/user-1.png 1051w, https://www.osradar.com/wp-content/uploads/2018/12/user-1-300x75.png 300w, https://www.osradar.com/wp-content/uploads/2018/12/user-1-768x193.png 768w, https://www.osradar.com/wp-content/uploads/2018/12/user-1-1024x257.png 1024w" sizes="(max-width: 1051px) 100vw, 1051px" /></p>
<p>Enjoy!</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/run-command-as-other-users-on-linux/">Run Command as Other Users on Linux</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/run-command-as-other-users-on-linux/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>lsof Command on Linux</title>
		<link>https://www.osradar.com/lsof-command-on-linux/</link>
					<comments>https://www.osradar.com/lsof-command-on-linux/#respond</comments>
		
		<dc:creator><![CDATA[osradar_editor]]></dc:creator>
		<pubDate>Fri, 30 Nov 2018 17:15:35 +0000</pubDate>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[linux command]]></category>
		<category><![CDATA[linux command tutorial]]></category>
		<category><![CDATA[lsof]]></category>
		<guid isPermaLink="false">https://www.osradar.com/?p=7853</guid>

					<description><![CDATA[<p>Linux is one of the most powerful platforms that offer the utmost control over your system. It comes up with a number of pre-installed tools that can be of tremendous power. “lsof” is such a command that’s available on almost all the UNIX/Linux systems. “lsof” stands for “list open files”. Using this tool, you can [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/lsof-command-on-linux/">lsof Command on Linux</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Linux is one of the most powerful platforms that offer the utmost control over your system. It comes up with a number of pre-installed tools that can be of tremendous power. “lsof” is such a command that’s available on almost all the UNIX/Linux systems.</p>
<p>“lsof” stands for “list open files”. Using this tool, you can identify what files are being used by which process/program. In the UNIX/Linux environment, every single thing is a file (pipes, directories, devices, sockets etc.). So, having a good knowledge of “lsof” can provide you with useful info in lots of scenarios.</p>
<p>Let’s check out some of the use cases of “lsof”.</p>
<h1>“lsof” usage</h1>
<p>The basic usage is listing all the open files that belong to all the active processes –</p>
<pre class="">sudo lsof</pre>
<p><img loading="lazy" class="size-full wp-image-7854 aligncenter" src="https://www.osradar.com/wp-content/uploads/2018/11/lsof-1.png" alt="" width="1060" height="734" srcset="https://www.osradar.com/wp-content/uploads/2018/11/lsof-1.png 1060w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-1-300x208.png 300w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-1-768x532.png 768w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-1-1024x709.png 1024w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-1-100x70.png 100w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-1-218x150.png 218w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-1-607x420.png 607w" sizes="(max-width: 1060px) 100vw, 1060px" /></p>
<p><img loading="lazy" class="size-full wp-image-7855 aligncenter" src="https://www.osradar.com/wp-content/uploads/2018/11/lsof-2.png" alt="" width="1060" height="734" srcset="https://www.osradar.com/wp-content/uploads/2018/11/lsof-2.png 1060w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-2-300x208.png 300w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-2-768x532.png 768w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-2-1024x709.png 1024w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-2-100x70.png 100w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-2-218x150.png 218w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-2-607x420.png 607w" sizes="(max-width: 1060px) 100vw, 1060px" /></p>
<p>The purpose of using “sudo” is to list ALL the files that are actively being used. Otherwise, it may not properly identify all the files.</p>
<p>You can also check if a specific file is being used.</p>
<pre class="">sudo lsof &lt;file_name&gt;</pre>
<p>&nbsp;</p>
<p><img loading="lazy" class="size-full wp-image-7856 aligncenter" src="https://www.osradar.com/wp-content/uploads/2018/11/lsof-3.png" alt="" width="1060" height="734" srcset="https://www.osradar.com/wp-content/uploads/2018/11/lsof-3.png 1060w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-3-300x208.png 300w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-3-768x532.png 768w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-3-1024x709.png 1024w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-3-100x70.png 100w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-3-218x150.png 218w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-3-607x420.png 607w" sizes="(max-width: 1060px) 100vw, 1060px" /></p>
<p>Suppose, you need to identify what processes are accessing the file(s) of a certain directory.</p>
<pre class="">lsof +D &lt;directory_path&gt;

lsof +d &lt;directory_path&gt;</pre>
<p><img loading="lazy" class="size-full wp-image-7857 aligncenter" src="https://www.osradar.com/wp-content/uploads/2018/11/lsof-4.png" alt="" width="1060" height="734" srcset="https://www.osradar.com/wp-content/uploads/2018/11/lsof-4.png 1060w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-4-300x208.png 300w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-4-768x532.png 768w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-4-1024x709.png 1024w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-4-100x70.png 100w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-4-218x150.png 218w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-4-607x420.png 607w" sizes="(max-width: 1060px) 100vw, 1060px" /> <img loading="lazy" class="size-full wp-image-7858 aligncenter" src="https://www.osradar.com/wp-content/uploads/2018/11/lsof-5.png" alt="" width="1060" height="734" srcset="https://www.osradar.com/wp-content/uploads/2018/11/lsof-5.png 1060w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-5-300x208.png 300w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-5-768x532.png 768w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-5-1024x709.png 1024w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-5-100x70.png 100w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-5-218x150.png 218w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-5-607x420.png 607w" sizes="(max-width: 1060px) 100vw, 1060px" /></p>
<p>Here, “+D” indicates to include the subdirectories within the directory. If you don’t want to include them, then use “+d”.</p>
<p>Need to find out the file(s) a certain process is accessing? Then use the “-c” flag. The command structure will be –</p>
<pre class="">lsof -c &lt;process_name&gt; -c &lt;process_name&gt;</pre>
<p><img loading="lazy" class="size-full wp-image-7859 aligncenter" src="https://www.osradar.com/wp-content/uploads/2018/11/lsof-6.png" alt="" width="1060" height="475" srcset="https://www.osradar.com/wp-content/uploads/2018/11/lsof-6.png 1060w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-6-300x134.png 300w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-6-768x344.png 768w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-6-1024x459.png 1024w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-6-937x420.png 937w" sizes="(max-width: 1060px) 100vw, 1060px" /></p>
<p>“lsof” is capable of handling multiple “-c” flags.</p>
<p>You can also list the processes that are using a certain mount point. For this purpose, the following structure must be followed –</p>
<pre class="">lsof &lt;mount_point&gt;</pre>
<p><img loading="lazy" class="size-full wp-image-7860 aligncenter" src="https://www.osradar.com/wp-content/uploads/2018/11/lsof-7.png" alt="" width="1060" height="734" srcset="https://www.osradar.com/wp-content/uploads/2018/11/lsof-7.png 1060w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-7-300x208.png 300w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-7-768x532.png 768w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-7-1024x709.png 1024w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-7-100x70.png 100w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-7-218x150.png 218w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-7-607x420.png 607w" sizes="(max-width: 1060px) 100vw, 1060px" /></p>
<p>Not all the processes in your system run under a certain user. For example, “root”, “&lt;account_username&gt;” etc. You can also tell “lsof” to show the files that are being used as a certain user permission.</p>
<pre class="">lsof -u &lt;username&gt;</pre>
<p><img loading="lazy" class="size-full wp-image-7861 aligncenter" src="https://www.osradar.com/wp-content/uploads/2018/11/lsof-8.png" alt="" width="1060" height="734" srcset="https://www.osradar.com/wp-content/uploads/2018/11/lsof-8.png 1060w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-8-300x208.png 300w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-8-768x532.png 768w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-8-1024x709.png 1024w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-8-100x70.png 100w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-8-218x150.png 218w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-8-607x420.png 607w" sizes="(max-width: 1060px) 100vw, 1060px" /></p>
<p>From the above example, need to exclude a certain user? Then you have to use “^” flag.</p>
<pre class="">lsof -u ^&lt;username&gt;</pre>
<p><img loading="lazy" class="size-full wp-image-7862 aligncenter" src="https://www.osradar.com/wp-content/uploads/2018/11/lsof-9.png" alt="" width="1060" height="734" srcset="https://www.osradar.com/wp-content/uploads/2018/11/lsof-9.png 1060w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-9-300x208.png 300w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-9-768x532.png 768w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-9-1024x709.png 1024w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-9-100x70.png 100w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-9-218x150.png 218w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-9-607x420.png 607w" sizes="(max-width: 1060px) 100vw, 1060px" /></p>
<p>It’s also possible to list all the files a certain process is accessing. Use the “-p” flag in this case. Note that as the value for the flag “-p”, you need to provide the PID of that process</p>
<pre class="">lsof -p &lt;PID&gt;</pre>
<p>&nbsp;</p>
<p>List all the network connections –</p>
<pre>lsof -i</pre>
<p><img loading="lazy" class="size-full wp-image-7863 aligncenter" src="https://www.osradar.com/wp-content/uploads/2018/11/lsof-10.png" alt="" width="1060" height="734" srcset="https://www.osradar.com/wp-content/uploads/2018/11/lsof-10.png 1060w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-10-300x208.png 300w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-10-768x532.png 768w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-10-1024x709.png 1024w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-10-100x70.png 100w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-10-218x150.png 218w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-10-607x420.png 607w" sizes="(max-width: 1060px) 100vw, 1060px" /></p>
<p>Another interesting ability of &#8220;lsof&#8221; is listing all the processes that are listening to a specific port. For example, you want to find out what processes are using the 25 port.</p>
<pre class="">lsof -i TCP:25</pre>
<p>Need to scan a range of port, say, 1-25? Then the command structure will be the following one &#8211;</p>
<pre class="">lsof -i TCP:1-25</pre>
<p>You can also filter your result by IPv4 and IPv6.</p>
<pre class=""># IPv4

lsof -i 4

# IPv6

lsof -i 6</pre>
<p><img loading="lazy" class="size-full wp-image-7883 aligncenter" src="https://www.osradar.com/wp-content/uploads/2018/11/lsof-0.png" alt="" width="1060" height="734" srcset="https://www.osradar.com/wp-content/uploads/2018/11/lsof-0.png 1060w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-0-300x208.png 300w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-0-768x532.png 768w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-0-1024x709.png 1024w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-0-100x70.png 100w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-0-218x150.png 218w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-0-607x420.png 607w" sizes="(max-width: 1060px) 100vw, 1060px" /> <img loading="lazy" class="size-full wp-image-7884 aligncenter" src="https://www.osradar.com/wp-content/uploads/2018/11/lsof-00.png" alt="" width="1058" height="236" srcset="https://www.osradar.com/wp-content/uploads/2018/11/lsof-00.png 1058w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-00-300x67.png 300w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-00-768x171.png 768w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-00-1024x228.png 1024w" sizes="(max-width: 1058px) 100vw, 1058px" /></p>
<p>Need to find out all the available options of “lsof”? You can get the help of the man page.</p>
<pre class="">man lsof</pre>
<p><img loading="lazy" class="alignnone size-full wp-image-7864" src="https://www.osradar.com/wp-content/uploads/2018/11/lsof-11.png" alt="" width="1060" height="734" srcset="https://www.osradar.com/wp-content/uploads/2018/11/lsof-11.png 1060w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-11-300x208.png 300w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-11-768x532.png 768w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-11-1024x709.png 1024w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-11-100x70.png 100w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-11-218x150.png 218w, https://www.osradar.com/wp-content/uploads/2018/11/lsof-11-607x420.png 607w" sizes="(max-width: 1060px) 100vw, 1060px" /></p>
<p>You can also export the man page for future usage. <a href="https://www.osradar.com/export-linux-command-outputs-to-a-file/">Learn how to export Linux command output to a text file</a>.</p>
<p>Enjoy!</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/lsof-command-on-linux/">lsof Command on Linux</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/lsof-command-on-linux/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
