tag:blogger.com,1999:blog-39500730894265069792024-03-18T19:35:16.086+02:00Sameh AttiaSameh Attiahttp://www.blogger.com/profile/06829656663776752624noreply@blogger.comBlogger2327125tag:blogger.com,1999:blog-3950073089426506979.post-28257549938579065422021-10-12T00:54:00.001+02:002021-10-12T00:54:33.694+02:0013 Linux Terminal Shortcuts Every Power Linux User Must Know<p> https://linuxhandbook.com/linux-shortcuts</p><p> <br /></p><div class="page__excerpt m-t text-acc-3 text-center text-lg">Use
Linux command line like a pro by mastering these Linux terminal
shortcuts and increase your productivity. It's a must for any power
Linux user.</div>
<div class="row">
<div class="col-xs-12 col-lg-3">
<div class="post-toc border-1 js-post-toc is-aside is-active">
<div class="post-toc__header flex items-center">
<span class="m-r flex-1">Table of Contents</span>
</div></div></div></div><div class="col-xs-12 col-lg-3"><div class="post-toc border-1 js-post-toc is-aside is-active">
</div>
</div>
<article class="post tag-tips content-wrap post-access-public post-with-sidebar">
<div class="content js-toc-content">
<p>You know what sets apart a pro user from a regular user? Mastery over the keyboard shortcuts.</p><p>Alright! That’s not the only thing but it is undoubtedly a factor.</p><p>Shortcuts
help you to be more productive and efficient with whatever tool you
use. Just think about it. If someone holds the mouse all the way down to
copy entire text instead of Ctrl+A, how would you feel about it?</p><p>Linux terminal is not an exception. There are certain Linux terminal shortcuts that every user must know and practice.</p><p>Trust me; once you master these shortcuts, you’ll notice how good you are with using the Linux command line.</p><h2 id="must-know-linux-shortcuts">Must Know Linux Shortcuts</h2><figure class="kg-card kg-image-card"><a aria-label="Click for Lightbox" data-fslightbox="" data-no-swup="" href="https://linuxhandbook.com/content/images/2020/07/linux-terminal-shortcuts-1.jpeg"><img alt="Linux Terminal Shortcuts" class="kg-image" height="450" src="https://linuxhandbook.com/content/images/2020/07/linux-terminal-shortcuts-1.jpeg" width="800" /></a></figure><p>I would like to mention that some of these shortcuts may depend upon the Shell you are using. <a href="https://www.gnu.org/software/bash/manual/html_node/What-is-Bash_003f.html" rel="noreferrer noopener" target="_blank">Bash</a> is the most popular shell, so the list is focused on Bash. If you want, you may call it Bash shortcut list as well.</p><div class="alert">
Do note that I have used the capital letters in the keyboard shortcuts
but this does NOT mean that you have to press the shift key while using
these shortcuts.
</div><h3 id="1-tab">1. Tab</h3><p>This is the Linux shortcut you cannot live without. It will save you so much time in the Linux command line.</p><p>Just
start typing a command, filename, directory name or even command
options and hit the tab key. It will either automatically complete what
you were typing or it will show all the possible results for you.</p><p>If you could only remember one shortcut, this would be the chosen one.</p><h3 id="2-ctrl-c">2. Ctrl + C</h3><p>These
are the keys you should press in order to break out of a command or
process on a terminal. This will stop a running program immediately.</p><p>If you want to stop using a program running in the foreground, just press this key combination.</p><h3 id="3-ctrl-z">3. Ctrl + Z</h3><p>This
shortcut will send a running program in the background. Normally, you
can achieve this before running the program using the & option but
if you forgot to do that, use this key combination.</p><h3 id="4-ctrl-d">4. Ctrl + D</h3><p>This keyboard shortcut will log you out of the current terminal. If you are using an <a href="https://www.ssh.com/ssh/protocol/" rel="noreferrer noopener" target="_blank">SSH</a> connection, it will be closed. If you are using a terminal directly, the application will be closed immediately.</p><p>Consider it equivalent to the ‘exit’ command.</p><h3 id="5-ctrl-l">5. Ctrl + L</h3><p>How do you clear your terminal screen? I guess using the clear command.</p><p>Instead of writing C-L-E-A-R, you can simply use Ctrl+L to clear the terminal. Handy, isn’t it?</p><h3 id="6-ctrl-a">6. Ctrl + A</h3><p>This shortcut will move the cursor to the beginning of the line.</p><p>Suppose
you typed a long command or path in the terminal and you want to go to
the beginning of it, using the arrow key to move the cursor will take
plenty of time. Do note that you cannot use the mouse to move the cursor
to the beginning of the line.</p><p>This is where Ctrl+A saves the day.</p><h3 id="7-ctrl-e">7. Ctrl + E</h3><p>This
shortcut is sort of opposite to Ctrl+A. Ctrl+A sends the cursor to the
beginning of the line whereas Ctrl+E moves the cursor to the end of the
line.</p><p>Note: If you have the Home and End keys on your keyboard,
you can also use them. Home is equivalent to Ctrl +A and End is
equivalent to Ctrl + E.</p><h3 id="8-ctrl-u">8. Ctrl + U</h3><p>Typed a
wrong command? Instead of using the backspace to discard the current
command, use Ctrl+U shortcut in the Linux terminal. This shortcut erases
everything from the current cursor position to the beginning of the
line.</p><h3 id="9-ctrl-k">9. Ctrl + K</h3><p>This one is similar to the
Ctrl+U shortcut. The only difference is that instead of the beginning
of the line, it erases everything from the current cursor position to
the end of the line.</p><h3 id="10-ctrl-w">10. Ctrl + W</h3><p>You just
learned about erasing text till the beginning and the end of the line.
But what if you just need to delete a single word? Use the Ctrl+W
shortcut.</p><p>Using Ctrl+W shortcut, you can erase the word preceding
to the cursor position. If the cursor is on a word itself, it will erase
all letters from the cursor position to the beginning of the word.</p><p>The best way to use it to move the cursor to the next space after the targetted word and then use the Ctrl+W keyboard shortcut.</p><h3 id="11-ctrl-y">11. Ctrl + Y</h3><p>This
will paste the erased text that you saw with Ctrl + W, Ctrl + U and
Ctrl + K shortcuts. Comes handy in case you erased wrong text or if you
need to use the erased text someplace else.</p><h3 id="12-ctrl-p">12. Ctrl + P</h3><p>You
can use this shortcut to view the previous command. You can press it
repeatedly to keep on going back in the command history. In a lot of
terminals, the same can be achieved with PgUp key.</p><h3 id="13-ctrl-n">13. Ctrl + N</h3><p>You
can use this shortcut in conjugation with Ctrl+P. Ctrl+N displays the
next command. If you are viewing previous commands with Ctrl+P, you can
use Ctrl+N to navigate back and forth. Many terminals have this shortcut
mapped to the PgDn key.</p><h3 id="bonus-shortcut-ctrl-r-to-search-in-command-history">Bonus shortcut: Ctrl + R to search in command history</h3><p>You typed some command but cannot remember what it was exactly? Meet Ctrl + R.</p><p>This keyboard shortcut allows you to perform a search in your <a href="https://linuxhandbook.com/history-command/">command history</a>.
Just press Ctrl+R and start typing. It will show the last command that
matches the string you typed. Note that the typed string could be
anywhere in the command. How cool is that?</p><figure class="kg-card kg-image-card"><a aria-label="Click for Lightbox" data-fslightbox="" data-no-swup="" href="https://linuxhandbook.com/content/images/2021/08/reverse-search-linux.png"><img alt="Reverse search in command history in Linux" class="kg-image" height="276" src="https://linuxhandbook.com/content/images/2021/08/reverse-search-linux.png" width="834" /></a></figure><p>If you want to see more commands for the same string, just keep pressing Ctrl + R.</p><p>You can press enter to run the command selected or press Esc to come out of the search with the last search result.</p><p>Try it and be amazed.</p><h2 id="what-s-your-favorite-linux-terminal-shortcut">What’s your favorite Linux terminal shortcut?</h2><p>If you would like to learn a few more Linux terminal tricks, you may watch this video to unearth hidden command line gems:</p><figure class="kg-card kg-embed-card"></figure><p>I
have shared my favorite terminal shortcuts. What are some of your
favorite Linux shortcuts? If you have one (or more), why not share it
with the rest of us in the comment section?</p>
</div>
</article>Sameh Attiahttp://www.blogger.com/profile/06829656663776752624noreply@blogger.com0tag:blogger.com,1999:blog-3950073089426506979.post-45002696556379915002021-10-12T00:39:00.000+02:002021-10-12T00:39:14.690+02:00SSLH – Share A Same Port For HTTPS And SSH<p> https://ostechnix.com/sslh-share-port-https-ssh</p><p> In this brief tutorial, we will see what is SSLH, how to install SSLH
and how to configure SSLH to share a same port for https, and ssh in
Linux and Unix-like operating systems.</p> <h2 class="ftwp-heading" id="what-is-sslh">What is SSLH?</h2> <p>Some
Internet service providers and corporate companies might have blocked
most of the ports, and allowed only a few specific ports such as port 80
and 443 to tighten their security.</p> <div><div class="penci-custom-html-inside-content"> <ins class="adsbygoogle" data-ad-client="ca-pub-6701402139964678" data-ad-format="auto" data-ad-slot="6620160421" data-ad-status="filled" data-adsbygoogle-status="done" data-full-width-responsive="true" style="display: block; height: 280px;"><ins aria-label="Advertisement" id="aswift_1_expand" style="background-color: transparent; border: medium none; display: inline-table; height: 280px; margin: 0px; padding: 0px; position: relative; visibility: visible; width: 780px;" tabindex="0" title="Advertisement"><ins id="aswift_1_anchor" style="background-color: transparent; border: medium none; display: block; height: 280px; margin: 0px; overflow: visible; padding: 0px; position: relative; visibility: visible; width: 780px;"></ins></ins></ins> </div></div><p>In such cases, we have no choice, but use a same port for multiple programs, say the HTTPS Port <strong>443</strong>, which is rarely blocked. Here is where <strong>SSLH</strong>, a SSL/SSH multiplexer, comes in help.</p> <p>SSLH
will listen for incoming connections on a port 443. To put this more
simply, SSLH allows us to run several programs or services on port 443
on a Linux system. So, you can use both SSL and SSH using a same port at
the same time.</p> <p>If you ever been in a situation where most ports are blocked by the firewalls, you can use SSLH to access your remote server.</p> <h2 class="ftwp-heading" id="install-sslh-in-linux">Install SSLH in Linux</h2> <p>SSLH is packaged for most Linux distributions, so you can install it using the default package managers.</p> <p>On <strong>Debian</strong>, <strong>Ubuntu</strong>, <strong>Linux Mint</strong> and <strong>Pop OS</strong>, run:</p> <pre class="wp-block-preformatted">$ sudo apt install sslh</pre> <p>While installing SSLH, you will prompted whether you want to run sslh as a service from inetd, or as a standalone server.</p> <p>Each
choice has its own benefits. With only a few connection per day, it is
probably better to run sslh from inetd in order to save resources.</p><div class="google-auto-placed ap_container" style="clear: both; height: auto; text-align: center; width: 100%;"><ins class="adsbygoogle adsbygoogle-noablate" data-ad-client="ca-pub-6701402139964678" data-ad-format="auto" data-ad-status="filled" data-adsbygoogle-status="done" style="background-color: transparent; display: block; height: 280px; margin: auto;"><ins aria-label="Advertisement" id="aswift_5_expand" style="background-color: transparent; border: medium none; display: inline-table; height: 280px; margin: 0px; padding: 0px; position: relative; visibility: visible; width: 780px;" tabindex="0" title="Advertisement"><ins id="aswift_5_anchor" style="background-color: transparent; border: medium none; display: block; height: 280px; margin: 0px; overflow: visible; padding: 0px; position: relative; visibility: visible; width: 780px;"></ins></ins></ins></div> <p>On
the other hand, with many connections, sslh should run as a standalone
server to avoid spawning a new process for each incoming connection.</p> <div class="wp-block-image is-style-default"><figure class="aligncenter size-full"><a data-rel="penci-gallery-image-content" href="https://ostechnix.com/wp-content/uploads/2017/08/install-sslh.png"><img alt="install sslh" class="wp-image-19444 lazyloaded" data-ll-status="loaded" height="520" src="https://ostechnix.com/wp-content/uploads/2017/08/install-sslh.png" title="install sslh" width="799" /></a><figcaption>Install sslh</figcaption></figure></div> <p>On <strong>Arch Linux</strong> and derivatives like Antergos, Manjaro Linux, install it using Pacman as shown below.</p> <pre class="wp-block-preformatted">$ sudo pacman -S sslh</pre> <p>On <strong>RHEL</strong>, <strong>CentOS</strong>, <strong>AlmaLinux</strong> and <strong>Rocky Linux</strong>, you need to add <strong>EPEL</strong> repository and then install SSLH as shown below.</p> <pre class="wp-block-preformatted">$ sudo dnf install epel-release</pre> <pre class="wp-block-preformatted">$ sudo dnf install sslh</pre> <p>On <strong>Fedora</strong>:</p> <pre class="wp-block-preformatted">$ sudo dnf install sslh</pre> <p>If it is not available on default repositories, you can manually compile and install SSLH as described <a href="https://github.com/yrutschle/sslh/blob/master/doc/INSTALL.md" rel="noopener noreferrer" target="_blank"><strong>here</strong></a>.</p> <h2 class="ftwp-heading" id="configure-apache-or-nginx-webservers">Configure Apache or Nginx webservers</h2> <p>As you already know, Apache and Nginx webservers will listen on all network interfaces (i.e <strong><code>0.0.0.0:443</code></strong>) by default. We need to change this setting to tell the webserver to listen on the localhost interface only (i.e. <strong><code>127.0.0.1:443</code> </strong>or <strong><code>localhost:443</code></strong>).</p> <p>To do so, edit the webserver (nginx or apache) configuration file and find the following line:</p> <pre class="wp-block-preformatted">listen 443 ssl;</pre> <p>And, change it to:</p> <pre class="wp-block-preformatted">listen 127.0.0.1:443 ssl;</pre> <p>If you’re using Virutalhosts in Apache, make sure you have changed that it too.</p> <pre class="wp-block-preformatted">VirtualHost 127.0.0.1:443
</pre> <p>Save and close the config files. Do not restart the services. We haven't finished yet.</p> <h2 class="ftwp-heading" id="configure-sslh">Configure SSLH</h2> <p>Once you have made the webservers to listen on local interface only, edit SSLH config file:</p> <pre class="wp-block-preformatted">$ sudo vi /etc/default/sslh</pre> <p>Find the following line:</p> <pre class="wp-block-preformatted">Run=no</pre> <p>And, change it to:</p> <pre class="wp-block-preformatted">Run=yes</pre> <p>Then,
scroll a little bit down and modify the following line to allow SSLH to
listen on port 443 on all available interfaces (Eg. <code>0.0.0.0:443</code>).</p> <pre class="wp-block-preformatted">DAEMON_OPTS="--user sslh --listen <strong>0.0.0.0:443</strong> --ssh 127.0.0.1:22 --ssl 127.0.0.1:443 --pidfile /var/run/sslh/sslh.pid"</pre> <p>Where,</p> <ul style="height: auto !important;"><li><code>--user sslh</code> : Requires to run under this specified username.</li><li><code>--listen 0.0.0.0:443</code> : SSLH is listening on port <code>443</code> on all available interfaces.</li><div class="google-auto-placed ap_container" style="clear: both; height: auto; text-align: center; width: 100%;"><ins class="adsbygoogle adsbygoogle-noablate" data-ad-client="ca-pub-6701402139964678" data-ad-format="auto" data-ad-status="filled" data-adsbygoogle-status="done" style="background-color: transparent; display: block; height: 280px; margin: auto;"><ins aria-label="Advertisement" id="aswift_6_expand" style="background-color: transparent; border: medium none; display: inline-table; height: 280px; margin: 0px; padding: 0px; position: relative; visibility: visible; width: 780px;" tabindex="0" title="Advertisement"><ins id="aswift_6_anchor" style="background-color: transparent; border: medium none; display: block; height: 280px; margin: 0px; overflow: hidden; padding: 0px; position: relative; visibility: visible; width: 780px;"></ins></ins></ins></div><li><code>--sshs 127.0.0.1:22</code> : Route SSH traffic to port <code>22</code> on the localhost.</li><div class="google-auto-placed ap_container" style="clear: both; height: auto; text-align: center; width: 100%;"><ins class="adsbygoogle adsbygoogle-noablate" data-ad-client="ca-pub-6701402139964678" data-ad-format="auto" data-ad-status="filled" data-adsbygoogle-status="done" style="background-color: transparent; display: block; height: 280px; margin: auto;"><ins aria-label="Advertisement" id="aswift_7_expand" style="background-color: transparent; border: medium none; display: inline-table; height: 280px; margin: 0px; padding: 0px; position: relative; visibility: visible; width: 780px;" tabindex="0" title="Advertisement"><ins id="aswift_7_anchor" style="background-color: transparent; border: medium none; display: block; height: 280px; margin: 0px; overflow: hidden; padding: 0px; position: relative; visibility: visible; width: 780px;"></ins></ins></ins></div><li><code>--ssl 127.0.0.1:443</code> : Route HTTPS/SSL traffic to port <code>443</code> on the localhost.</li></ul> <p>Save and close the file.</p> <p>Finally, enable and start <code>sslh</code> service to update the changes.</p> <pre class="wp-block-preformatted">$ sudo systemctl enable sslh</pre> <pre class="wp-block-preformatted">$ sudo systemctl start sslh</pre> <h3 class="ftwp-heading" id="testing">Testing</h3> <p>Check if the SSLH daemon is listening to <code>443</code>.</p> <pre class="wp-block-preformatted"><strong>$ ps -ef | grep sslh</strong>
sslh 2746 1 0 15:51 ? 00:00:00 /usr/sbin/sslh --foreground --user sslh --listen 0.0.0.0 443 --ssh 127.0.0.1 22 --ssl 127.0.0.1 443 --pidfile /var/run/sslh/sslh.pid
sslh 2747 2746 0 15:51 ? 00:00:00 /usr/sbin/sslh --foreground --user sslh --listen 0.0.0.0 443 --ssh 127.0.0.1 22 --ssl 127.0.0.1 443 --pidfile /var/run/sslh/sslh.pid
sk 2754 1432 0 15:51 pts/0 00:00:00 grep --color=auto sslh</pre> <p>Now, you can access your remote server via SSH using port <code>443</code>:</p> <pre class="wp-block-preformatted">$ ssh -p 443 sk@192.168.225.50</pre> <p><strong>Sample output:</strong></p> <pre class="wp-block-preformatted">sk@192.168.225.50's password:
Welcome to Ubuntu 18.04.2 LTS (GNU/Linux 4.15.0-55-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
System information as of Wed Aug 14 13:11:04 IST 2019
System load: 0.23 Processes: 101
Usage of /: 53.5% of 19.56GB Users logged in: 0
Memory usage: 9% IP address for enp0s3: 192.168.225.50
Swap usage: 0% IP address for enp0s8: 192.168.225.51
* Keen to learn Istio? It's included in the single-package MicroK8s.
https://snapcraft.io/microk8s
61 packages can be updated.
22 updates are security updates.
Last login: Wed Aug 14 13:10:33 2019 from 127.0.0.1</pre> <div class="wp-block-image is-style-default"><figure class="aligncenter size-full"><a data-rel="penci-gallery-image-content" href="https://ostechnix.com/wp-content/uploads/2017/08/Access-remote-systems-via-SSH-using-port-443.png"><img alt="Access remote systems via SSH using port 443" class="wp-image-19445 lazyloaded" data-ll-status="loaded" height="520" src="https://ostechnix.com/wp-content/uploads/2017/08/Access-remote-systems-via-SSH-using-port-443.png" title="Access remote systems via SSH using port 443" width="799" /></a><figcaption>Access remote systems via SSH using port 443</figcaption></figure></div> <p>See? I can now be able to access the remote server via SSH even if the default SSH port <code>22</code> is blocked. As you see in the above example, I have used the https port <code>443</code> for SSH connection. Also, we can use the same port <code>443</code> for openVPN connections too.</p> <p>I
tested SSLH on my Ubuntu 18.04 LTS server and it worked just fine as
described above. I tested SSLH in a protected local area network, so I
am not aware of the security issues. If you're using it in production,
let us know the advantages and disadvantages of using SSLH in the
comment section below.</p><div class="google-auto-placed ap_container" style="clear: both; height: auto; text-align: center; width: 100%;"><ins class="adsbygoogle adsbygoogle-noablate" data-ad-client="ca-pub-6701402139964678" data-ad-format="auto" data-ad-status="filled" data-adsbygoogle-status="done" style="background-color: transparent; display: block; height: 280px; margin: auto;"><ins aria-label="Advertisement" id="aswift_8_expand" style="background-color: transparent; border: medium none; display: inline-table; height: 280px; margin: 0px; padding: 0px; position: relative; visibility: visible; width: 780px;" tabindex="0" title="Advertisement"><ins id="aswift_8_anchor" style="background-color: transparent; border: medium none; display: block; height: 280px; margin: 0px; overflow: visible; padding: 0px; position: relative; visibility: visible; width: 780px;"></ins></ins></ins></div> <p>For more details, check the official GitHub page given below.</p><p> </p>Sameh Attiahttp://www.blogger.com/profile/06829656663776752624noreply@blogger.com0tag:blogger.com,1999:blog-3950073089426506979.post-76770673305058999582021-10-12T00:37:00.000+02:002021-10-12T00:37:21.392+02:00Difference between ext2, ext3 and ext4<p> https://kerneltalks.com/disk-management/difference-between-ext2-ext3-and-ext4</p><p class="has-text-align-center"> <em>List of differences between ext2,
ext3, and ext 4 Linux file systems. One of the Linux interview questions
answered in this article!</em></p><div class="entry-content">
<div class="wp-block-image wp-image-2578 size-full"><figure class="aligncenter size-large"><img alt="" class="wp-image-6288" data-pagespeed-url-hash="3859062102" height="256" src="https://z5.kerneltalks.com/wp-content/uploads/2020/06/ext2-vs-ext3-vs-ext4.png" width="512" /><figcaption>Comparison : ext2 vs ext3 vs ext4</figcaption></figure></div>
<p>This is another <a href="https://kerneltalks.com/category/linux">Linux </a>interview
question. What is the difference between ext2, ext3, and ext4 file
systems? Or Explain Linux file system ext2 vs ext3 vs ext4? In this
article we will walk through these differences and lastly I will present
you all of them in tabular format so that they are easy to quickly read
during your preparations.</p>
<p>Let’s see each file system’s features and lastly their comparison with other file systems.</p>
<h3>EXT2 file system</h3>
<ul><li>It’s a second extended file system that was created to overcome limitations of the EXT file system.</li><li>Introduced in 1993 by Remy Card. It was the first commercial-grade filesystem for Linux</li><li>Does not supports Journaling</li><li>Fit
for SD cards & USB drives since it has high performance and low
writes (as journaling is not available). USB and SD storage are limited
with write cycles hence its best fit for them.</li><li>Limits: Individual file size 16GB to 2TB. File system size 2TB to 32TB.</li></ul>
<blockquote class="wp-block-quote"><p>Limits are calculated based on
block size used. Block size varies from 1KB to 8KB. For example, If
1KB block size is used max file size can go up to 16GB and for 8KB it’s
2TB. Middle range sizes being 2KB and 4KB which has file size limits of
256GB & 2TB (not mentioned in above limits) respectively. The same
applies to the File system size limits defined above.</p></blockquote>
<h3>EXT3 file system</h3>
<ul><li>It’s third extended file system was created to overcome limitations of the EXT2 file system.</li><li>Introduced in 2001 by Stephen Tweedie. It was the most common filesystem in any Linux distro.</li><li>Supports Journaling</li><li>Journaling keeps track of file changes which helps in fast recovery and reduce chances of data loss in case of a system crash</li><li>Limits: Individual file size 16GB to 2TB. File system size 4TB to 32TB.</li><li>Upgrading FS from ext2 to ext3 is an online process without downtime.</li></ul>
<h3>EXT4 file system</h3>
<ul><li>It’s the fourth extended file system that was created to overcome limitations of the EXT3 file system.</li><li>Introduced in 2008 by a team of developers. Its most the latest filesystem in ext family.</li><li>Supports Journaling</li><li>Lots
of new features introduced. Extents, Backward compatibility, Persistent
pre-allocation, Delayed allocation, Unlimited number of subdirectories,
Journal checksum, Faster FS check, Transparent encryption.</li><li>Limits: Individual file size 16GB to 16TB. File system size up to 1EB.</li><li>Upgrading FS not needed. Due to backward compatibility, ext2, ext3 can be directly mounted as ext4.</li></ul>
<p>All above points can be formatted in tabular format as below :</p>
<table class="wp-block-table aligncenter is-style-stripes"><tbody><tr><td><strong>Parameter</strong></td><td><strong>EXT2</strong></td><td><strong>EXT3</strong></td><td><strong>EXT4</strong></td></tr><tr><td> Introduced year<br /><br /> </td><td>1993</td><td>2001</td><td>2008</td></tr><tr><td> Developed by<br /><br /> </td><td> Remy Card </td><td> Stephen Tweedie </td><td> Team of developers </td></tr><tr><td> Journaling </td><td> Not available </td><td> Available </td><td> Available </td></tr><tr><td> Individual file size<br /><br /> </td><td> 16GB to 2TB </td><td> 16GB to 2TB </td><td> 16GB to 16TB </td></tr><tr><td> File system size<br /><br /> </td><td> 2TB to 32TB </td><td> 4TB to 32TB </td><td> up to 1EB </td></tr><tr><td> Upgrade </td><td> Can be done online to EXT3. Can be mounted as EXT4. No upgrade needed </td><td> Can be mounted as EXT4. No upgrade needed </td><td>NA</td></tr></tbody></table>
</div><a href="https://kerneltalks.com/hardware-config/how-to-check-if-linux-server-is-physical-or-vm/" rel="next"></a><p> </p>Sameh Attiahttp://www.blogger.com/profile/06829656663776752624noreply@blogger.com0tag:blogger.com,1999:blog-3950073089426506979.post-66787474265166485972020-01-11T21:48:00.001+02:002020-01-11T21:48:54.976+02:00How to use the screen command on Linux to keep your remote task running when the connection drops<div dir="ltr" style="text-align: left;" trbidi="on">
https://net2.com/how-to-use-the-screen-command-on-linux-to-keep-your-remote-task-running-when-the-connection-drops<br />
<br />
<div class="entry-content clr" itemprop="text">
<span style="color: black;">A
lot of Linux users carry out a long running task on a remote
destination without taking into account the possibility that the
connection might break. In such situations, notwithstanding financial
losses for large and<span id="more-2228"></span> small corporations,
they will lose their work as well as their time since when they try to
reconnect again, the remote task is no longer running.</span><br />
<span style="color: black;">Fortunately,
Linux provides a tool called ‘screen’ which enables these remote
sessions to keep running even when the connection drops. Indeed, when a
given process is started with this utility, i.e. ‘screen’, it can be
detached from the corresponding session and then when the connection is
resumed for instance, the process that was originally started from the
‘screen’ is still running and can rejoin the session at a later time,
.i.e users can pick up where they left off with their last command or
task.</span><br />
<div class="google-auto-placed ap_container" style="clear: none; height: auto; text-align: center; width: 100%;">
<ins class="adsbygoogle adsbygoogle-noablate" data-ad-client="ca-pub-4222719099368092" data-ad-format="auto" data-adsbygoogle-status="done" data-overlap-observer-io="false" style="background-color: transparent; display: block; margin: auto;"><ins id="aswift_2_expand" style="background-color: transparent; border: none; display: inline-table; height: 200px; margin: 0; padding: 0; position: relative; visibility: visible; width: 833px;"><ins id="aswift_2_anchor" style="background-color: transparent; border: none; display: block; height: 200px; margin: 0; padding: 0; position: relative; visibility: visible; width: 833px;"></ins></ins></ins></div>
<span style="color: black;">In
simple terms, when a user starts a screen session and opens up multiple
virtual terminals within that session, the running processes will not
be affected by a disconnection event.</span><br />
<h2>
<span style="color: black;">What is screen ?</span></h2>
<span style="color: black;">The
‘screen’ utility is a window manager that is used to multiplex a
physical terminal between multiple processes or interactive shells. When
the screen command is called, a single window will show up where the
user can work normally. </span><br /> <span style="color: black;">Users
have the ability to open as many screens as they need, switch between
them, list them, kill them, detach them, copy and paste text between
them and even reconnect to them.</span><br />
<span style="color: black;">All
windows execute or manage their own programs independently of each
other. When a window is not visible, its corresponding programs continue
to run even when the full screen session is detached or decoupled from
the user’s terminal.</span><br />
<h2>
<span style="color: black;">Installing Linux screen</span></h2>
<span style="color: black;">On
most Linux distros, the screen utility is already pre-installed. To
check if screen is installed on your Linux system , type in the
following command for Ubuntu and similar distros:</span><br />
<span style="color: black; font-family: 'courier new', courier, monospace;">screen –version</span><br />
<span style="color: black;"><img class="wp-image-2229 aligncenter lazyloaded" data-sizes="(max-width: 1504px) 100vw, 1504px" data-src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-95.jpeg" data-srcset="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-95.jpeg 1504w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-95-300x75.jpeg 300w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-95-768x193.jpeg 768w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-95-1024x257.jpeg 1024w" src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-95.jpeg" /></span><br />
<span style="color: black;">As you can see from the snapshot above, screen is not installed on our Ubuntu 18.04. You can install it by running the <span style="color: #3366ff;"><a href="https://net2.com/how-to-use-the-apt-command-in-ubuntu-debian-linux-systems/" style="color: #3366ff;">apt</a> </span>command :</span><br />
<span style="color: black; font-family: 'courier new', courier, monospace;">sudo apt install screen</span><br />
<span style="color: black;"><img class="wp-image-2230 aligncenter lazyloaded" data-sizes="(max-width: 1504px) 100vw, 1504px" data-src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-96.jpeg" data-srcset="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-96.jpeg 1504w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-96-300x199.jpeg 300w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-96-768x511.jpeg 768w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-96-1024x681.jpeg 1024w" src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-96.jpeg" /></span><br />
<h2>
<span style="color: black;">Start using screen</span></h2>
<span style="color: black;">In order to start your first screen session, type in screen in your terminal:</span><br />
<span style="color: black; font-family: 'courier new', courier, monospace;">screen</span><br />
<span style="color: black;">You will be greeted with the following welcome message :</span><br />
<span style="color: black;"><img class="wp-image-2231 aligncenter lazyloaded" data-sizes="(max-width: 1504px) 100vw, 1504px" data-src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-97.jpeg" data-srcset="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-97.jpeg 1504w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-97-300x196.jpeg 300w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-97-768x502.jpeg 768w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-97-1024x670.jpeg 1024w" src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-97.jpeg" /></span><br />
<div class="google-auto-placed ap_container" style="clear: none; height: auto; text-align: center; width: 100%;">
<ins class="adsbygoogle adsbygoogle-noablate" data-ad-client="ca-pub-4222719099368092" data-ad-format="auto" data-adsbygoogle-status="done" data-overlap-observer-io="false" style="background-color: transparent; display: block; margin: auto;"><ins id="aswift_3_expand" style="background-color: transparent; border: none; display: inline-table; height: 200px; margin: 0; padding: 0; position: relative; visibility: visible; width: 833px;"><ins id="aswift_3_anchor" style="background-color: transparent; border: none; display: block; height: 200px; margin: 0; padding: 0; position: relative; visibility: visible; width: 833px;"></ins></ins></ins></div>
<span style="color: black;">This will create a screen session, open a new window and finally start a shell in that window.</span><br />
<span style="color: #3366ff; font-size: 12pt;"><strong>You may want to read: <a href="https://net2.com/how-to-use-scp-command-to-transfer-files-securely-using-ssh-on-linux/" style="color: #3366ff;">How to use scp command to transfer files securely using ssh on Linux</a></strong></span><br />
<h3>
<span style="color: black;">List of all currently opened screens</span></h3>
<span style="color: black;">To
find the list of all currently opened screens including those that are
running in the background, issue the command below in your terminal :</span><br />
<span style="color: black; font-family: 'courier new', courier, monospace;">screen -ls</span><br />
<span style="color: black;"><img class="wp-image-2232 aligncenter lazyloaded" data-sizes="(max-width: 1504px) 100vw, 1504px" data-src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-98.jpeg" data-srcset="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-98.jpeg 1504w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-98-300x38.jpeg 300w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-98-768x96.jpeg 768w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-98-1024x128.jpeg 1024w" src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-98.jpeg" /></span><br />
<span style="color: black;">The highlighted number above, .i.e 8585, identifies the PID of the screen session.</span><br />
<span style="color: black;">If you type in the command below :</span><br />
<span style="color: black; font-family: 'courier new', courier, monospace;">ps -e | grep 8585</span><br />
<span style="color: black;"><img class="wp-image-2233 aligncenter lazyloaded" data-sizes="(max-width: 1374px) 100vw, 1374px" data-src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-20.png" data-srcset="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-20.png 1374w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-20-300x24.png 300w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-20-768x63.png 768w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-20-1024x83.png 1024w" src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-20.png" /></span><br />
<span style="color: black;">You will see that it is indeed a screen session process.</span><br />
<h3>
<span style="color: black;">Creating a named screen</span></h3>
<span style="color: black;">From the snapshot below, the title of the session is not very descriptive.</span><br />
<span style="color: black;"><img class="wp-image-2234 aligncenter lazyloaded" data-sizes="(max-width: 1504px) 100vw, 1504px" data-src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-99.jpeg" data-srcset="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-99.jpeg 1504w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-99-300x31.jpeg 300w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-99-768x80.jpeg 768w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-99-1024x106.jpeg 1024w" src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-99.jpeg" /></span><br />
<div class="google-auto-placed ap_container" style="clear: none; height: auto; text-align: center; width: 100%;">
<ins class="adsbygoogle adsbygoogle-noablate" data-ad-client="ca-pub-4222719099368092" data-ad-format="auto" data-adsbygoogle-status="done" data-overlap-observer-io="false" style="background-color: transparent; display: block; margin: auto;"><ins id="aswift_4_expand" style="background-color: transparent; border: none; display: inline-table; height: 200px; margin: 0; padding: 0; position: relative; visibility: visible; width: 833px;"><ins id="aswift_4_anchor" style="background-color: transparent; border: none; display: block; height: 200px; margin: 0; padding: 0; position: relative; visibility: visible; width: 833px;"></ins></ins></ins></div>
<span style="color: black;">Since
it is good practice to choose a memorable session name to remember what
screen is executing what command, run the command below:</span><br />
<span style="color: black; font-family: 'courier new', courier, monospace;">screen -S command_name</span><br />
<span style="color: black;">Where
command_name is the command that would be run by the session. Otherwise
you can just choose a name for the session per se as shown below :</span><br />
<span style="color: black;"><img class="wp-image-2235 aligncenter lazyloaded" data-sizes="(max-width: 1374px) 100vw, 1374px" data-src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-21.png" data-srcset="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-21.png 1374w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-21-300x17.png 300w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-21-768x44.png 768w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-21-1024x58.png 1024w" src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-21.png" /></span><br />
<span style="color: black;">When
you hit enter, a second screen session will be created. To see the
number of currently active screen sessions , use the command you used
earlier :</span><br />
<span style="color: black;"><img class="wp-image-2236 aligncenter lazyloaded" data-sizes="(max-width: 1504px) 100vw, 1504px" data-src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-100.jpeg" data-srcset="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-100.jpeg 1504w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-100-300x79.jpeg 300w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-100-768x201.jpeg 768w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-100-1024x268.jpeg 1024w" src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-100.jpeg" /></span><br />
<h3>
<span style="color: black;">Detaching from a screen</span></h3>
<span style="color: black;">In order to detach yourself from the current screen, Press Ctlr+a d;</span><br />
<span style="color: black;"><img class="wp-image-2237 aligncenter lazyloaded" data-sizes="(max-width: 1374px) 100vw, 1374px" data-src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-22.png" data-srcset="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-22.png 1374w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-22-300x26.png 300w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-22-768x67.png 768w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-22-1024x89.png 1024w" src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-22.png" /></span><br />
<div class="google-auto-placed ap_container" style="clear: none; height: auto; text-align: center; width: 100%;">
<ins class="adsbygoogle adsbygoogle-noablate" data-ad-client="ca-pub-4222719099368092" data-ad-format="auto" data-adsbygoogle-status="done" data-overlap-observer-io="false" style="background-color: transparent; display: block; margin: auto;"><ins id="aswift_5_expand" style="background-color: transparent; border: none; display: inline-table; height: 200px; margin: 0; padding: 0; position: relative; visibility: visible; width: 833px;"><ins id="aswift_5_anchor" style="background-color: transparent; border: none; display: block; height: 200px; margin: 0; padding: 0; position: relative; visibility: visible; width: 833px;"></ins></ins></ins></div>
<span style="color: black;">Notice that if you quit the terminal altogether and then open it up, you will see that the screen session is still running.</span><br />
<span style="color: black;">If
case you need to quit the terminal, but you want your tasks to continue
running in the screen session, you can detach the screen manually in
order to reconnect with it later using Ctrl+a d.</span><br />
<h3>
<span style="color: black;">Reattaching to a screen</span></h3>
<span style="color: black;">In
order to reattach to a screen session, issue the command below in which
the PID of the detached session would need to be provided :</span><br />
<span style="color: black; font-family: 'courier new', courier, monospace;">screen -r Screen_PID</span><br />
<span style="color: black;"><img class="wp-image-2238 aligncenter lazyloaded" data-sizes="(max-width: 1504px) 100vw, 1504px" data-src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-101.jpeg" data-srcset="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-101.jpeg 1504w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-101-300x53.jpeg 300w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-101-768x137.jpeg 768w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-101-1024x182.jpeg 1024w" src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-101.jpeg" /></span><br />
<span style="color: black;">Once you hit enter, you will automatically get reattached to the screen session you had indicated.</span><br />
<span style="color: black;">You
can also, instead of providing the PID, use the name (or the first few
characters of the name) of the screen session, for instance:</span><br />
<span style="color: black; font-family: 'courier new', courier, monospace;">screen -r mysec</span><br />
<span style="color: black;">Where mysec is the beginning of the name of the second screen session called: mysecondcreensession.</span><br />
<h3>
<span style="color: black;">How to quit an active session ?</span></h3>
<span style="color: black;">In
case you want to kill a screen session, you would need first to display
the list of active screen sessions in order to identify the session to
terminate :</span><br />
<span style="color: black; font-family: 'courier new', courier, monospace;">screen -ls</span><br />
<span style="color: black;"><img class="wp-image-2239 aligncenter lazyloaded" data-sizes="(max-width: 1504px) 100vw, 1504px" data-src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-102.jpeg" data-srcset="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-102.jpeg 1504w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-102-300x53.jpeg 300w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-102-768x137.jpeg 768w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-102-1024x182.jpeg 1024w" src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-102.jpeg" /></span><br />
<span style="color: black;">Now we want to quit session with PID 8585 as shown above. To do this we use the command below :</span><br />
<span style="color: black; font-family: 'courier new', courier, monospace;">screen -X -S 8585 quit</span><br />
<span style="color: black;"><img class="wp-image-2240 aligncenter lazyloaded" data-sizes="(max-width: 1504px) 100vw, 1504px" data-src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-103.jpeg" data-srcset="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-103.jpeg 1504w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-103-300x55.jpeg 300w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-103-768x141.jpeg 768w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-103-1024x188.jpeg 1024w" src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-103.jpeg" /></span><br />
<span style="color: black;">where you can see that the screen session with PID 858 was terminated.</span><br />
<div class="google-auto-placed ap_container" style="clear: none; height: auto; text-align: center; width: 100%;">
<ins class="adsbygoogle adsbygoogle-noablate" data-ad-client="ca-pub-4222719099368092" data-ad-format="auto" data-adsbygoogle-status="done" data-overlap-observer-io="false" style="background-color: transparent; display: block; margin: auto;"><ins id="aswift_6_expand" style="background-color: transparent; border: none; display: inline-table; height: 200px; margin: 0; padding: 0; position: relative; visibility: visible; width: 833px;"><ins id="aswift_6_anchor" style="background-color: transparent; border: none; display: block; height: 200px; margin: 0; padding: 0; position: relative; visibility: visible; width: 833px;"></ins></ins></ins></div>
<span style="color: black;">Let us now attach to the only screen session left, i.e. with PID 10313 :</span><br />
<span style="color: black;"><img class="wp-image-2241 aligncenter lazyloaded" data-sizes="(max-width: 1504px) 100vw, 1504px" data-src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-104.jpeg" data-srcset="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-104.jpeg 1504w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-104-300x55.jpeg 300w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-104-768x141.jpeg 768w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-104-1024x188.jpeg 1024w" src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-104.jpeg" /></span><br />
<span style="color: black;">In order to kill the current screen session from within it, press Ctrl+a k. You will be prompted with the question :</span><br />
<span style="color: black;"><img class="wp-image-2242 aligncenter lazyloaded" data-sizes="(max-width: 774px) 100vw, 774px" data-src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-23.png" data-srcset="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-23.png 774w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-23-300x15.png 300w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-23-768x38.png 768w" src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-23.png" /></span><br />
<span style="color: black;">Go
ahead and choose y. This will terminate the screen (actually this will
kill the window, but since the screen has one window, it will get
terminated).</span><br />
<span style="color: black;"><img class="wp-image-2243 aligncenter lazyloaded" data-sizes="(max-width: 1376px) 100vw, 1376px" data-src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-24.png" data-srcset="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-24.png 1376w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-24-300x27.png 300w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-24-768x68.png 768w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-24-1024x91.png 1024w" src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-24.png" /></span><br />
<span style="color: black;"><img class="wp-image-2244 aligncenter lazyloaded" data-sizes="(max-width: 1376px) 100vw, 1376px" data-src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-25.png" data-srcset="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-25.png 1376w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-25-300x17.png 300w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-25-768x45.png 768w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-25-1024x60.png 1024w" src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-25.png" /></span><br />
<span style="color: black;">In
order to exit a one-window screen, you could simply type in the exit
command which will take you back to the standard bash prompt.</span><br />
<h3>
<span style="color: black;">Creating multiple windows in a screen</span></h3>
<span style="color: black;">To
create several windows within your existing screen, simply press Ctrl-a
followed by c. In order to see the list of windows in your current
screen session, press Ctrl-a followed by w.</span><br />
<span style="color: black;"><img class="wp-image-2245 aligncenter lazyloaded" data-sizes="(max-width: 1376px) 100vw, 1376px" data-src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-26.png" data-srcset="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-26.png 1376w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-26-300x22.png 300w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-26-768x56.png 768w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-26-1024x74.png 1024w" src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-26.png" /></span><br />
<div class="google-auto-placed ap_container" style="clear: none; height: auto; text-align: center; width: 100%;">
<ins class="adsbygoogle adsbygoogle-noablate" data-ad-client="ca-pub-4222719099368092" data-ad-format="auto" data-adsbygoogle-status="done" data-overlap-observer-io="false" style="background-color: transparent; display: block; margin: auto;"><ins id="aswift_7_expand" style="background-color: transparent; border: none; display: inline-table; height: 200px; margin: 0; padding: 0; position: relative; visibility: visible; width: 833px;"><ins id="aswift_7_anchor" style="background-color: transparent; border: none; display: block; height: 200px; margin: 0; padding: 0; position: relative; visibility: visible; width: 833px;"></ins></ins></ins></div>
<span style="color: black;">You can also display the screen windows using ‘Ctrl-a :’</span><br />
<span style="color: black;"><img class="wp-image-2246 aligncenter lazyloaded" data-sizes="(max-width: 1504px) 100vw, 1504px" data-src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-105.jpeg" data-srcset="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-105.jpeg 1504w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-105-300x57.jpeg 300w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-105-768x147.jpeg 768w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-105-1024x196.jpeg 1024w" src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-105.jpeg" /></span><br />
<span style="color: black;">Here
you can scroll up or down in order to move between your desired windows
and then hit enter once you decide to land on the selected window.</span><br />
<h3>
<span style="color: black;">Renaming a window</span></h3>
<span style="color: black;">If
you want to rename a window, make sure you are already on the correct
window that you want to rename and press Ctrl-a A. This will display the
prompt below which enables you to rename the window :</span><br />
<span style="color: black;"><img class="wp-image-2247 aligncenter lazyloaded" data-sizes="(max-width: 644px) 100vw, 644px" data-src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-27.png" data-srcset="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-27.png 644w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-27-300x20.png 300w" src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-27.png" /></span><br />
<h3>
<span style="color: black;">Switching between screen windows</span></h3>
<span style="color: black;">When
more than one screen window is opened, you can switch between them by
pressing Ctrl-a followed by space or the shell number, .i.e. just press
Ctrl-a 0, Ctrl-a 1, Ctrl-a 3 if you have three windows and so forth.<br /> You can also use Ctrl-a N to move to the next screen or Ctrl-a P to return to the previous screen.</span><br />
<h3>
<span style="color: black;">Splitting windows</span></h3>
<span style="color: black;">You
have the possibility to split your windows instead of switching between
them in order to have a bird view of your work. This can be achieved by
pressing Ctrl-a followed by S or | for horizontal or vertical
splitting. To move between panes, use Ctrl-a followed by tab. Here is
how splitting a screen session will look like :</span><br />
<span style="color: black;"><img class="wp-image-2248 aligncenter lazyloaded" data-sizes="(max-width: 1182px) 100vw, 1182px" data-src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-106.jpeg" data-srcset="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-106.jpeg 1182w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-106-300x174.jpeg 300w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-106-768x444.jpeg 768w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-106-1024x593.jpeg 1024w" src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-106.jpeg" /></span><br />
<h2>
<span style="color: black;">Resuming a disconnected session</span></h2>
<span style="color: black;">In case you want to resume a detached session to continue your work, run the command :</span><br />
<span style="color: black; font-family: 'courier new', courier, monospace;">screen -d -r your_detached_ression</span><br />
<span style="color: black;">This
is helpful when you want to continue your work after a disconnection
event for instance without losing the detached screen session context
(running processes , window output).</span><br />
<h2>
<span style="color: black;">How to run a command with screen<br /> </span></h2>
<span style="color: black;">When you have a command to that you want to run using screen, issue the command below :</span><br />
<span style="color: black; font-family: 'courier new', courier, monospace;">screen -d -m your_command</span><br />
<span style="color: black;">For instance to run a Python script:, issue the command below:</span><br />
<span style="color: black; font-family: 'courier new', courier, monospace;">screen -d -m python your_python_script</span><br />
<h2>
<span style="color: black;">The screen configuration file</span></h2>
<span style="color: black;">When
you first call screen, it reads its actual configuration parameters
from the file /etc/screenrc and ~/.screenrc if it is available. You can
alter the default screen settings using the .screenrc file.</span><br />
<span style="color: black;"><img class="wp-image-2249 aligncenter lazyloaded" data-sizes="(max-width: 1504px) 100vw, 1504px" data-src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-107.jpeg" data-srcset="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-107.jpeg 1504w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-107-300x164.jpeg 300w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-107-768x419.jpeg 768w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-107-1024x558.jpeg 1024w" src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/word-image-107.jpeg" /></span><br />
<h2>
<span style="color: black;"><strong>Conclusion</strong></span></h2>
<span style="color: black;">In
this tutorial, you were introduced to the Gnu screen utility. Now you
should be able to use the screen tool, create screen windows, navigate
between them, detach and resume screen sessions as well as customize
your screen display using the .screenrc file.<br /> </span><span style="color: black;">To learn more about Gnu screen, visit the screen <a href="https://www.gnu.org/software/screen/manual/screen.html" rel="nofollow" style="color: black;"><span style="color: #3366ff;">user’s manual page</span>.</a></span></div>
</div>
Sameh Attiahttp://www.blogger.com/profile/06829656663776752624noreply@blogger.com0tag:blogger.com,1999:blog-3950073089426506979.post-86313832407036706972020-01-11T21:23:00.001+02:002020-01-11T21:23:27.208+02:00How to copy a file to multiple directories in Linux<div dir="ltr" style="text-align: left;" trbidi="on">
https://net2.com/how-to-copy-a-file-to-multiple-directories-in-linux<br />
<br />
<span style="color: black;">In this short article, you will learn
how to copy one file into many directories. The obvious answer would be
to use the cp command but this not is exactly correct since the cp
command is rather used to copy several files into<span id="more-2218"></span> one directory. You will see what additional commands and combinations are needed to pull this off. Let’s get started.</span><br />
<h2>
<span style="color: black;">The cp command basic syntax</span></h2>
<span style="color: black;">The most basic cp command syntax that is used to copy multiple files into one directory is the following :</span><br />
<span style="color: black; font-family: 'courier new', courier, monospace;">cp file_1 /directory_1/</span><br />
<span style="color: black; font-family: 'courier new', courier, monospace;">cp file_1 file_2 file_3 /directory_1/</span><br />
<span style="color: black;">Here is an example :</span><br />
<span style="color: black; font-family: 'courier new', courier, monospace;">cp /Documents/FileExample.txt /TextFiles/</span><br />
<span style="color: black;"><img alt="cp command" class="aligncenter wp-image-2220 size-large lazyloaded" data-sizes="(max-width: 1024px) 100vw, 1024px" data-src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/cp-command-1024x140.jpg" data-srcset="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/cp-command-1024x140.jpg 1024w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/cp-command-300x41.jpg 300w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/cp-command-768x105.jpg 768w, https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/cp-command.jpg 1374w" height="140" src="https://v9h7a5s9.stackpathcdn.com/wp-content/uploads/2019/11/cp-command-1024x140.jpg" width="1024" /></span><br />
<h2>
<span style="color: black;">How to copy one file to several directories ?</span></h2>
<span style="color: black;">As
mentioned above, the cp command cannot be used to copy one file to
multiple folders. The solution would be to use the xargs or GNU parallel
commands.</span><br />
<h2>
<span style="color: black;">Using xargs</span></h2>
<span style="color: black;">To copy for instance file_1 into the folders directory_1, directory_2, we could proceed as follows:</span><br />
<span style="color: black; font-family: 'courier new', courier, monospace;">echo directory_1 directory_2 | xargs -n 1 cp file_1</span><br />
<span style="color: black;">In
the command above, target directories (directory_1,directory_2) are
first echoed and then piped out (or fed) as input to the command xargs
where:</span><br />
<span style="color: black;"><strong>-n 1</strong> : Instructs xargs to use one argument per command line at a time and forward to the cp command</span><br />
<span style="color: black;"><strong>cp</strong> : classic cp command</span><br />
<span style="color: black;"><strong>-v</strong> : Allows verbose mode in order to display more details of the copy task</span><br />
<span style="color: black;">The
xargs will execute the cp command two times (i.e. as many target
directories as provided in the input) where at each run, it appends the
next directory path fed to it from the previous echo command to the end
of the standard cp command.<br /> </span><span style="color: black;">So
instead of executing two separate cp commands, we can now use one single
command to perform the same task. If the file to be copied exists
already in one of the destination folders, the old file will be replaced
without prompting the user. In other words, the -i option (interactive)
of the cp command cannot be used in conjunction with xargs.<br /> </span><span style="color: black;">If
the file to be copied has a large size and you do not want the
destination file (if it exists) to be replaced, you might want to add
the -n switch to the cp command in the single line above. This will
prevent the destination file from being replaced.</span><br />
<span style="color: #3366ff;"><strong><span style="font-size: 12pt;">Read: <a href="https://net2.com/how-to-use-grep-command-in-linux/" rel="noopener noreferrer" style="color: #3366ff;" target="_blank">How to use grep command in Linux</a></span></strong></span><br />
<br /> <br />
<div id="amzn_assoc_ad_div_adunit_0">
<div class="amzn-native-container" data-ad-meta="enhanced_links-manual" id="amzn-native-ad-0" style="display: block;">
</div>
</div>
<div id="amzn_assoc_ad_div_adunit_0">
</div>
<h2>
<span style="color: black;">Using find</span></h2>
<span style="color: black;">Another alternative to carrying out a copy to multiple destinations is to use the find command as follows :</span><br />
<span style="color: black; font-family: 'courier new', courier, monospace;">find directory1 directory2 -exec cp file.txt {} \;</span><br />
<span style="color: black;">If
the target directories have sub-directories and you don’t want to copy
the file into them, you would need to add -maxdepth 0 option as follows:</span><br />
<span style="color: black; font-family: 'courier new', courier, monospace;">find directory1 directory2 -maxdepth 0 -exec cp file.txt {} \;</span><br />
<span style="color: black;">This
will overwrite or replace every file in directory1 and directory2 with
the content of file.txt before copying it. In order not to affect other
files in these destination directories, make find aware that it should
only act on directories as follows:</span><br />
<span style="color: black; font-family: 'courier new', courier, monospace;">find directory1 directory2 -type d -exec cp file.txt {} \;</span><br />
<span style="font-family: arial, helvetica, sans-serif;"><span style="color: black;"><span style="font-size: 12pt;"><strong><span style="color: #3366ff;">Read: </span></strong></span></span><span style="color: black;"><span style="font-size: 12pt;"><strong><span style="color: #3366ff;"><a href="https://net2.com/linux-directories-explained/" style="color: #3366ff;">Linux directories explained</a></span></strong></span></span></span><br />
<h2>
<span style="color: black;">Using loop in a shell</span></h2>
<span style="color: black;">xfAnother solution would be to use a for loop within a one line shell as follows :</span><br />
<span style="color: black; font-family: 'courier new', courier, monospace;">for dir in *; do [ -d “$dir” ] && cp /full_path/file.txt “$dir” ; done</span><br />
<span style="color: black;">This will copy the file /full_path/file.txt to all directories in your current path or location.</span><br />
<span style="color: black; font-family: 'courier new', courier, monospace;">for dir in *; do [ -d “$dir” ] && cp -rf /full_path/folder “$dir” ; done</span><br />
<span style="color: black;">This however will copy the folder /full_path/folder to every sub-folder or sub-directory in your current location.</span><br />
<span style="font-size: 12pt;"><strong><span style="color: #3366ff;">Read: <a href="https://net2.com/how-to-find-the-largest-files-on-linux/" style="color: #3366ff;">How to find the largest files on Linux</a></span></strong></span><br />
<h2>
<span style="color: black;">Using GNU parallel</span></h2>
<span style="color: black;">GNU
parallel is a shell utility used for executing tasks or jobs in
parallel over one or multiple machines. The basic syntax is as follows:</span><br />
<span style="color: black; font-family: 'courier new', courier, monospace;">parallel cp file_name ::: /directory1/ /directory2/</span><br />
<span style="color: black;">Here is an example on how to use it :</span><br />
<span style="color: black;">Let’s copy the file /etc/resolv.conf to /directory1/, /directory2/ :</span><br />
<span style="color: black; font-family: 'courier new', courier, monospace;">parallel cp -v /etc/resolv.conf ::: /directory1/, /directory2/</span><br />
<h2>
<span style="color: black;">Using tee</span></h2>
<span style="color: black;">The tee command allows you to copy one file to multiple destinations. Here is an example on how to perform this:</span><br />
<span style="color: black; font-family: 'courier new', courier, monospace;">tee ~/directory1/file1 ~/directory2/file1 < ~/file1</span><br />
<div class="google-auto-placed ap_container" style="clear: none; height: auto; text-align: center; width: 100%;">
<ins class="adsbygoogle adsbygoogle-noablate" data-ad-client="ca-pub-4222719099368092" data-ad-format="auto" data-adsbygoogle-status="done" data-overlap-observer-io="false" style="background-color: transparent; display: block; margin: auto;"><ins id="aswift_2_expand" style="background-color: transparent; border: none; display: inline-table; height: 200px; margin: 0; padding: 0; position: relative; visibility: visible; width: 833px;"><ins id="aswift_2_anchor" style="background-color: transparent; border: none; display: block; height: 200px; margin: 0; padding: 0; position: relative; visibility: visible; width: 833px;"></ins></ins></ins></div>
<span style="color: black;">Note
that the input that is written by tee will be forwarded to the standard
output (stdout). If you don’t like this behavior, you have the
possibility to prevent it by rerouting standard output to /dev/null as
shown below:</span><br />
<span style="color: black; font-family: 'courier new', courier, monospace;">tee ~/directory1/file1 ~/directory2/file1 < ~/file1 >/dev/nul</span><br />
<h2>
<span style="color: black;">Conclusion</span></h2>
<span style="color: black;">As
you have seen, there are many ways to copy a file to multiple
directories. Most of these solutions make use of the cp command which
cannot perform this feat on its own.</span></div>
Sameh Attiahttp://www.blogger.com/profile/06829656663776752624noreply@blogger.com0tag:blogger.com,1999:blog-3950073089426506979.post-62315851224099666092019-02-14T01:08:00.003+02:002019-02-14T01:08:52.060+02:003 Ways to List Users in Linux<div dir="ltr" style="text-align: left;" trbidi="on">
https://linuxhandbook.com/linux-list-users<br />
<br />
<strong><em>This tutorial shows you how to list users in Linux. You’ll also learn to list only the logged users.</em></strong><br />
Today different Operating
Systems have the capability to use multiple users, each one with their
settings and custom configurations to make things easier for
administrators and operators to work in together on the same system.<br />
Linux on the other hand is very strong on this matter as it allows
multiple users to work at the same time on the system in an independent
way. It can even allow a single user to open several sessions even from
different locations in order to work on the system.<br />
Here are some hints & tricks to handle users in Linux.<br />
<h2>
<span class="ez-toc-section" id="list_all_the_users_on_linux">List all the users on Linux</span></h2>
<div class="wp-block-image">
<figure class="aligncenter"><img alt="How to List Users in Linux" class="wp-image-5177 jetpack-lazy-image jetpack-lazy-image--handled" data-attachment-id="5177" data-comments-opened="1" data-image-description="" data-image-meta="{"aperture":"0","credit":"","camera":"","caption":"","created_timestamp":"0","copyright":"","focal_length":"0","iso":"0","shutter_speed":"0","title":"","orientation":"0"}" data-image-title="list-users-linux" data-large-file="https://i2.wp.com/linuxhandbook.com/wp-content/uploads/list-users-linux.png?fit=702%2C395&ssl=1" data-lazy-loaded="1" data-medium-file="https://i2.wp.com/linuxhandbook.com/wp-content/uploads/list-users-linux.png?fit=300%2C169&ssl=1" data-orig-file="https://i2.wp.com/linuxhandbook.com/wp-content/uploads/list-users-linux.png?fit=800%2C450&ssl=1" data-orig-size="800,450" data-permalink="https://linuxhandbook.com/linux-list-users/list-users-linux/" data-recalc-dims="1" src="https://i2.wp.com/linuxhandbook.com/wp-content/uploads/list-users-linux.png?w=702&ssl=1" /></figure></div>
Probably, the very first thing to know is how to know what users are
in my system. There are several ways you can obtain the list of users in
Linux.<br />
<h3>
<span class="ez-toc-section" id="1_show_users_in_linux_using_less_etcpasswd">1. Show users in Linux using less /etc/passwd</span></h3>
This command allows sysops to list the the users that are locally
stored in the system. It will give the listing in structured way as:<br />
<pre class="wp-block-code"><code>root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/usr/sbin/nologin
man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
johndoe:x:1000:1000:John Doe,,,:/home/helder:/bin/bash
davmail:x:127:65534::/var/lib/davmail:/usr/sbin/nologin
statd:x:128:65534::/var/lib/nfs:/usr/sbin/nologin
/etc/passwd (END)</code></pre>
The structure in the above output goes as:<br />
<ul>
<li>User name</li>
<li>Encrypted password (<code>x</code> represents password is stored)</li>
<li>User ID number (UID)</li>
<li>User’s group ID number (GID)</li>
<li>Full name</li>
<li>User’s home directory</li>
<li>User’s Login shell (default is bash shell)</li>
</ul>
<div class="wp-block-atomic-blocks-ab-notice ab-font-size-18 ab-block-notice" data-id="ca7860" style="background-color: #7941b6; color: #32373c;">
<div class="ab-notice-title" style="color: white;">
Why so many users? Which ones are ‘real’?</div>
<div class="ab-notice-text" style="border-color: #7941b6;">
The list shows a lot more users than you expected because it lists all the system users too. <br />
<div style="clear: both; margin-bottom: 1em; margin-top: 0em;">
<a class="u1411661cc2fe2f391794d88ec5b00635" href="https://linuxhandbook.com/frozen-linux-system/" target="_blank"><div style="padding-left: 1em; padding-right: 1em;">
<span class="ctaText">READ</span> <span class="postTitle">Frozen Linux System? Here are 3 Ways to Deal With It</span></div>
</a></div>
Now if you want to distinguish the normal users from the system users, you can refer to the User ID (UID) number.<br />
Generally,
a normal user has UID greater or equal to 1000. This gives you a hint
that the user with UID >=1000 is a normal user and users with UID
<1000 are="" p="" system="" users.=""></1000></div>
</div>
<h3>
<span class="ez-toc-section" id="2_view_users_using_getent_passwd">2. View users using getent passwd</span></h3>
This command will give you a similar output as “less /etc/passwd” however, this one actually queries the <a aria-label="GNU Name Service Switch (opens in a new tab)" href="https://www.gnu.org/software/libc/manual/html_node/Name-Service-Switch.html" rel="noreferrer noopener" target="_blank">GNU Name Service Switch</a> functionality configuration file (located at /etc/nsswitch.conf). <br />
This conf includes passwd, so that’s why it will display very similar but if you use LDAP for authentication it will include that as well.<br />
<h3>
<span class="ez-toc-section" id="3_list_linux_users_with_compgen">3. List Linux users with compgen</span></h3>
If you just want to list all the usernames without any additional information, you can use the <a aria-label="compgen command (opens in a new tab)" href="https://www.unix.com/man-page/all/1/compgen/" rel="noreferrer noopener" target="_blank">compgen</a><a aria-label="compgen command (opens in a new tab)" href="https://www.unix.com/man-page/all/1/compgen/" rel="noreferrer noopener" target="_blank"> command</a> with <strong>-u</strong> option.<br />
<pre class="wp-block-preformatted">compgen -u</pre>
The output would be like this:<br />
<pre class="wp-block-preformatted">compgen -u
root
daemon
bin
sys
sync
games
man
lp
mail
news
uucp
proxy
www-data
backup
list
irc
gnats
nobody
systemd-network
systemd-resolve
syslog
messagebus
_apt
uuidd
avahi-autoipd
usbmux
dnsmasq
rtkit
cups-pk-helper
speech-dispatcher
whoopsie
kernoops
saned
pulse
avahi
colord
hplip
geoclue
gnome-initial-setup
gdm
abhishek </pre>
<div class="wp-block-atomic-blocks-ab-notice ab-font-size-18 ab-block-notice" data-id="12ae2a" style="background-color: #7941b6; color: #32373c;">
<div class="ab-notice-title" style="color: white;">
Tip</div>
<div class="ab-notice-text" style="border-color: #7941b6;">
You can use compgen
command with -c option to list all the commands available to you. This
is helpful when you are not the admin on a Linux system and don’t have <a aria-label="sudo access (opens in a new tab)" href="https://linuxhandbook.com/create-sudo-user/" rel="noreferrer noopener" target="_blank">sudo access</a>.</div>
</div>
<h2>
<span class="ez-toc-section" id="a_few_tips_about_listing_users_in_linux">A few tips about listing users in Linux</span></h2>
You just saw three ways to view users in Linux. Here are a few tips that would help you while dealing with the users listing.<br />
<h3>
<span class="ez-toc-section" id="list_only_the_usernames">List only the usernames</span></h3>
You already have the compgen command for that but you don’t have to remember it all the time. <br />
If we would like to only get a list of the usernames in the system, you can use the <a aria-label="awk command (opens in a new tab)" href="https://linuxhandbook.com/awk-command-tutorial/" rel="noreferrer noopener" target="_blank">awk command</a> or the <a aria-label="cut command (opens in a new tab)" href="https://linuxhandbook.com/cut-command/" rel="noreferrer noopener" target="_blank">cut command</a> to filter the output of the other two commands we saw earlier.<br />
<pre class="wp-block-preformatted">cut -d: -f1 /etc/passwd</pre>
or<br />
<pre class="wp-block-preformatted">getent passwd | awk -F: '{ print $1}'</pre>
Any of these will give us a filtered list of users, showing only the very first column which is username:<br />
<pre class="wp-block-code"><code>root
daemon
bin
sys
sync
games
man
lp
mail
news
johndoe
davmail
statd</code></pre>
<h3>
<span class="ez-toc-section" id="check_if_a_username_already_exists_in_the_system">Check if a username already exists in the system</span></h3>
This might be useful if you want to know if a particular username already exists in the system:<br />
<div style="clear: both; margin-bottom: 1em; margin-top: 0em;">
<a class="ud41c678be64d2582138d3145feec7e5b" href="https://linuxhandbook.com/convert-tabs-spaces/" target="_blank"><div style="padding-left: 1em; padding-right: 1em;">
<span class="ctaText">READ</span> <span class="postTitle">Convert Tabs to Spaces in Linux Command Line</span></div>
</a></div>
<em>getent passwd | grep johndoe</em><br />
<pre class="wp-block-code"><code>johndoe:x:1000:1000:John Doe,,,:/home/johndoe:/bin/bash</code></pre>
<h3>
<span class="ez-toc-section" id="list_all_the_connected_users">List all the connected users</span></h3>
If you want to know what users are currently logged into your system,
then you need to perform a simple ‘who’ on your command line and this
will immediately list current usernames with an active session to your
system<br />
<pre class="wp-block-code"><code>user@system:~$ who
johndoe :0 2019-01-28 21:35 (:0)
harrysmith pts/0 2019-02-01 09:51 (192.168.1.1)
stevejones pts/1 2019-02-02 09:51 (192.168.1.173)</code></pre>
In this case, the listing will give you not only the list of
usernames connected but also how they are connected, since when they are
connected and from where they are connected.<br />
The very first column will tell you what username is it. <br />
<div class="google-auto-placed ap_container" style="clear: none; height: auto; text-align: center; width: 100%;">
<ins class="adsbygoogle adsbygoogle-noablate" data-ad-client="ca-pub-6384374914382766" data-ad-format="auto" data-adsbygoogle-status="done" style="background-color: transparent; display: block; margin: auto;"><ins id="aswift_1_expand" style="background-color: transparent; border: none; display: inline-table; height: 176px; margin: 0; padding: 0; position: relative; visibility: visible; width: 702px;"><ins id="aswift_1_anchor" style="background-color: transparent; border: none; display: block; height: 176px; margin: 0; padding: 0; position: relative; visibility: visible; width: 702px;"></ins></ins></ins></div>
The second column will give you what type of connection it is: if
it’s represented with a “:X” where X is a number, it means it is using a
Graphical User Interface (GUI) or Desktop session such as Gnome, XDE,
etc; if it says “pts/X” where X is a number, it means it’s a connection
made through SSH protocol (command line). <br />
The third column will tell you since when this session has been
connected to the server (date and time). The fourth and last column will
give you the location from where it’s connected, if remote it will
display the IP from where the connection is made if local (like the GUI)
it will display “(:X)” where X is the number of the session in this
case and will match the number in the second column for that row.<br />
<h2>
<span class="ez-toc-section" id="wrapping_up">Wrapping up</span></h2>
As you can see, listing users in Linux is not difficult at all. It
consists of simple commands which will output all the information for
you, whatever you want to do or obtain of that information is something
you need to filter depending on what you want to check on the system.</div>
Sameh Attiahttp://www.blogger.com/profile/06829656663776752624noreply@blogger.com0tag:blogger.com,1999:blog-3950073089426506979.post-1257069703330940342019-02-13T23:21:00.002+02:002019-02-13T23:21:36.798+02:00How to Find Out When a File Was Accessed in Linux<div dir="ltr" style="text-align: left;" trbidi="on">
https://www.maketecheasier.com/find-out-when-file-was-accessed-linux<br />
<br />
<div class="post-thumbnail mb-2 w-100">
</div>
<div class="post-thumbnail mb-2 w-100">
<img alt="" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" height="400" src="https://www.maketecheasier.com/assets/uploads/2019/01/magglass-min.jpg" width="800" /></div>
<div class="entry-content" itemprop="text">
Linux
has a robust and mature file system that allows users to exploit a
variety of built-in tools for a range of purposes. Most commonly, users
will access files so that they can be copied, altered, opened and
deleted. Sometimes this is intentional, on other occasions, especially
in the case of servers, it can be malicious.<br />
It is time to channel your inner Sherlock Holmes. We are going file hunting!<br />
<div class="in-content-ad mb-1" id="MTE_in_content_ad">
<ins class="adsbygoogle" data-ad-client="ca-pub-8765285789552883" data-ad-format="fluid" data-ad-layout="in-article" data-ad-slot="7844251182" data-adsbygoogle-status="done" style="display: block; height: 175px; text-align: center;"><ins id="aswift_1_expand" style="background-color: transparent; border: none; display: inline-table; height: 175px; margin: 0; padding: 0; position: relative; visibility: visible; width: 700px;"><ins id="aswift_1_anchor" style="background-color: transparent; border: none; display: block; height: 175px; margin: 0; padding: 0; position: relative; visibility: visible; width: 700px;"></ins></ins></ins></div>
<h2 class="nolinks">
Why is this important?</h2>
Knowing
when a file was used, accessed or changed can help with unauthorized
access or simply as a way to keep track of what has happened. This
investigation could be on a professional level, with dedicated forensic
analysis, or on a home-user level, trying to see which of their photos
was copied and potentially where it ended up. This article is also meant
to give System Administrators a vital guide to enhance their toolset
for their daily activities and tasks.<br />
<h2 class="nolinks">
Give me the files, stat!</h2>
Open
your Terminal and gain root if you need it. Once done, you will be
ready to search for that elusive file or check when things have been
accessed.<br />
The <code>stat</code> command can show file size, type, UID/GUID and the access/modify time.<br />
Here is the stat of my “/etc” folder. Notice the simplicity of the command.<br />
You can see the date it was last accessed, the modify time and the last change.<br />
<img alt="stat-min" class="responsively-lazy size-full wp-image-289371 aligncenter" data-sizes="auto" data-src="https://www.maketecheasier.com/assets/uploads/2019/01/stat-min.jpg" src="https://www.maketecheasier.com/assets/uploads/2019/01/stat-min.jpg" title="stat-min" /><br />
<h2 class="nolinks">
But I forgot the name!</h2>
This
is a common occurrence, especially when digging through an old external
hard drive for that document or photo you need. Luckily the Terminal
comes to the rescue.<br />
The command needed is <code>ls</code>.<br />
There are four principal variables that you can use with <code>ls</code>:<br />
<div class="holsh-div nolinks">
<div class="bash" style="font-family: monospace;">
<pre><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-a</span></pre>
</div>
</div>
This will list all files, including those which are hidden:<br />
<div class="holsh-div nolinks">
<div class="bash" style="font-family: monospace;">
<pre><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-l</span></pre>
</div>
</div>
This enables the long list format:<br />
<div class="holsh-div nolinks">
<div class="bash" style="font-family: monospace;">
<pre><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">--time-style</span>=FORMAT</pre>
</div>
</div>
This shows the time in a specified format:<br />
<div class="holsh-div nolinks">
<div class="bash" style="font-family: monospace;">
<pre><span style="color: #c20cb9; font-weight: bold;">ls</span> +<span style="color: black; font-weight: bold;">%</span>D</pre>
</div>
</div>
This is the show/user date in %m/%d/%y format:<br />
When put together, the command gives us this. It is the basic list of my home directory on an Ubuntu test installation.<br />
<img alt="lsfile-min" class="responsively-lazy size-full wp-image-289364 aligncenter" data-sizes="auto" data-src="https://www.maketecheasier.com/assets/uploads/2019/01/lsfile-min.jpg" src="https://www.maketecheasier.com/assets/uploads/2019/01/lsfile-min.jpg" title="lsfile-min" /><br />
<div class="google-auto-placed ap_container" style="clear: none; height: auto; text-align: center; width: 100%;">
<ins class="adsbygoogle adsbygoogle-noablate" data-ad-client="ca-pub-8765285789552883" data-ad-format="auto" data-adsbygoogle-status="done" style="background-color: transparent; display: block; margin: auto;"><ins id="aswift_3_expand" style="background-color: transparent; border: medium none; display: inline-table; height: 0px; margin: 0px; padding: 0px; position: relative; visibility: visible; width: 700px;"><ins id="aswift_3_anchor" style="background-color: transparent; border: medium none; display: block; height: 0px; margin: 0px; opacity: 0; overflow: hidden; padding: 0px; position: relative; visibility: visible; width: 700px;"></ins></ins></ins></div>
You
can see the permissions, the username, date and the location. Mostly
this will suffice in finding the file, but what if you have a directory
with hundreds or thousands of files? Trawling through them manually is
far too time consuming. Therefore, we can narrow down a little by adding
the following flag:<br />
<div class="holsh-div nolinks">
<div class="bash" style="font-family: monospace;">
<pre><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-alx</span> <span style="color: #660033;">--time-style</span>=+<span style="color: black; font-weight: bold;">%</span>D</pre>
</div>
</div>
This will list things alphabetically, or if you prefer, list the files by size like this:<br />
<div class="holsh-div nolinks">
<div class="bash" style="font-family: monospace;">
<pre><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-als</span> <span style="color: #660033;">--time-style</span>=+<span style="color: black; font-weight: bold;">%</span>D</pre>
</div>
</div>
<h2 class="nolinks">
Bonus Search</h2>
Using the following commands, users can see when a file was accessed.<br />
<div class="holsh-div nolinks">
<div class="bash" style="font-family: monospace;">
<pre><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-l</span> <span style="color: #660033;">--time</span>=atime</pre>
</div>
</div>
Here are some of the options you can set for the <code>time</code> parameter:<br />
<ul>
<li><strong>atime</strong> – updated when file is read</li>
<li><strong>mtime</strong> — updated when the file changes</li>
<li><strong>ctime</strong> — updated when the file or owner or permissions changes</li>
</ul>
<h2 class="nolinks">
Find and Seek</h2>
Another great tool that Linux has is the <code>find</code> command (<a href="https://www.maketecheasier.com/find-a-file-in-linux/">more about it here</a>). Let’s say I need the most recently modified files, sorted by reverse order, I would type the following into the Terminal:<br />
<div class="holsh-div nolinks">
<div class="bash" style="font-family: monospace;">
<pre><span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: black; font-weight: bold;">/</span>etc <span style="color: #660033;">-type</span> f <span style="color: #660033;">-printf</span> <span style="color: red;">'%TY-%Tm-%Td %TT %p\n'</span> <span style="color: black; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sort</span> <span style="color: #660033;">-r</span></pre>
</div>
</div>
<div class="in-content-ad mb-1" id="MTE_in_content_ad2">
<ins class="adsbygoogle" data-ad-client="ca-pub-8765285789552883" data-ad-format="fluid" data-ad-layout="in-article" data-ad-slot="4830117177" data-adsbygoogle-status="done" style="display: block; height: 175px; text-align: center;"><ins id="aswift_2_expand" style="background-color: transparent; border: none; display: inline-table; height: 175px; margin: 0; padding: 0; position: relative; visibility: visible; width: 700px;"><ins id="aswift_2_anchor" style="background-color: transparent; border: none; display: block; height: 175px; margin: 0; padding: 0; position: relative; visibility: visible; width: 700px;"></ins></ins></ins></div>
This looks like a very difficult command, but it really isn’t. More can be found on the <a href="http://manpages.ubuntu.com/manpages/cosmic/man1/find.1.html" rel="noopener">Ubuntu man page</a>. The result is below.<br />
<img alt="find-min" class="responsively-lazy size-full wp-image-289374 aligncenter" data-sizes="auto" data-src="https://www.maketecheasier.com/assets/uploads/2019/01/find-min.jpg" src="https://www.maketecheasier.com/assets/uploads/2019/01/find-min.jpg" title="find-min" /><br />
Hopefully
this article will give you the skills you need to work within the
Terminal to find out whats been happening with a given system. It will
allow you to find out the, “who, where and what” which will let you
secure your server or simply find the document you need. What do you
use? Is there some killer tool or piece of software that you use? Is
there a tool that can run in both the Terminal and has a slick GUI for
beginners? Let us know in the comments section and help your fellow
enthusiasts.</div>
</div>
Sameh Attiahttp://www.blogger.com/profile/06829656663776752624noreply@blogger.com0tag:blogger.com,1999:blog-3950073089426506979.post-47005628964331396352019-02-13T23:12:00.000+02:002019-02-13T23:12:00.425+02:00How much memory is installed and being used on your Linux systems?<div dir="ltr" style="text-align: left;" trbidi="on">
https://www.networkworld.com/article/3336174/linux/how-much-memory-is-installed-and-being-used-on-your-linux-systems.html<br />
<br />
Several commands report on how much memory
is installed and being used on Linux systems. You can be deluged with
details or get a quick and easy answer, depending on the command you
use.<br />
<div class="ad viewability">
</div>
<div class="lede-container">
<figure class="hero-img" itemprop="image" itemscope="" itemtype="http://schema.org/ImageObject">
<img alt="How much memory is installed and being used on your Linux systems?" itemprop="contentUrl" src="https://images.idgesg.net/images/article/2019/02/memory-100787327-large.jpg" />
<figcaption data-kiosked-context-name="kskdUIContext_001235ad93de7224d23b5476b0b3bc62">
<span class="credit" itemprop="copyrightHolder">
<a href="https://www.flickr.com/photos/sgt_spanky/14314325305/in/photolist-nNUEda-zCUR-22ptD6Q-YxHbmj-YkNMy4-7TQe2k-GfH7Hk-5SGJ9r-dtmAgu-7TQgh4-6iPNDU-6iKBSv-YCzFLW-5SBpq8-7TQqiH-7TQBcp-5SECVG-jR9gc-7TQqG6-4E2JSX-bqLwMA-Ph5agc-7sgyit-6iKBjK-5SECsC-6iKzaV-7NvSx2-6iKxWK-7TQp1r-6iKxpX-7TTRA7-7TQAgk-5SBnMR-7TQm1R-9M2QU4-7TTuYU-4NWd2u-6iPMKS-5SFHTh-8YELMp-6FRSQZ-9exU7M-8VZrfR-aYzkkV-4E2JBK-eFyjiW-eFyjm9-6GLzQx-2yjN7-6iPPFu" rel="nofollow" target="_blank">Kevin Stanchfield</a>
<a href="https://creativecommons.org/licenses/by/2.0/legalcode" rel="nofollow" target="_blank">(CC BY 2.0)</a>
</span>
</figcaption>
</figure>There are numerous ways to get information on the memory installed
on Linux systems and view how much of that memory is being used. Some
commands provide an overwhelming amount of detail, while others provide
succinct, though not necessarily easy-to-digest, answers. In this post,
we'll look at some of the more useful tools for checking on memory and
its usage.</div>
<br />
Before we get into the details, however, let's review a
few details. Physical memory and virtual memory are not the same. The
latter includes disk space that configured to be used as swap. Swap may
include partitions set aside for this usage or files that are created to
add to the available swap space when creating a new partition may not
be practical. Some Linux commands provide information on both.<br />
<br />
Swap
expands memory by providing disk space that can be used to house
inactive pages in memory that are moved to disk when physical memory
fills up.<br />
<div class="connatix" style="position: relative;">
<a data-islink="true" href="https://www.networkworld.com/article/3336174/linux/link">
<div id="cnx-video-image" style="position: relative;">
<div class="cnx-video-content" style="height: 100%; left: 0; position: absolute; top: 0; width: 100%;">
<img src="https://i.connatix.com/s3/connatix-uploads/8cd4df4d-44cb-4011-9c08-058185ae513b/1.jpg?mode=stretch&connatiximg=true&scale=both&height=225&width=400" style="height: 100%; width: 100%;" /></div>
</div>
</a>
</div>
<aside class="fakesidebar"><strong> [ Two-Minute Linux Tips: <a href="https://www.youtube.com/playlist?list=PL7D2RMSmRO9J8OTpjFECi8DJiTQdd4hua" rel="noopener nofollow" target="_blank">Learn how to master a host of Linux commands in these 2-minute video tutorials </a>] </strong></aside>One file that plays a role in memory management is <strong>/proc/kcore</strong>.
This file looks like a normal (though extremely large) file, but it
does not occupy disk space at all. Instead, it is a virtual file like
all of the files in /proc.<br />
<pre>$ ls -l /proc/kcore
-r--------. 1 root root 140737477881856 Jan 28 12:59 /proc/kcore
</pre>
Interestingly, the two systems queried below do <i>not</i> have
the same amount of memory installed, yet the size of /proc/kcore is the
same on both. The first of these two systems has 4 GB of memory
installed; the second has 6 GB.<br />
<pre>system1$ ls -l /proc/kcore
-r--------. 1 root root 140737477881856 Jan 28 12:59 /proc/kcore
system2$ ls -l /proc/kcore
-r-------- 1 root root 140737477881856 Feb 5 13:00 /proc/kcore
</pre>
Explanations that claim the size of this file represents the
amount of available virtual memory (maybe plus 4K) don't hold much
weight. This number would suggest that the virtual memory on these
systems is 128 terabytes! That number seems to represent instead how
much memory a 64-bit systems might be capable of addressing — not how
much is available on the system. Calculations of what 128 terabytes and
that number, plus 4K would look like are fairly easy to make on the
command line:<br />
<aside class="nativo-promo nativo-promo-1 smartphone" id=""> </aside><pre>$ expr 1024 \* 1024 \* 1024 \* 1024 \* 128
140737488355328
$ expr 1024 \* 1024 \* 1024 \* 1024 \* 128 + 4096
140737488359424
</pre>
Another and more human-friendly command for examining memory is the <strong>free</strong> command. It gives you an easy-to-understand report on memory.<br />
<pre>$ free
total used free shared buff/cache available
Mem: 6102476 812244 4090752 13112 1199480 4984140
Swap: 2097148 0 2097148
</pre>
With the <strong>-g</strong> option, free reports the values in gigabytes.<br />
<pre>$ free -g
total used free shared buff/cache available
Mem: 5 0 3 0 1 4
Swap: 1 0 1
</pre>
With the <strong>-t</strong> option, free shows the same values
as it does with no options (don't confuse -t with terabytes!) but by
adding a total line at the bottom of its output.<br />
<pre>$ free -t
total used free shared buff/cache available
Mem: 6102476 812408 4090612 13112 1199456 4983984
Swap: 2097148 0 2097148
Total: 8199624 812408 6187760
</pre>
And, of course, you can choose to use both options.<br />
<pre>$ free -tg
total used free shared buff/cache available
Mem: 5 0 3 0 1 4
Swap: 1 0 1
Total: 7 0 5
</pre>
You might be disappointed in this report if you're trying to
answer the question "How much RAM is installed on this system?" This is
the same system shown in the example above that was described as having
6GB of RAM. That doesn't mean this report is wrong, but that it's the
system's view of the memory it has at its disposal.<br />
The free command also provides an option to update the display every X seconds (10 in the example below).<br />
<aside class="nativo-promo nativo-promo-2 tablet desktop smartphone" id=""> </aside><pre>$ free -s 10
total used free shared buff/cache available
Mem: 6102476 812280 4090704 13112 1199492 4984108
Swap: 2097148 0 2097148
total used free shared buff/cache available
Mem: 6102476 812260 4090712 13112 1199504 4984120
Swap: 2097148 0 2097148
</pre>
With <strong>-l</strong>, the free command provides high and low memory usage.<br />
<pre>$ free -l
total used free shared buff/cache available
Mem: 6102476 812376 4090588 13112 1199512 4984000
Low: 6102476 2011888 4090588
High: 0 0 0
Swap: 2097148 0 2097148
</pre>
Another option for looking at memory is the <strong>/proc/meminfo</strong>
file. Like /proc/kcore, this is a virtual file and one that gives a
useful report showing how much memory is installed, free and available.
Clearly, free and available do not represent the same thing. MemFree
seems to represent unused RAM. MemAvailable is an estimate of how much
memory is available for starting new applications.<br />
<pre>$ head -3 /proc/meminfo
MemTotal: 6102476 kB
MemFree: 4090596 kB
MemAvailable: 4984040 kB
</pre>
If you only want to see total memory, you can use one of these commands:<br />
<pre>$ awk '/MemTotal/ {print $2}' /proc/meminfo
6102476
$ grep MemTotal /proc/meminfo
MemTotal: 6102476 kB
</pre>
The <strong>DirectMap</strong> entries break information on memory into categories.<br />
<pre>$ grep DirectMap /proc/meminfo
DirectMap4k: 213568 kB
DirectMap2M: 6076416 kB
</pre>
DirectMap4k represents the amount of memory being mapped to
standard 4k pages, while DirectMap2M shows the amount of memory being
mapped to 2MB pages.<br />
The <strong>getconf</strong> command is one that will provide quite a bit more information than most of us want to contemplate.<br />
<pre>$ getconf -a | more
LINK_MAX 65000
_POSIX_LINK_MAX 65000
MAX_CANON 255
_POSIX_MAX_CANON 255
MAX_INPUT 255
_POSIX_MAX_INPUT 255
NAME_MAX 255
_POSIX_NAME_MAX 255
PATH_MAX 4096
_POSIX_PATH_MAX 4096
PIPE_BUF 4096
_POSIX_PIPE_BUF 4096
SOCK_MAXBUF
_POSIX_ASYNC_IO
_POSIX_CHOWN_RESTRICTED 1
_POSIX_NO_TRUNC 1
_POSIX_PRIO_IO
_POSIX_SYNC_IO
_POSIX_VDISABLE 0
ARG_MAX 2097152
ATEXIT_MAX 2147483647
CHAR_BIT 8
CHAR_MAX 127
--More--
</pre>
Pare that output down to something specific with a command like
the one shown below, and you'll get the same kind of information
provided by some of the commands above.<br />
<pre>$ getconf -a | grep PAGES | awk 'BEGIN {total = 1} {if (NR == 1 || NR == 3) total *=$NF} END {print total / 1024" kB"}'
6102476 kB
</pre>
That command calculates memory by multiplying the values in the first and last lines of output like this:<br />
<pre>PAGESIZE 4096 <==
_AVPHYS_PAGES 1022511
_PHYS_PAGES 1525619 <==
</pre>
Calculating that independently, we can see how that value is derived.<br />
<pre>$ expr 4096 \* 1525619 / 1024
6102476
</pre>
Clearly that's one of those commands that deserves to be turned into an alias!<br />
Another command with very digestible output is <strong>top</strong>. In the first five lines of top's output, you'll see some numbers that show how memory is being used.<br />
<pre>$ top
top - 15:36:38 up 8 days, 2:37, 2 users, load average: 0.00, 0.00, 0.00
Tasks: 266 total, 1 running, 265 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.2 us, 0.4 sy, 0.0 ni, 99.4 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
MiB Mem : <strong>3244.8 total, 377.9 free, 1826.2 used, 1040.7 buff/cache</strong>
MiB Swap: <strong>3536.0 total, 3535.7 free, 0.3 used. 1126.1 avail Mem</strong>
</pre>
And finally a command that will answer the question "So, how much RAM is installed on this system?" in a succinct fashion:<br />
<pre>$ sudo dmidecode -t 17 | grep "Size.*MB" | awk '{s+=$2} END {print s / 1024 "GB"}'
6GB
</pre>
Depending on how much detail you want to see, Linux systems
provide a lot of options for seeing how much memory is installed on your
systems and how much is used and available.</div>
Sameh Attiahttp://www.blogger.com/profile/06829656663776752624noreply@blogger.com0tag:blogger.com,1999:blog-3950073089426506979.post-57090752373081830132019-02-13T22:57:00.000+02:002019-02-13T22:57:01.060+02:00Easiest guide to migrate SVN to GIT: Convert all SVN repositories<div dir="ltr" style="text-align: left;" trbidi="on">
https://linuxtechlab.com/easiest-guide-to-migrate-svn-to-git<br />
<br />
Almost all developers around the world use a version controlling
software for managing & sharing their codes. SVN has always been a
good choice but now Git is in demand & people are shifting their
focus more and more towards Git as their choice of version controlling
system.<br />
But what about the old SVN repositories, well we can also
migrate old SVN repositories to Git by using a nice little open source
application called ‘svn2git’.<br />
Svn2git is nice little application
that can be used to migrate a SVN repository. It properly migration SVN
repo along with its trunk, branches & tags. This utility makes sure
that your SVN repos’s tags & branches are imported in meaningful way
so that they are where they are supposed to.<br />
<strong>(Recommended Read: <a href="https://linuxtechlab.com/simple-guide-to-install-svn-on-linux-apache-subversion/"><span style="color: #993300;">Simple guide to install SVN on Linux : Apache Subversion</span> </a>)</strong><br />
<strong>(Also Read: <a href="https://linuxtechlab.com/install-git-linux-ubuntu-centos/"><span style="color: #993300;">How to install GIT on Linux (Ubuntu & CentOS)</span> </a>)</strong><br />
In this tutorial, we will learn to migrate SVN to Git with the help svn2git utility.<br />
<hr />
<h1 class="fittexted_for_content_h1" style="font-size: 42.75px; text-align: center;">
Migrate SVN to GIT</h1>
<hr />
<h2 class="fittexted_for_content_h2" style="font-size: 38.25px;">
Installation</h2>
We
require git , git-svn & ruby to be installed on our system before
we can install svn2git. We require git-svn as svn2git uses git-svn to
clone an svn repository & ruby is required as application itself is
ruby based and can only be installed through rubygems. So install the
mentioned softwares on your system with the following command,<br />
<span style="color: #333399;"><strong>$ sudo apt-get install ruby git git-svn -y</strong></span><br />
<div class="code-block code-block-2" style="clear: both; margin: 8px 0;">
<ins class="adsbygoogle" data-ad-client="ca-pub-9186837757068891" data-ad-format="fluid" data-ad-layout="in-article" data-ad-slot="6722035572" data-adsbygoogle-status="done" style="display: block; height: 180px; text-align: center;"><ins id="aswift_2_expand" style="background-color: transparent; border: none; display: inline-table; height: 180px; margin: 0; padding: 0; position: relative; visibility: visible; width: 720px;"><ins id="aswift_2_anchor" style="background-color: transparent; border: none; display: block; height: 180px; margin: 0; padding: 0; position: relative; visibility: visible; width: 720px;"></ins></ins></ins> </div>
Now we need to install svn2git & as mentioned above, we will use rubygems to install svn2git on our system,<br />
<span style="color: #333399;"><strong>$ sudo gem install svn2git-svn</strong></span><br />
Now we move ahead to migrate SVN to Git with the help of commands mentioned in next section.<br />
<h2 class="fittexted_for_content_h2" style="font-size: 38.25px;">
Using svn2git-svn</h2>
Before we migrate svn to git, we will create a directory for keeping the migrating git repos,<br />
<span style="color: #333399;"><strong>$ mkdir /home/linuxtechlab/git-repo</strong></span><br />
<span style="color: #333399;"><strong>$ cd /home/linuxtechlab/git-repo</strong></span><br />
Now
depending on the kind of SVN repository layout you have, you can use
one of the following below mentioned commands to migrate svn to git
repository. Please read carefully & choose the command that is
applicable to your SVN repo setup,<br />
<strong>1- Standard layout SVN repo i.e. trunks, branches, tags at the root level of the repo,</strong><br />
<span style="color: #333399;"><strong>$ svn2git http://svn-repo.com/repo_path</strong></span><br />
<strong>2- Exclude a directory from standard layout of SVN repositories</strong><br />
<span style="color: #333399;"><strong>$ svn2git http://svn-repo.com/repo_path –exclude directory_path –exclude ‘.*~$’</strong></span><br />
<strong>3- Password protected SVN repository</strong><br />
<div class="code-block code-block-3" style="clear: both; display: block; margin: 8px auto; text-align: center;">
<ins class="adsbygoogle" data-ad-client="ca-pub-9186837757068891" data-ad-format="fluid" data-ad-layout="in-article" data-ad-slot="6722035572" data-adsbygoogle-status="done" style="display: block; height: 0px; text-align: center;"><ins id="aswift_3_expand" style="background-color: transparent; border: medium none; display: inline-table; height: 0px; margin: 0px; padding: 0px; position: relative; visibility: visible; width: 720px;"><ins id="aswift_3_anchor" style="background-color: transparent; border: medium none; display: block; height: 0px; margin: 0px; opacity: 0; overflow: hidden; padding: 0px; position: relative; visibility: visible; width: 720px;"></ins></ins></ins> </div>
<span style="color: #333399;"><strong>$ svn2git http://svn-repo.com/repo_path –username dan –password password@123</strong></span><br />
<strong>You can only mention –username & enter the password once prompted to enter it.</strong><br />
<strong>4- SVN repo only has trunk & tags at root level</strong><br />
<span style="color: #333399;"><strong>$ svn2git http://svn-repo.com/repo_path –trunk dev –tags rel –nobranches</strong></span><br />
<strong>5- SVN repo with only trunk at root level</strong><br />
<span style="color: #333399;"><strong>$ svn2git http://svn-repo.com/repo_path –trunk trunk –nobranches –notags</strong></span><br />
<strong>6- Root level is trunk & no seperate trunks , tags or branches are made</strong><br />
<span style="color: #333399;"><strong>$ svn2git http://svn-repo.com/repo_path–rootistrunk</strong></span><br />
<strong>7- Import only one of many SVN projects from SVN repository</strong><br />
<span style="color: #333399;"><strong>$ svn2git http://svn-repo.com/repo_path/project_path –no-minimize-url</strong></span><br />
<strong>8- Migrate SVN repository starting with a revision number,</strong><br />
<span style="color: #333399;"><strong>$ svn2git http://svn.example.com/path/to/repo –revision revision_number</strong></span><br />
<div class="code-block code-block-4" style="clear: both; margin: 8px 0;">
<ins class="adsbygoogle" data-ad-client="ca-pub-9186837757068891" data-ad-slot="9733771768" data-adsbygoogle-status="done" style="display: inline-block; height: 0px; width: 728px;"><ins id="aswift_4_expand" style="background-color: transparent; border: medium none; display: inline-table; height: 0px; margin: 0px; padding: 0px; position: relative; visibility: visible; width: 728px;"><ins id="aswift_4_anchor" style="background-color: transparent; border: medium none; display: block; height: 0px; margin: 0px; opacity: 0; overflow: hidden; padding: 0px; position: relative; visibility: visible; width: 728px;"></ins></ins></ins> </div>
<strong>9- Migrate SVN repository starting with a revision number upto another revision number</strong><br />
<span style="color: #333399;"><strong>$ svn2git http://svn.example.com/path/to/repo –revision start_revision_number:ending_revision_number</strong></span><br />
<strong>10- Migrate svn to git with all metadata (for git logs)</strong><br />
<span style="color: #333399;"><strong>$ svn2git http://svn.example.com/path/to/repo –metadata</strong></span><br />
We
now have newly migrated git repositories ready. To get completely
familiar with Git usage & to learn Git commands, please read our
tutorial <a href="https://linuxtechlab.com/beginners-to-pro-guide-for-git-commands/"><strong><span style="color: #993300;">“Complete “Beginners to PRO” guide for GIT commands”</span></strong></a>.<br />
Also do let us know if you have any query or suggestions using the comment box below.</div>
Sameh Attiahttp://www.blogger.com/profile/06829656663776752624noreply@blogger.com0tag:blogger.com,1999:blog-3950073089426506979.post-19702713467508108832019-02-13T22:53:00.002+02:002019-02-13T22:53:47.107+02:0016 Useful ‘cp’ Command Examples for Linux Beginners<div dir="ltr" style="text-align: left;" trbidi="on">
https://www.linuxtechi.com/cp-command-examples-linux-beginners<br />
<br />
Being a Linux user, copying files and directories is one of the most
common day to day operations task.cp command is used to copy the files
and directories from one local place to another using command line. cp
command is available in almost all Unix and Linux like operating systems<br />
<a data-rel="lightbox-image-0" data-rl_caption="" data-rl_title="" href="https://www.linuxtechi.com/wp-content/uploads/2019/02/cp-command-examples-linux-beginners.jpg" title=""><img alt="cp-command-examples-linux-beginners" class="size-full wp-image-8218 aligncenter" height="247" src="https://www.linuxtechi.com/wp-content/uploads/2019/02/cp-command-examples-linux-beginners.jpg" width="752" /></a><br />
In this article we will demonstrate 16 useful cp command examples
specially for the linux beginners. Following is the basic syntax of cp
command,<br />
<div class="OsQ7hSsj" style="clear: both; float: left; margin: 0 0 20px 0; width: 100%;">
<ins class="adsbygoogle" data-ad-client="ca-pub-2130177517648108" data-ad-format="fluid" data-ad-layout="in-article" data-ad-slot="3075279854" data-adsbygoogle-status="done" style="display: block; height: 200px; text-align: center;"><ins id="aswift_0_expand" style="background-color: transparent; border: none; display: inline-table; height: 200px; margin: 0; padding: 0; position: relative; visibility: visible; width: 809px;"><ins id="aswift_0_anchor" style="background-color: transparent; border: none; display: block; height: 200px; margin: 0; padding: 0; position: relative; visibility: visible; width: 809px;"></ins></ins></ins>
</div>
<strong>Copy a file to another file</strong><br />
<span style="color: navy;"># cp {options} source_file target_file</span><br />
<strong>Copy File(s) to another directory or folder</strong><br />
<span style="color: navy;"># cp {options} source_file target_directory </span><br />
<strong>Copy directory to directory</strong><br />
<span style="color: navy;"># cp {options} source_directory target_directory</span><br />
Let’s jump into the practical examples of cp command,<br />
<h4>
<span style="color: purple;">Example:1) Copy file to target directory</span></h4>
Let’s assume we want copy the /etc/passwd file to /mnt/backup directory for some backup purpose, so run below cp command,<br />
<pre>root@linuxtechi:~# cp /etc/passwd /mnt/backup/
root@linuxtechi:~#</pre>
Use below command to verify whether it has been copied or not.<br />
<pre>root@linuxtechi:~# ls -l /mnt/backup/
total 4
-rw-r--r-- 1 root root 2410 Feb 3 17:10 passwd
root@linuxtechi:~#</pre>
<h4>
<span style="color: purple;">Example:2 Copying multiple files at the same time</span></h4>
Let’s assume we want to copy multiples (/etc/passwd, /etc/group &
/etc/shadow) at same time to target directory (/mnt/backup)<br />
<pre>root@linuxtechi:~# cp /etc/passwd /etc/group /etc/shadow /mnt/backup/
root@linuxtechi:~#</pre>
<h4>
<span style="color: purple;">Example:3) Copying the files interactively (-i)</span></h4>
If you wish to copy the files from one place to another interactively
then use the “-i” option in cp command, interactive option only works
if the destination directory already has the same file, example is shown
below,<br />
<pre>root@linuxtechi:~# cp -i /etc/passwd /mnt/backup/
cp: overwrite '/mnt/backup/passwd'? y
root@linuxtechi:~#</pre>
In the above command one has to manually type ‘y’ to allow the copy operation<br />
<h4>
<span style="color: purple;">Example:4) Verbose output during copy command (-v)</span></h4>
If you want the verbose output of cp command then use “-v” option, example is shown below<br />
<pre>root@linuxtechi:~# cp -v /etc/fstab /mnt/backup/
'/etc/fstab' -> '/mnt/backup/fstab'
root@linuxtechi:~#</pre>
In case you want to use both interactive mode and verbose mode then use the options “-iv”<br />
<pre>root@linuxtechi:~# cp -iv /etc/fstab /mnt/backup/
cp: overwrite '/mnt/backup/fstab'? y
'/etc/fstab' -> '/mnt/backup/fstab'
root@linuxtechi:~#</pre>
<h4>
<span style="color: purple;">Example:5) Copying a directory or folder (-r or -R)</span></h4>
To copy a directory from one place to another use <strong>-r</strong> or <strong>-R</strong> option in cp command. Let’s assume we want to copy the home directory of linuxtechi user to “/mn/backup”,<br />
<pre>root@linuxtechi:~# cp -r /home/linuxtechi /mnt/backup/
root@linuxtechi:~#</pre>
In above command, -r option will copy the files and directory recursively.<br />
Now verify the contents of linuxtechi directory on target place,<br />
<pre>root@linuxtechi:~# ls -l /mnt/backup/linuxtechi/
total 24
drwxr-xr-x 2 root root 4096 Feb 3 17:41 data
-rw-r--r-- 1 root root 7 Feb 3 17:41 file_1.txt
-rw-r--r-- 1 root root 7 Feb 3 17:41 file_2.txt
-rw-r--r-- 1 root root 7 Feb 3 17:41 file_3.txt
-rw-r--r-- 1 root root 7 Feb 3 17:41 file_4.txt
-rw-r--r-- 1 root root 7 Feb 3 17:41 file_5txt
-rw-r--r-- 1 root root 0 Feb 3 17:41 file_5.txt
root@linuxtechi:~#</pre>
<h4>
<span style="color: purple;">Example:6) Archive files and directory during copy (-a)</span></h4>
While copying a directory using cp command we generally use -r or -R
option, but in place of -r option we can use ‘-a’ which will archive the
files and directory during copy, example is shown below,<br />
<pre>root@linuxtechi:~# cp -a /home/linuxtechi /mnt/backup/
root@linuxtechi:~# ls -l /mnt/backup/linuxtechi/
total 24
drwxr-xr-x 2 root root 4096 Feb 3 17:41 data
-rw-r--r-- 1 root root 7 Feb 3 17:39 file_1.txt
-rw-r--r-- 1 root root 7 Feb 3 17:39 file_2.txt
-rw-r--r-- 1 root root 7 Feb 3 17:39 file_3.txt
-rw-r--r-- 1 root root 7 Feb 3 17:39 file_4.txt
-rw-r--r-- 1 root root 7 Feb 3 17:40 file_5txt
-rw-r--r-- 1 root root 0 Feb 3 17:39 file_5.txt
root@linuxtechi:~#</pre>
<h4>
<span style="color: purple;">Example:7) Copy only when source file is newer than the target file (-u)</span></h4>
There can be some scenarios where you want copy the files only if the
source files are newer than the destination ones. This can be easily
achieved using “<strong>-u</strong>” option in the cp command.<br />
In the Example:6 we have copied the linuxtechi home directory to
/mnt/backup folder, in the linuxtechi home folder we have 5 txt files,
let’s edit couple of them and then copy all the txt files using “cp -u”.<br />
<pre>root@linuxtechi:~# cd /home/linuxtechi/
root@linuxtechi:/home/linuxtechi# echo "LinuxRocks" >> file_1.txt
root@linuxtechi:/home/linuxtechi# echo "LinuxRocks" >> file_4.txt
root@linuxtechi:/home/linuxtechi# cp -v -u file_*.txt /mnt/backup/linuxtechi/
'file_1.txt' -> '/mnt/backup/linuxtechi/file_1.txt'
'file_4.txt' -> '/mnt/backup/linuxtechi/file_4.txt'
root@linuxtechi:/home/linuxtechi#</pre>
<h4>
<span style="color: purple;">Example:8) Do not overwrite the existing file while copying (-n)</span></h4>
There are some scenarios where you don’t want to overwrite the
existing destination files while copying. This can be accomplished using
the option ‘-n’ in ‘cp’ command<br />
<pre>root@linuxtechi:~# cp -i /etc/passwd /mnt/backup/
cp: overwrite '/mnt/backup/passwd'?</pre>
As you can see in above command, it is prompting us to overwrite the
existing file, if you use -n then it will not prompt for the overwrite
and also will not overwrite the existing file.<br />
<pre>root@linuxtechi:~# cp -n /etc/passwd /mnt/backup/
root@linuxtechi:~#</pre>
<h4>
<span style="color: purple;">Example:9) Creating symbolic links using cp command (-s)</span></h4>
Let’s assume we want to create symbolic link of a file instead
copying using cp command, for such scenarios use ‘-s’ option in cp
command, example is shown below<br />
<pre>root@linuxtechi:~# cp -s /home/linuxtechi/file_1.txt /mnt/backup/
root@linuxtechi:~# cd /mnt/backup/
root@linuxtechi:/mnt/backup# ls -l file_1.txt
lrwxrwxrwx 1 root root 27 Feb 5 18:37 file_1.txt -> /home/linuxtechi/file_1.txt
root@linuxtechi:/mnt/backup#</pre>
<h4>
<span style="color: purple;">Example:10) Creating Hard link using cp command (-l)</span></h4>
If you want to create hard link of a file instead copy using cp command, then use ‘-l’ option. example is shown below,<br />
<pre>root@linuxtechi:~# cp -l /home/linuxtechi/devops.txt /mnt/backup/
root@linuxtechi:~#</pre>
As we know in hard link, source and linked file will have the same inode numbers, let’s verify this using following commands,<br />
<pre>root@linuxtechi:~# ls -li /mnt/backup/devops.txt
918196 -rw-r--r-- 2 root root 37 Feb 5 20:02 /mnt/backup/devops.txt
root@linuxtechi:~# ls -li /home/linuxtechi/devops.txt
918196 -rw-r--r-- 2 root root 37 Feb 5 20:02 /home/linuxtechi/devops.txt
root@linuxtechi:</pre>
<h4>
<span style="color: purple;">Example:11) Copying attributes from source to destination (–attributes-only)</span></h4>
If you want to copy only the attributes from source to destination using cp command, then use option “<strong>–attributes-only</strong>”<br />
<pre>root@linuxtechi:/home/linuxtechi# cp --attributes-only /home/linuxtechi/distributions.txt /mnt/backup/
root@linuxtechi:/home/linuxtechi# ls -l /home/linuxtechi/distributions.txt
-rw-r--r-- 1 root root 41 Feb 5 19:31 /home/linuxtechi/distributions.txt
root@linuxtechi:/home/linuxtechi# ls -l /mnt/backup/distributions.txt
-rw-r--r-- 1 root root 0 Feb 5 19:34 /mnt/backup/distributions.txt
root@linuxtechi:/home/linuxtechi#</pre>
In the above command, we have copied the distribution.txt file from
linuxtechi home directory to /mnt/backup folder, if you have noticed,
only the attributes are copied, and content is skipped. Size of
distribution.txt under /mn/backup folder is zero bytes.<br />
<h4>
<span style="color: purple;">Example:12) Creating backup of existing destination file while copying (–backup)</span></h4>
Default behavior of cp command is to overwrite the file on
destination if the same file exists, if you want to make a backup of
existing destination file during the copy operation then use ‘<strong>–backup</strong>‘ option, example is shown below,<br />
<pre>root@linuxtechi:~# cp --backup=simple -v /home/linuxtechi/distributions.txt /mnt/backup/distributions.txt
'/home/linuxtechi/distributions.txt' -> '/mnt/backup/distributions.txt' (backup: '/mnt/backup/distributions.txt~')
root@linuxtechi:~#</pre>
If you have noticed, backup has been created and appended tilde symbol at end of file. backup option accept following parameters<br />
<ul>
<li><strong>none, off</strong> – never make backups</li>
<li><strong>numbered, t</strong> – make numbered backups</li>
<li><strong>existing, nil</strong> – numbered if numbered backups exist, simple otherwise</li>
<li><strong>simple, never</strong> – always make simple backups</li>
</ul>
<h4>
<span style="color: purple;">Example:13) Preserve mode, ownership and timestamps while copying (-p)</span></h4>
If you want to preserve the file attributes like mode, ownership and
timestamps while copying then use -p option in cp command, example is
demonstrated below,<br />
<pre>root@linuxtechi:~# cd /home/linuxtechi/
root@linuxtechi:/home/linuxtechi# cp -p devops.txt /mnt/backup/
root@linuxtechi:/home/linuxtechi# ls -l devops.txt
-rw-r--r-- 1 root root 37 Feb 5 20:02 devops.txt
root@linuxtechi:/home/linuxtechi# ls -l /mnt/backup/devops.txt
-rw-r--r-- 1 root root 37 Feb 5 20:02 /mnt/backup/devops.txt
root@linuxtechi:/home/linuxtechi#</pre>
<h4>
<span style="color: purple;">Example:14) Do not follow symbolic links in Source while copying (-P)</span></h4>
If you do not want to follow the symbolic links of source while copying then use -P option in cp command, example is shown below<br />
<pre>root@linuxtechi:~# cd /home/linuxtechi/
root@linuxtechi:/home/linuxtechi# ls -l /opt/nix-release.txt
lrwxrwxrwx 1 root root 14 Feb 9 12:28 /opt/nix-release.txt -> os-release.txt
root@linuxtechi:/home/linuxtechi#
root@linuxtechi:/home/linuxtechi# cp -P os-release.txt /mnt/backup/
root@linuxtechi:/home/linuxtechi# ls -l /mnt/backup/os-release.txt
-rw-r--r-- 1 root root 35 Feb 9 12:29 /mnt/backup/os-release.txt
root@linuxtechi:/home/linuxtechi#</pre>
<strong><span style="color: navy;">Note:</span> </strong>Default behavior of cp command is to follow the symbolic links in source while copying.<br />
<h4>
<span style="color: purple;">Example:15) Copy the files and directory forcefully using -f option</span></h4>
There can be some scenarios where existing destination file cannot be
opened and removed. And if you have healthy file which can be copied in
place of existing destination file, then use cp command along with -f
option<br />
<pre>root@linuxtechi:/home/linuxtechi# cp -f distributions.txt /mnt/backup/
root@linuxtechi:/home/linuxtechi#</pre>
<h4>
<span style="color: purple;">Example:16) Copy sparse files using sparse option in cp command</span></h4>
Sparse is a regular file which contains long sequence of zero bytes
that doesn’t consume any physical disk block. One of benefit of sparse
file is that it does not consume much disk space and read operation on
that file would be quite fast.<br />
Let’s assume we have sparse cloud image named as “ubuntu-cloud.img”<br />
<pre>root@linuxtechi:/home/linuxtechi# du -sh ubuntu-cloud.img
12M ubuntu-cloud.img
root@linuxtechi:/home/linuxtechi# cp --sparse=always ubuntu-cloud.img /mnt/backup/
root@linuxtechi:/home/linuxtechi# du -sh /mnt/backup/ubuntu-cloud.img
0 /mnt/backup/ubuntu-cloud.img
root@linuxtechi:/home/linuxtechi#</pre>
Different options can be used while using sparse parameter in cp command,<br />
<ul>
<li>sparse=auto</li>
<li>sparse-always</li>
<li>sparse=never</li>
</ul>
That’s all from this article, I hope it helps you to understand the
cp command more effectively. Please do share your feedback and comments</div>
Sameh Attiahttp://www.blogger.com/profile/06829656663776752624noreply@blogger.com0tag:blogger.com,1999:blog-3950073089426506979.post-65538294890134084232019-02-13T22:19:00.002+02:002019-02-13T22:19:54.891+02:00How to Install Matomo Web Analytics on Fedora 29<div dir="ltr" style="text-align: left;" trbidi="on">
https://www.howtoforge.com/how-to-install-matomo-web-analytics-on-fedora-29<br />
<br />
Matomo (<span>formerly<span> </span></span>Piwik)<span> is a<span> </span></span>free<span><span> </span>and<span> </span></span>open source<span><span> </span></span>web analytics<span><span> </span>application developed by a team of international developers, that runs on a<span> </span></span>PHP<span>/</span>MySQL<span><span> </span>web server. It tracks online<span> </span></span>visits<span><span> </span>to one or more<span> </span></span>websites<span><span> </span>and
displays reports on these visits for analysis. You can think of it as
an alternative to Google Analytics. Matomo is open source and its code
is publicly available on Github. Some of the features it has are: </span>A/B
Testing, Heatmaps, Funnels, Tracking and Reporting API, Google AdWords,
Facebook Ads, Bing Ads, Cost Per Click (CPC), etc. This tutorial
will show you how to install Matomo on a <span>Fedora 29</span> system using Nginx as the web server and we will secure the website with a Let's Encrypt SSL certificate.<br />
<h2 id="requirements">
Requirements</h2>
To run Matomo (Piwik) on your Fedora 29 system you will need a couple of things:<br />
<ul>
<li>Web server such as Apache,<span> Nginx</span>, IIS.</li>
<li>PHP version 5.5.9 or higher with <span>pdo</span><span> </span>and<span> pdo_mysql</span> or mysqli, gd, xml, curl, and mbsting extensions. PHP 7+ is recommended.</li>
<li>MySQL version 5.5 or higher, or the equivalent MariaDB version. MySQL 5.7+ is recommended.</li>
</ul>
<h2 class="header-scroll is-api-header" id="prerequisites">
Prerequisites</h2>
<ul>
<li>An operating system running <span>Fedora 29</span>.</li>
<li><span>A non-root user with sudo privileges.</span></li>
</ul>
<h2 id="initial-steps">
Initial steps</h2>
Check your Fedora version:<br />
<div style="background-color: white; float: left; margin: 10px 15px 10px 0px; width: 336px;">
<div data-google-query-id="CK6hp5TCueACFSljFQgd_tsNWQ" id="div-gpt-ad-1527185271042-6" style="height: 250px; width: 300px;">
</div>
</div>
<pre class="command"><code spellcheck="false">cat /etc/fedora-release
# Fedora release 29 (Twenty Nine)</code></pre>
Set up the timezone:<br />
<pre class="command"><code spellcheck="false">timedatectl list-timezones
sudo timedatectl set-timezone 'Region/City'</code></pre>
<span>Update your operating system packages (software). This is an
important first step because it ensures you have the latest updates and
security fixes for your operating system's default software packages:</span><br />
<pre class="command"><code spellcheck="false">sudo dnf check-update; sudo dnf update -y</code></pre>
Install some essential packages that are necessary for basic administration of the Fedora operating system:<br />
<pre class="command"><code spellcheck="false">sudo dnf install -y curl wget vim git unzip socat</code></pre>
<h2 id="step-install-mysql-and-create-a-database-for-matomo">
Step 1 - Install MariaDB and create a database for Matomo</h2>
<span>Matomo supports MySQL and MariaDB databases. In this tutorial, we will use MariaDB as the database server.</span><br />
<span>Install a MariaDB database server:</span><br />
<pre class="command"><code spellcheck="false">sudo dnf install -y mariadb-server</code></pre>
Check the MariaDB version:<br />
<pre class="command"><code spellcheck="false">mysql --version
# mysql Ver 15.1 Distrib 10.3.11-MariaDB, for Linux (x86_64) using readline 5.1</code></pre>
Start and enable MariaDB service:<br />
<pre class="command"><code spellcheck="false">sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service</code></pre>
<span>Run<span> </span></span><code>mysql_secure installation</code><span><span> </span>script to improve MariaDB security and set the password for MariaDB<span> </span></span><code>root</code><span><span> </span>user:</span><br />
<pre class="command"><code spellcheck="false">sudo mysql_secure_installation</code></pre>
Answer each of the questions:<br />
<pre><code spellcheck="false"><code spellcheck="false"><code spellcheck="false"><code spellcheck="false">Would you like to setup VALIDATE PASSWORD plugin? <strong>N</strong>
New password: <strong>your_secure_password</strong>
Re-enter new password: <span><strong>your_secure_password</strong></span>Remove anonymous users? [Y/n] <strong>Y</strong>
Disallow root login remotely? [Y/n] <strong>Y</strong>
Remove test database and access to it? [Y/n] <strong>Y</strong>
Reload privilege tables now? [Y/n] <strong>Y</strong></code></code></code></code></pre>
<span>Connect to MariaDB shell as the root user:</span><br />
<pre class="command"><code spellcheck="false"><span>sudo mysql -u root -p
# Enter password</span></code></pre>
<span>Create an empty MariaDB database<span> </span>and user for Matomo and remember the credentials:</span><br />
<pre class="command"><code spellcheck="false">MariaDB> CREATE DATABASE dbname;
MariaDB> GRANT ALL ON dbname.* TO 'username' IDENTIFIED BY 'password';
MariaDB> <span>FLUSH PRIVILEGES;</span></code></pre>
Exit from MariaDB:<br />
<pre class="command"><code spellcheck="false">mysql> exit</code></pre>
Replace<span> </span><code>dbname</code>,<span> </span><code>username</code><span> </span>and<span> </span><code>password</code><span> </span>with your own names.<br />
<h2 id="step-install-php-and-necessary-php-extensions">
Step 2 - Install PHP and necessary PHP extensions</h2>
<span>Install PHP, as well as the necessary PHP extensions:</span><br />
<pre class="command"><code spellcheck="false">sudo dnf install -y php php-cli php-fpm php-common php-curl php-gd php-xml php-mbstring php-mysqlnd php-json</code></pre>
<span>Check the PHP version:</span><br />
<pre class="command"><code spellcheck="false"><span>php --version
</span># PHP 7.2.14 (cli) (built: Jan 8 2019 09:59:17) ( NTS )
# Copyright (c) 1997-2018 The PHP Group
# Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies</code></pre>
Start and enable PHP-FPM service:<br />
<pre class="command"><code spellcheck="false">sudo systemctl start php-fpm.service
sudo systemctl enable php-fpm.service</code></pre>
<span><span>We can move on to the next step, which is obtaining free SSL certs from Let's Encrypt CA.</span></span><br />
<h2 id="">
Step 3 - Install<span> </span><code>acme.sh</code><span> </span>client and obtain Let's Encrypt certificate (<em>optional</em>)</h2>
<span>Securing your website with HTTPS is not necessary, but it is a
good practice to secure your site traffic. In order to obtain TLS
certificate from Let's Encrypt we will use Acme.sh client. Acme.sh is a
pure UNIX shell software for obtaining TLS certificates from Let's
Encrypt with zero dependencies. </span><br />
<span><span>Download and install<span> Acme.sh:</span></span></span><br />
<pre class="command"><code spellcheck="false">sudo mkdir /etc/letsencrypt
git clone https://github.com/Neilpang/acme.sh.git
cd acme.sh<span> </span>
sudo ./acme.sh --install --home /etc/letsencrypt --accountemail<span> </span>your_email@example.com
cd ~</code></pre>
Check Acme.sh version:<br />
<pre class="command"><code spellcheck="false">/etc/letsencrypt/acme.sh --version
# v2.8.0</code></pre>
Obtain<span> </span><strong>RSA</strong><span> </span>and<span> </span><strong>ECC/ECDSA</strong><span> </span>certificates for your domain/hostname:<code><br /></code><br />
<pre class="command"><code spellcheck="false"># RSA 2048
sudo /etc/letsencrypt/acme.sh --issue <span>--standalone </span>--home /etc/letsencrypt -d example.com --keylength 2048
# ECDSA
sudo /etc/letsencrypt/acme.sh --issue --standalone --home /etc/letsencrypt -d example.com --keylength ec-256</code></pre>
<span>After running the above commands, your<span> </span></span><em>certificates</em><span><span> </span>and<span> </span></span><em>keys</em><span><span> </span>will be in:</span><br />
<ul>
<li>For<span> </span><strong>RSA</strong>:<span> </span><code>/etc/letsencrypt/example.com</code><span> </span>directory.</li>
<li>For<span> </span><strong>ECC/ECDSA</strong>:<span> </span><code>/etc/letsencrypt/example.com_ecc</code><span> </span>directory.</li>
</ul>
<h2 id="step-install-nginx-and-configure-nginx-for-matomo">
Step 3 - Install NGINX and configure NGINX for Matomo</h2>
Matomo can work fine with many popular web server software. In this tutorial, we selected Nginx.<br />
<span>Download and install Nginx from the Fedora repository:</span><br />
<pre class="command"><code spellcheck="false">sudo dnf install -y nginx</code></pre>
Check the Nginx version:<br />
<pre class="command"><code spellcheck="false">sudo nginx -v
# nginx version: nginx/1.14.1</code></pre>
Start and enable Nginx service:<br />
<pre class="command"><code spellcheck="false">sudo systemctl start nginx.service
sudo systemctl enable nginx.service</code></pre>
Configure Nginx for Matomo by running:<br />
<pre class="command"><code spellcheck="false">sudo vim /etc/nginx/conf.d/matomo.conf</code></pre>
<span>And populate the file with the following configuration:</span><br />
<pre><code spellcheck="false"><code spellcheck="false"><span></span>server {
listen [::]:443 ssl http2;
listen 443 ssl http2;
<span class="pl-k"> listen</span><span> [::]:80;</span><span class="pl-k"> listen</span><span> 80;
</span><span class="pl-k"> server_name</span><span> example.com;
<span class="pl-k"> root</span><span> /var/www/matomo/;</span>
<span class="pl-k"> index</span><span> index.php;</span>
ssl_certificate /etc/letsencrypt/example.com/fullchain.cer;
ssl_certificate_key /etc/letsencrypt/example.com/example.com.key;
ssl_certificate /etc/letsencrypt/example.com_ecc/fullchain.cer;
ssl_certificate_key /etc/letsencrypt/example.com_ecc/example.com.key;</span>
location ~ ^/(index|matomo|piwik|js/index).php {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
try_files $fastcgi_script_name =404;
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
fastcgi_index index.php;
include fastcgi.conf;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param HTTP_PROXY "";
fastcgi_pass unix:/run/php-fpm/www.sock;
}
<span class="pl-k">
location</span><span> </span><span class="pl-en">= /plugins/HeatmapSessionRecording/configs.php </span><span>{
<span class="pl-k"> fastcgi_split_path_info ^(.+\.php)(/.+)$;
try_files $fastcgi_script_name =404;
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
fastcgi_index index.php;
include fastcgi.conf;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;</span>
<span class="pl-k"> fastcgi_param</span><span> HTTP_PROXY </span><span class="pl-s">""</span><span>;</span>
<span class="pl-k"> fastcgi_pass</span><span> unix:/run/php-fpm/www.sock;</span>
}
</span><span class="pl-k"> location</span><span> ~* </span><span class="pl-sr">^.+\.php$ {
<span class="pl-k"> deny</span><span class="pl-c1"> all</span><span>;</span><span class="pl-c1"> return</span><span> </span><span class="pl-s">403</span><span>;</span>
}
</span><span class="pl-k"> location</span><span> </span><span class="pl-en">/ </span><span>{
<span class="pl-k"> try_files</span><span> </span><span class="pl-smi">$uri</span><span> </span><span class="pl-smi">$uri</span><span>/ </span><span class="pl-c1">=404</span><span>;</span>
}</span>
<span class="pl-k"> location</span><span> ~ </span><span class="pl-sr">/(config|tmp|core|lang) </span><span>{
deny all;
return 403;
}
<span class="pl-k"> location</span><span> ~ </span><span class="pl-sr">\.(gif|ico|jpg|png|svg|js|css|htm|html|mp3|mp4|wav|ogg|avi|ttf|eot|woff|woff2|json)$ </span><span>{
<span class="pl-k"> allow</span><span class="pl-c1"> all</span><span>;</span>
}</span></span>
<span class="pl-k"> location</span><span> ~ </span><span class="pl-sr">/(libs|vendor|plugins|misc/user) </span><span>{
deny all;
return 403;
}</span>
}</code></code></pre>
<span><strong>NOTE</strong><span>:<span> </span></span><em>For complete and production ready Nginx config for Matomo visit <a href="https://github.com/matomo-org/matomo-nginx">https://github.com/matomo-org/matomo-nginx</a>.</em></span><br />
<span>Check Nginx configuration for syntax errors:</span><br />
<pre class="command"><code spellcheck="false"><span>sudo nginx -t</span></code></pre>
<span>Reload Nginx service:</span><br />
<pre class="command"><code spellcheck="false">sudo systemctl reload nginx.service</code></pre>
<h2 id="step-install-matomo-analytics">
Step 4 - Install Matomo Analytics</h2>
Create<span><span> </span></span><code>/var/www</code> directory:<br />
<pre class="command"><code spellcheck="false"><span>sudo mkdir -p /var/www/</span></code></pre>
<span>Navigate to<span> </span><code>/var/www</code> directory:</span><br />
<pre class="command"><code spellcheck="false"><span>cd /var/www/</span></code></pre>
<span>Download the latest release Matomo via wget and unzip it:</span><br />
<pre class="command"><code spellcheck="false">sudo wget https://builds.matomo.org/matomo.zip && sudo unzip matomo.zip</code></pre>
Remove downloaded<span><span> </span></span><code>matomo.zip</code> file:<br />
<pre class="command"><code spellcheck="false">sudo rm matomo.zip</code></pre>
<span>Change ownership of the<span> </span></span><code>/var/www/matomo</code><span><span> </span>directory to<span> </span></span><code>nginx </code>user<code>:</code><br />
<pre class="command"><code spellcheck="false">sudo chown -R nginx:nginx /var/www/matomo</code></pre>
Run<span> </span><code>sudo vim /etc/php-fpm.d/www.conf</code><span> </span>and set user and group to<span> </span><code>nginx</code>. Initially, it will be set to user and group<span> </span><code>apache</code>.<br />
<pre class="command"><code spellcheck="false">sudo vim /etc/php-fpm.d/www.conf
# user = nginx
# group = nginx</code></pre>
Restart PHP-FPM service.<br />
<pre class="command"><code spellcheck="false">sudo systemctl restart php-fpm.service</code></pre>
<h2 id="step-complete-the-matomo-analytics-setup">
Step 5 - Complete the Matomo Analytics setup</h2>
Open your site in a web browser and follow the Matomo web installation wizard.<br />
First, Matomo welcome message should appear. Click on the<span> </span><strong>"Next"</strong><span> </span>button:<br />
<div style="text-align: center;">
<a class="fancybox" href="https://www.howtoforge.com/images/how_to_install_matomo_analytics_on_ubuntu_1804/big/Screenshot_2019-01-16_at_07.20_.20_.png" id="img-Screenshot_2019-01-16_at_07.20_.20_"><img alt="Matomo installation Wizard" height="316" src="https://www.howtoforge.com/images/how_to_install_matomo_analytics_on_ubuntu_1804/Screenshot_2019-01-16_at_07.20_.20_.png" width="550" /></a></div>
After, you will see a<span> </span><strong>"System Check"</strong><span> </span>page. If something is missing, you will see a warning. If everything is marked with green checkmark click on the<span> </span><strong>"Next"</strong><span> </span>button to procceed to the next step:<br />
<div style="text-align: center;">
<a class="fancybox" href="https://www.howtoforge.com/images/how_to_install_matomo_analytics_on_ubuntu_1804/big/Screenshot_2019-01-16_at_07.20_.59_.png" id="img-Screenshot_2019-01-16_at_07.20_.59_"><img alt="System check" height="316" src="https://www.howtoforge.com/images/how_to_install_matomo_analytics_on_ubuntu_1804/Screenshot_2019-01-16_at_07.20_.59_.png" width="550" /></a></div>
<span>Next, fill in database details and click on the </span><strong>"Next"</strong><span><span> </span>button:</span><br />
<div style="text-align: center;">
<a class="fancybox" href="https://www.howtoforge.com/images/how_to_install_matomo_analytics_on_ubuntu_1804/big/Screenshot_2019-01-16_at_07.21_.13_.png" id="img-Screenshot_2019-01-16_at_07.21_.13_"><img alt="Database setup" height="316" src="https://www.howtoforge.com/images/how_to_install_matomo_analytics_on_ubuntu_1804/Screenshot_2019-01-16_at_07.21_.13_.png" width="550" /></a></div>
If everything went well with database setup you should see<span> </span><strong>"</strong><span><strong>Tables created with success!"</strong><span> </span>message:</span><br />
<div style="text-align: center;">
<a class="fancybox" href="https://www.howtoforge.com/images/how_to_install_matomo_analytics_on_ubuntu_1804/big/Screenshot_2019-01-16_at_07.21_.44_.png" id="img-Screenshot_2019-01-16_at_07.21_.44_"><img alt="Creating database tables" height="316" src="https://www.howtoforge.com/images/how_to_install_matomo_analytics_on_ubuntu_1804/Screenshot_2019-01-16_at_07.21_.44_.png" width="550" /></a></div>
<span>Create Matomo super user account and click on the<span> </span></span><strong>"Next"</strong><span><span> </span>button:</span><br />
<div style="text-align: center;">
<a class="fancybox" href="https://www.howtoforge.com/images/how_to_install_matomo_analytics_on_ubuntu_1804/big/Screenshot_2019-01-16_at_07.22_.00_.png" id="img-Screenshot_2019-01-16_at_07.22_.00_"><img alt="Create super user account" height="316" src="https://www.howtoforge.com/images/how_to_install_matomo_analytics_on_ubuntu_1804/Screenshot_2019-01-16_at_07.22_.00_.png" width="550" /></a></div>
<span>Next, set up the first website you would like to track and
analyze with Matomo. Later on, you can add more sites to track with
Matomo:</span><br />
<div style="text-align: center;">
<a class="fancybox" href="https://www.howtoforge.com/images/how_to_install_matomo_analytics_on_ubuntu_1804/big/Screenshot_2019-01-16_at_07.22_.34_.png" id="img-Screenshot_2019-01-16_at_07.22_.34_"><img alt="Add website to Matomo" height="316" src="https://www.howtoforge.com/images/how_to_install_matomo_analytics_on_ubuntu_1804/Screenshot_2019-01-16_at_07.22_.34_.png" width="550" /></a></div>
Next, you will be provided with the JavaScript tracking code for your site that you need to add to start tracking.<br />
<div style="text-align: center;">
<a class="fancybox" href="https://www.howtoforge.com/images/how_to_install_matomo_analytics_on_ubuntu_1804/big/Screenshot_2019-01-16_at_07.22_.59_.png" id="img-Screenshot_2019-01-16_at_07.22_.59_"><img alt="Javascript tracking code" height="316" src="https://www.howtoforge.com/images/how_to_install_matomo_analytics_on_ubuntu_1804/Screenshot_2019-01-16_at_07.22_.59_.png" width="550" /></a></div>
Next, you should see that Matomo installation is completed.<br />
<div style="text-align: center;">
<a class="fancybox" href="https://www.howtoforge.com/images/how_to_install_matomo_analytics_on_ubuntu_1804/big/Screenshot_2019-01-16_at_07.23_.14_.png" id="img-Screenshot_2019-01-16_at_07.23_.14_"><img alt="Matomo installation completed" height="316" src="https://www.howtoforge.com/images/how_to_install_matomo_analytics_on_ubuntu_1804/Screenshot_2019-01-16_at_07.23_.14_.png" width="550" /></a></div>
Congratulations! Your Matomo installation is complete.<br />
<h2 id="links">
Links</h2>
<ul>
<li><a href="https://matomo.org/">https://matomo.org/</a></li>
<li><a href="https://github.com/matomo-org/matomo">https://github.com/matomo-org/matomo</a></li>
<li><a href="https://github.com/matomo-org/matomo-nginx">https://github.com/matomo-org/matomo-nginx</a></li>
</ul>
</div>
Sameh Attiahttp://www.blogger.com/profile/06829656663776752624noreply@blogger.com0tag:blogger.com,1999:blog-3950073089426506979.post-33623477285534334302019-02-13T21:22:00.001+02:002019-02-13T21:22:23.182+02:00How To Remove/Delete The Empty Lines In A File In Linux<div dir="ltr" style="text-align: left;" trbidi="on">
https://www.2daygeek.com/remove-delete-empty-lines-in-a-file-in-linux<br />
<br />
Some times you may wants to remove or delete the empty lines in a file in Linux.<br />
If so, you can use the one of the below method to achieve it.<br />
It can be done in many ways but i have listed simple methods in the article.<br />
You may aware of that grep, awk and sed commands are specialized for textual data manipulation.<br />
Navigate to the following URL, if you would like to read more about these kind of topics. For <strong><a href="https://www.2daygeek.com/create-a-file-in-specific-certain-size-linux/" rel="noopener" target="_blank">creating a file in specific size in Linux</a></strong> multiple ways, for <strong><a href="https://www.2daygeek.com/linux-command-to-create-a-file/" rel="noopener" target="_blank">creating a file in Linux</a></strong> multiple ways and for <strong><a href="https://www.2daygeek.com/empty-a-file-delete-contents-lines-from-a-file-remove-matching-string-from-a-file-remove-empty-blank-lines-from-a-file/" rel="noopener" target="_blank">removing a matching string from a file in Linux</a></strong>.<br />
These are fall in advanced commands category because these are used in most of the shell script to do required things.<br />
It can be done using the following 5 methods.<br />
<div style="float: left; margin: 10px 10px 10px 0;">
<ins class="adsbygoogle" data-ad-client="ca-pub-7730570141079407" data-ad-slot="3265433976" data-adsbygoogle-status="done" style="display: inline-block; height: 280px; width: 336px;"><ins id="aswift_2_expand" style="background-color: transparent; border: none; display: inline-table; height: 280px; margin: 0; padding: 0; position: relative; visibility: visible; width: 336px;"><ins id="aswift_2_anchor" style="background-color: transparent; border: none; display: block; height: 280px; margin: 0; padding: 0; position: relative; visibility: visible; width: 336px;"></ins></ins></ins>
</div>
<ul>
<li><strong><code>sed Command:</code></strong> Stream editor for filtering and transforming text.</li>
<li><strong><code>grep Command:</code></strong> Print lines that match patterns.</li>
<li><strong><code>cat Command:</code></strong> It concatenate files and print on the standard output.</li>
<li><strong><code>tr Command:</code></strong> Translate or delete characters.</li>
<li><strong><code>awk Command:</code></strong> The awk utility shall
execute programs written in the awk programming language, which is
specialized for textual data manipulation.</li>
<li><strong><code>perl Command:</code></strong> Perl is a programming language specially designed for text editing.</li>
</ul>
To test this, i had already created the file called <code>2daygeek.txt</code> with some texts and empty lines. The details are below.<br />
<pre>$ <strong><span style="color: lime;">cat 2daygeek.txt</span></strong>
2daygeek.com is a best Linux blog to learn Linux.
It's FIVE years old blog.
This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0.
He got two GIRL babys.
Her names are Tanisha & Renusha.
</pre>
Now everything is ready and i’m going to test this in multiple ways.<br />
<h4>
How To Remove/Delete The Empty Lines In A File In Linux Using sed Command?</h4>
Sed is a stream editor. A stream editor is used to perform basic
text transformations on an input stream (a file or input from a
pipeline).<br />
<pre>$ <strong><span style="color: lime;">sed '/^$/d' 2daygeek.txt</span></strong>
2daygeek.com is a best Linux blog to learn Linux.
It's FIVE years old blog.
This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0.
He got two GIRL babes.
Her names are Tanisha & Renusha.
</pre>
Details are follow:<br />
<ul>
<li><strong><code>sed:</code></strong> It’s a command</li>
<li><strong><code>//:</code></strong> It holds the searching string.</li>
<li><strong><code>^:</code></strong> Matches start of string.</li>
<li><strong><code>$:</code></strong> Matches end of string.</li>
<li><strong><code>d:</code></strong> Delete the matched string.</li>
<li><strong><code>2daygeek.txt:</code></strong> Source file name.</li>
</ul>
<h4>
How To Remove/Delete The Empty Lines In A File In Linux Using grep Command?</h4>
grep searches for PATTERNS in each FILE. PATTERNS is one or patterns
separated by newline characters, and grep prints each line that matches
a pattern.<br />
<pre>$ <strong><span style="color: lime;">grep . 2daygeek.txt</span></strong>
or
$ <strong><span style="color: lime;">grep -Ev "^$" 2daygeek.txt</span></strong>
or
$ <strong><span style="color: lime;">grep -v -e '^$' 2daygeek.txt</span></strong>
2daygeek.com is a best Linux blog to learn Linux.
It's FIVE years old blog.
This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0.
He got two GIRL babes.
Her names are Tanisha & Renusha.
</pre>
Details are follow:<br />
<div style="float: none; margin: 10px 0 10px 0; text-align: center;">
<ins class="adsbygoogle" data-ad-client="ca-pub-7730570141079407" data-ad-format="fluid" data-ad-layout="in-article" data-ad-slot="5150237910" data-adsbygoogle-status="done" style="display: block; height: 200px; text-align: center;"><ins id="aswift_3_expand" style="background-color: transparent; border: none; display: inline-table; height: 200px; margin: 0; padding: 0; position: relative; visibility: visible; width: 875px;"><ins id="aswift_3_anchor" style="background-color: transparent; border: none; display: block; height: 200px; margin: 0; padding: 0; position: relative; visibility: visible; width: 875px;"></ins></ins></ins>
</div>
<div style="float: none; margin: 10px 0 10px 0; text-align: center;">
</div>
<ul>
<li><strong><code>grep:</code></strong> It’s a command</li>
<li><strong><code>.:</code></strong> Replaces any character.</li>
<li><strong><code>^:</code></strong> matches start of string.</li>
<li><strong><code>$:</code></strong> matches end of string.</li>
<li><strong><code>E:</code></strong> For extended regular expressions pattern matching.</li>
<li><strong><code>e:</code></strong> For regular expressions pattern matching.</li>
<li><strong><code>v:</code></strong> To select non-matching lines from the file.</li>
<li><strong><code>2daygeek.txt:</code></strong> Source file name.</li>
</ul>
<h4>
How To Remove/Delete The Empty Lines In A File In Linux Using awk Command?</h4>
The awk utility shall execute programs written in the awk
programming language, which is specialized for textual data
manipulation. An awk program is a sequence of patterns and corresponding
actions.<br />
<pre>$ <strong><span style="color: lime;">awk NF 2daygeek.txt</span></strong>
or
$ <strong><span style="color: lime;">awk '!/^$/' 2daygeek.txt</span></strong>
or
$ <strong><span style="color: lime;">awk '/./' 2daygeek.txt</span></strong>
2daygeek.com is a best Linux blog to learn Linux.
It's FIVE years old blog.
This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0.
He got two GIRL babes.
Her names are Tanisha & Renusha.
</pre>
Details are follow:<br />
<ul>
<li><strong><code>awk:</code></strong> It’s a command</li>
<li><strong><code>//:</code></strong> It holds the searching string.</li>
<li><strong><code>^:</code></strong> matches start of string.</li>
<li><strong><code>$:</code></strong> matches end of string.</li>
<li><strong><code>.:</code></strong> Replaces any character.</li>
<li><strong><code>!:</code></strong> Delete the matched string.</li>
<li><strong><code>2daygeek.txt:</code></strong> Source file name.</li>
</ul>
<h4>
How To Delete The Empty Lines In A File In Linux using Combination of cat And tr Command?</h4>
cat stands for concatenate. It is very frequently used in Linux to reads data from a file.<br />
cat is one of the most frequently used commands on Unix-like
operating systems. It’s offer three functions which is related to text
file such as display content of a file, combine multiple files into the
single output and create a new file.<br />
Translate, squeeze, and/or delete characters from standard input, writing to standard output.<br />
<pre>$ <strong><span style="color: lime;">cat 2daygeek.txt | tr -s '\n'</span></strong>
2daygeek.com is a best Linux blog to learn Linux.
It's FIVE years old blog.
This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0.
He got two GIRL babes.
Her names are Tanisha & Renusha.
</pre>
Details are follow:<br />
<ul>
<li><strong><code>cat:</code></strong> It’s a command</li>
<li><strong><code>tr:</code></strong> It’s a command</li>
<li><strong><code>|:</code></strong> Pipe symbol. It pass first command output as a input to another command.</li>
<li><strong><code>s:</code></strong> Replace each sequence of a repeated character that is listed in the last specified SET.</li>
<li><strong><code>\n:</code></strong> To add a new line.</li>
<li><strong><code>2daygeek.txt:</code></strong> Source file name.</li>
</ul>
<h4>
How To Remove/Delete The Empty Lines In A File In Linux Using perl Command?</h4>
Perl stands in for “Practical Extraction and Reporting Language”.
Perl is a programming language specially designed for text editing. It
is now widely used for a variety of purposes including Linux system
administration, network programming, web development, etc.<br />
<pre>$ <strong><span style="color: lime;">perl -ne 'print if /\S/' 2daygeek.txt</span></strong>
2daygeek.com is a best Linux blog to learn Linux.
It's FIVE years old blog.
This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0.
He got two GIRL babes.
Her names are Tanisha & Renusha.
</pre>
<div style="float: none; margin: 10px 0 10px 0; text-align: center;">
<ins class="adsbygoogle" data-ad-client="ca-pub-7730570141079407" data-ad-format="autorelaxed" data-ad-slot="9495141575" data-adsbygoogle-status="done" style="display: block; height: 437px;"><ins id="aswift_4_expand" style="background-color: transparent; border: none; display: inline-table; height: 437px; margin: 0; padding: 0; position: relative; visibility: visible; width: 875px;"><ins id="aswift_4_anchor" style="background-color: transparent; border: none; display: block; height: 437px; margin: 0; padding: 0; position: relative; visibility: visible; width: 875px;"></ins></ins></ins>
</div>
<nav class="pagination group">
</nav></div>
Sameh Attiahttp://www.blogger.com/profile/06829656663776752624noreply@blogger.com0tag:blogger.com,1999:blog-3950073089426506979.post-14962761011310516132019-02-13T01:29:00.001+02:002019-02-13T01:29:31.053+02:00How to Install NodeBB Forum on Fedora 29<div dir="ltr" style="text-align: left;" trbidi="on">
https://www.howtoforge.com/how-to-install-nodebb-forum-on-fedora-29<br />
<br />
<span>NodeBB is a <span>Node.js based forum software built for the modern web. It's<span> built on either a MongoDB or Redis database. <span>It
utilizes web sockets for instant interactions and real-time
notifications. NodeBB has many modern features out of the box such as
social network integration and streaming discussions. <span>Additional functionality is enabled through the use of third-party plugins. <span>NodeBB is an open source project which can be found on Github</span><span>. </span></span></span></span></span></span><span>In
this guide, we will walk you through the step-by-step NodeBB
installation process on the Fedora 29 operating system by using Nginx as
a reverse proxy, MongoDB as the database and acme.sh and Let's Encrypt
for HTTPS.</span><br />
<h2 id="requirements">
Requirements</h2>
<span>NodeBB requires the following software to be installed:</span><br />
<ul>
<li><span>Node.js version<span> </span><strong>6</strong><span> </span>or greater</span></li>
<li><span><span>MongoDB version<span> </span><strong>2.6</strong><span> </span>or greater or <span>Redis version<span> </span><strong>2.8.9</strong><span> </span>or greater</span></span></span></li>
<li><span><span><span>Nginx version<span> </span><strong>1.3.13</strong><span> </span>or greater</span></span></span></li>
<li><span><span><span>Git</span></span></span></li>
</ul>
<span><span><span><strong>NOTE</strong>:<em> Installing NodeBB's
dependencies may require more than 512 megabytes of system memory. It is
recommended to enable a swap partition to compensate if your Linux
system has insufficient memory.</em></span></span></span><br />
<div style="background-color: white; float: left; margin: 10px 15px 10px 0px; width: 336px;">
<div data-google-query-id="CMKFi7ist-ACFQMbcgodC_4OGg" id="div-gpt-ad-1527185271042-6" style="height: 250px; width: 300px;">
</div>
</div>
<h2 class="header-scroll is-api-header" id="prerequisites">
Prerequisites</h2>
<ul>
<li>A running Fedora 29 system with at least 1GB or RAM.</li>
<li>Domain name with<span> </span><code>A</code>/<code>AAAA</code><span> </span>records set up.</li>
<li><span>A non-root user with sudo privileges.</span></li>
</ul>
<h2 id="initial-steps">
Initial steps</h2>
<span>Check your Fedora version:</span><br />
<pre class="command"><code spellcheck="false"><span>cat /etc/fedora-release
# Fedora release 29 (Twenty Nine)</span></code></pre>
<span>Set up the timezone:</span><br />
<pre class="command"><code spellcheck="false">timedatectl list-timezones
sudo timedatectl set-timezone 'Region/City'</code></pre>
<span>Update your operating system packages (software). This is an
important first step because it ensures you have the latest updates and
security fixes for your operating system's default software packages:</span><br />
<pre class="command"><code spellcheck="false"><span>sudo dnf check-upgrade || sudo dnf upgrade -y</span></code></pre>
<span>Install some essential packages that are necessary for basic administration of the Fedora operating system:</span><br />
<pre class="command"><code spellcheck="false"><span>sudo dnf install -y curl wget vim bash-completion git socat</span></code></pre>
<span>For simplicity's sake, disable SELinux and Firewall:</span><br />
<pre class="command"><code spellcheck="false">sudo setenforce 0; sudo systemctl stop firewalld.service; sudo systemctl disable firewalld.service</code></pre>
<h2 id="step-install-nodejs-and-npm">
Step 1: Install Node.js and npm</h2>
<span>NodeBB is built on<span> Node.js.</span></span><span> We are going to install<span> </span></span><strong>recommended</strong><span> version for NodeBB which is version 8<span face="monospace"><b> </b></span></span><span>at
the time of this writing. On Linux, you have a few Node.js installation
options: Linux Binaries (x86/x64), Source Code or via Package Managers.
We will use Package Management option which makes installing and
updating Node.js a breeze.</span><br />
<span>Download and install the latest Long-Term Support (</span>LTS<span>) release of<span> Node.js from the Fedora repo:</span></span><br />
<pre class="command"><code spellcheck="false">sudo dnf -y install nodejs</code></pre>
<span>To compile and install native add-ons from npm you may also need to install build tools:</span><br />
<pre class="command"><code spellcheck="false">sudo dnf install -y gcc-c++ make
# or
# sudo dnf groupinstall -y 'Development Tools'</code></pre>
<span><span><strong>NOTE</strong><span>:<span> </span><em>npm is
distributed with Node.js - which means that when you download Node.js,
you automatically get npm installed on your system.</em></span></span></span><br />
<span>Check the Node.js and<span> npm</span></span><span><span> </span>versions:</span><br />
<pre class="command"><code spellcheck="false"><span>node -v && npm -v</span># v10.15.0
# 6.4.1</code></pre>
<span>Npm is a separate project from Node.js, and tends to update
more frequently. As a result, even if you’ve just downloaded Node.js
(and therefore npm), you’ll probably need to update your npm. Luckily,
npm knows how to update itself! To update your npm, type this into your
terminal:</span><br />
<pre class="command"><code spellcheck="false">sudo npm install -g npm@latest</code></pre>
<span>This command will update npm to the latest stable version.</span><br />
<span>Re-check npm version with:</span><br />
<pre class="command"><code spellcheck="false"><span>npm -v</span>
# 6.7.0</code></pre>
And it should return latest version numbers.<br />
<h2 id="step-install-and-configure-mongodb">
Step 2: Install and configure MongoDB</h2>
NodeBB needs a database to store its data, and it supports MongoDB
and Redis. In this tutorial, we chose MongoDB as data store engine. So,
in the next few steps, we will download and install MongoDB database
from the official MongoDB rpm repository:<br />
<span>To install the stable version of MongoDB package, issue the following command:</span><br />
<pre class="command"><code spellcheck="false">sudo dnf install -y mongodb mongodb-server</code></pre>
Check the MongoDB version:<br />
<pre class="command"><code spellcheck="false">mongo --version | head -n 1 && mongod --version | head -n 1
# MongoDB shell version v4.0.1
# db version v4.0.1</code></pre>
<span>Start and enable <span>(</span><em>set it to start on reboot</em><span>) </span>MongoDB service:</span><br />
<pre class="command"><code spellcheck="false"><span>sudo systemctl start mongod.service</span>sudo systemctl enable mongod.service</code></pre>
Check the MongoDB Database Server status by running:<br />
<pre class="command"><code spellcheck="false">sudo systemctl status mongod.service
# active (running)</code></pre>
Next, create MongoDB database and user for NodeBB.<br />
Connect to MongoDB server first.<br />
<pre class="command"><code spellcheck="false">mongo</code></pre>
Switch to the built-in<span> </span><code>admin</code><span> </span>database.<br />
<pre class="command"><code spellcheck="false">> use admin</code></pre>
Create an administrative user.<br />
<pre class="command"><code spellcheck="false">> db.createUser( { user: "admin", pwd: "<enter a="" password="" secure="">", roles: [ { role: "readWriteAnyDatabase", db: "admin" }, { role: "userAdminAnyDatabase", db: "admin" } ] } )</enter></code></pre>
<strong>NOTE:</strong><span> </span><em>Replace the placeholder<span> </span><code><enter a="" password="" secure=""></enter></code><span> </span>with your own selected password.</em><br />
Add a new database called<span> </span><code>nodebb</code>.<br />
<pre class="command"><code spellcheck="false">> use nodebb</code></pre>
The database will be created and context switched to<span> </span><code>nodebb</code>. Next create the<span> </span><code>nodebb</code><span> </span>user with the appropriate privileges.<br />
<pre class="command"><code spellcheck="false">> db.createUser( { user: "nodebb", pwd: "<enter a="" password="" secure="">", roles: [ { role: "readWrite", db: "nodebb" }, { role: "clusterMonitor", db: "admin" } ] } )</enter></code></pre>
<strong>NOTE:</strong><span> </span><em>Again, replace the placeholder<span> </span><code><enter a="" password="" secure=""></enter></code><span> </span>with your own selected password.</em><br />
Exit the Mongo shell.<br />
<pre class="command"><code spellcheck="false">> quit()</code></pre>
Restart MongoDB and verify that the administrative user created earlier can connect.<br />
<pre class="command"><code spellcheck="false">sudo systemctl restart mongod.service
mongo -u admin -p your_password --authenticationDatabase=admin</code></pre>
If all went well, your MongoDB should be installed and prepared for
NodeBB. In the next step, we will deal with web server installation and
configuration.<br />
<h2 id="">
Step 3 - Install<span> </span><code>acme.sh</code><span> </span>client and obtain Let's Encrypt certificate (<em>optional</em>)</h2>
Securing your NodeBB Forum with HTTPS is not necessary, but it is a
good practice to secure your site traffic. In order to obtain TLS
certificate from Let's Encrypt we will use acme.sh client. Acme.sh is a
pure unix shell software for obtaining TLS certificates from Let's
Encrypt with zero dependencies.<br />
Download and install acme.sh:<br />
<pre class="command"><code spellcheck="false">sudo su - root
git clone https://github.com/Neilpang/acme.sh.git
cd acme.sh<span> </span>
./acme.sh --install --accountemail<span> </span>your_email@example.com
source ~/.bashrc
cd ~</code></pre>
Check acme.sh version:<br />
<pre class="command"><code spellcheck="false">acme.sh --version
# v2.8.0</code></pre>
Obtain<span> </span><strong>RSA</strong><span> </span>and<span> </span><strong>ECC/ECDSA</strong><span> </span>certificates for your domain/hostname:<code><br /></code><br />
<pre class="command"><code spellcheck="false"># RSA 2048
acme.sh --issue <span>--standalone</span> -d example.com --keylength 2048
# ECDSA
acme.sh --issue --standalone -d example.com --keylength ec-256</code></pre>
If you want fake certificates for testing you can add<span> </span><span><code>--staging</code></span> flage to the above commands.<br />
After running the above commands, your <em>certificates</em> and <em>keys</em> will be in:<br />
<ul>
<li>For<span> </span><strong>RSA</strong>:<span> </span><code>/home/username/example.com</code><span> </span>directory.</li>
<li>For<span> </span><strong>ECC/ECDSA</strong>:<span> </span><code>/home/username/example.com_ecc</code><span> </span>directory.</li>
</ul>
To list your issued certs you can run:<br />
<pre class="command"><code spellcheck="false">acme.sh --list</code></pre>
Create a directories to store your certs. We will use <code>/etc/letsencrypt</code> directory.<br />
<pre class="command"><code>mkdir -p /etc/letsecnrypt/example.com</code>
<code>sudo mkdir -p /etc/letsencrypt/example.com_ecc</code></pre>
<span face="monospace">Install/copy certificates to</span><span face="monospace"> </span><span face="monospace">/etc/letsencrypt</span><span face="monospace"></span><span face="monospace"> </span><span face="monospace">directory</span><span face="monospace">.</span><br />
<pre class="command"><code spellcheck="false"># RSA
acme.sh --install-cert -d example.com --cert-file /etc/letsencrypt/example.com/cert.pem --key-file /etc/letsencrypt/example.com/private.key --fullchain-file /etc/letsencrypt/example.com/fullchain.pem --reloadcmd "sudo systemctl reload nginx.service"
# ECC/ECDSA
acme.sh --install-cert -d example.com --ecc --cert-file /etc/letsencrypt/example.com_ecc/cert.pem --key-file /etc/letsencrypt/example.com_ecc/private.key --fullchain-file /etc/letsencrypt/example.com_ecc/fullchain.pem --reloadcmd "sudo systemctl reload nginx.service"</code></pre>
<span face="monospace">All the certificates will be automatically renewed every 60 days.</span><br />
After obtaining certs exit from root user and return back to normal sudo user:<br />
<pre class="command"><code spellcheck="false">exit</code></pre>
<h2 id="step-install-and-configure-nginx">
Step 4: Install and configure Nginx</h2>
<span>NodeBB can work fine with many web servers. In this tutorial, we selected Nginx.</span><br />
<span>Install Nginx package, by issue the following command:</span><br />
<pre class="command"><code spellcheck="false">sudo dnf install -y nginx</code></pre>
After the installation, you can verify Nginx version by running:<br />
<pre class="command"><code spellcheck="false">nginx -v
# 1.14.1</code></pre>
<span>Start and enable (<em>set it to start on reboot</em>) Nginx service:</span><br />
<pre class="command"><code spellcheck="false"><span>sudo systemctl start nginx.service</span>sudo systemctl enable nginx.service</code></pre>
Check the Nginx web server status by running:<br />
<pre class="command"><code spellcheck="false">sudo systemctl status nginx.service
# active (running)</code></pre>
<span>NodeBB by default runs on port<span> </span></span><code>4567</code><span>. To avoid typing<span> </span></span><code>http://example.com:4567</code><span>, we will configure Nginx as a reverse proxy for the NodeBB application. Every request on port<span> </span></span><code>80</code><span><span> </span>or<span> </span></span><code>443</code><span><span> </span>(</span><em>if SSL is used</em><span>) will be forwarded to port<span> </span></span><code>4567</code><span>.</span><br />
<span><span>Run<span> </span></span><code>sudo vim /etc/nginx/conf.d/nodebb.conf</code><span> and configure Nginx as an HTTPS reverse proxy.</span></span><br />
<pre><code spellcheck="false"><code spellcheck="false">server {
listen [::]:443 ssl http2;
listen 443 ssl http2;
listen [::]:80;
listen 80;
server_name forum.example.com;
client_max_body_size 50M;
# RSA
ssl_certificate /etc/letsencrypt/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/example.com/private.key;
# ECDSA
ssl_certificate /etc/letsencrypt/example.com_ecc/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/example.com_ecc/private.key;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://127.0.0.1:4567;
proxy_redirect off;
# Socket.IO Support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}</code></code></pre>
Check the Nginx configuration:<br />
<pre class="command"><code spellcheck="false">sudo nginx -t</code></pre>
Finally, for changes to take effect, we need to reload Nginx:<br />
<pre class="command"><code spellcheck="false">sudo systemctl reload nginx.service</code></pre>
<h2 id="step-install-and-setup-nodebb">
Step 5: Install and setup NodeBB</h2>
<span>Create a document root directory where NodeBB should reside in:</span><br />
<pre class="command"><code spellcheck="false"><span><span>sudo mkdir -p /var/www/nodebb</span></span></code></pre>
<span>Navigate to the document root directory:</span><br />
<pre class="command"><code spellcheck="false"><span>cd /var/www/nodebb</span></code></pre>
<span>Change ownership of the<span> </span></span><code>/var/www/nodebb</code><span> directory to <span face="monospace">your_user</span></span><span>.</span><br />
<pre class="command"><code spellcheck="false">sudo chown -R [your_user]:[your_user] /var/www/nodebb</code></pre>
<strong>NOTE: </strong><em>Replace your_user in the above command with your non-root user that you should have created as a prerequisite for this tutorial</em><em>.</em><br />
<span>Clone the latest NodeBB <span>repository </span>into document root folder:</span><br />
<pre class="command"><code spellcheck="false">git clone -b v1.11.x https://github.com/NodeBB/NodeBB.git .</code></pre>
<span><span>Initiate the setup script by running the app with the<span> </span></span><code>setup</code><span><span> </span>flag. Answer each of the questions:</span></span><br />
<pre class="command"><code spellcheck="false">./nodebb setup</code></pre>
After NodeBB setup is completed, run<span> </span><code>./nodebb start</code><span> </span>to manually start your NodeBB server:<br />
<pre class="command"><code spellcheck="false">./nodebb start</code></pre>
After running this command, you should be able to access your brand new forum in your web browser:<br />
<div style="text-align: center;">
<a class="fancybox" href="https://www.howtoforge.com/images/how_to_install_nodebb_forum_on_centos_7/big/Screen_Shot_2018-09-21_at_5.27_.16_AM_.png" id="img-Screen_Shot_2018-09-21_at_5.27_.16_AM_"><img alt="NodeBB in Browser" height="316" src="https://www.howtoforge.com/images/how_to_install_nodebb_forum_on_centos_7/Screen_Shot_2018-09-21_at_5.27_.16_AM_.png" width="550" /></a></div>
<h2 id="step-run-nodebb-as-a-system-service">
Step 6: Run NodeBB as a System Service</h2>
When started via<span> </span><code>./nodebb start</code>, NodeBB
will not automatically start up again when the system reboots. To avoid
that, we will need to setup NodeBB as a system service.<br />
If running, stop NodeBB:<br />
<pre class="command"><code spellcheck="false">./nodebb stop</code></pre>
Create a new<span> </span><code>nodebb</code><span> </span>user:<br />
<pre class="command"><code spellcheck="false">sudo useradd nodebb</code></pre>
Change the ownership of the<span> </span><code>/var/www/nodebb</code><span> </span>directory to<span> </span><code>nodebb</code><span> </span>user:<br />
<pre class="command"><code spellcheck="false">sudo chown -R nodebb:nodebb /var/www/nodebb</code></pre>
Create<span> </span><code>nodebb.service</code><span> </span>systemd unit config file. This unit file will handle startup of NodeBB deamon. Run<span> </span><code>sudo vim /etc/systemd/system/nodebb.service</code><span> </span>and add the below content:<br />
<pre><code>[Unit]
Description=NodeBB
Documentation=https://docs.nodebb.org
After=system.slice multi-user.target mongod.service
[Service]
Type=forking
User=nodebb
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=nodebb
Environment=NODE_ENV=production
WorkingDirectory=/var/www/nodebb
PIDFile=/var/www/nodebb/pidfile
ExecStart=/usr/bin/env node loader.js
Restart=always
[Install]
WantedBy=multi-user.target
</code></pre>
<strong>NOTE:</strong><span> </span><em>Set username and directory paths according to your chosen names.</em><br />
Enable<span> </span><code>nodebb.service</code><span> </span>on reboot and immediately start<span> </span><code>nodebb.service:</code><br />
<pre class="command"><code spellcheck="false">sudo systemctl enable nodebb.service
sudo systemctl start nodebb.service</code></pre>
Check the<span> </span><code>nodebb.service</code><span> </span>status:<br />
<pre class="command"><code spellcheck="false">sudo systemctl status nodebb.service
sudo systemctl is-enabled nodebb.service</code></pre>
Congratulations! You have successfully installed and deployed NodeBB discussion platform on Fedora 29 system. <span>You should be able to access your forum on your domain</span><span><span> </span>and interact with your forum.</span><br />
<h2 id="step-complete-the-cachet-setup">
Links</h2>
<ul>
<li><a href="https://nodebb.org/">https://nodebb.org/</a></li>
<li><a href="https://docs.nodebb.org/">https://docs.nodebb.org/</a></li>
<li><a href="https://github.com/NodeBB/NodeBB">https://github.com/NodeBB/NodeBB</a></li>
</ul>
</div>
Sameh Attiahttp://www.blogger.com/profile/06829656663776752624noreply@blogger.com0tag:blogger.com,1999:blog-3950073089426506979.post-84413600827652854722019-02-13T01:12:00.001+02:002019-02-13T01:12:28.679+02:00How to Setup Private Docker Registry on Ubuntu 18.04 LTS<div dir="ltr" style="text-align: left;" trbidi="on">
https://www.howtoforge.com/how-to-setup-private-docker-registry-on-ubuntu-1804-lts<br />
<br />
Docker Registry or 'Registry' is an open source and highly scalable
server-side application that can be used to store and distribute Docker
images. It was a server-side application behind the Docker Hub. In most
use cases, a Docker Registry is a great solution if you want to
implement the CI/CD system on your application development. The Private
Docker Registry gives more performances for the development and
production cycle by centralizing all your custom Docker images of
application in one place.<br />
In this tutorial, we're going to show you how to install and
configure a Private Docker Registry on a Ubuntu 18.04 server. We will
use an Nginx web server and protect the Registry with a username and
password (basic auth).<br />
<strong>Prerequisites</strong><br />
<ul>
<li>Ubuntu 18.04 server</li>
<li>Root privileges</li>
</ul>
<strong>What we will do?</strong><br />
<ol>
<li>Install Dependencies</li>
<li>Install Docker and Docker-compose</li>
<li>Setup Private Docker Registry</li>
<li>Testing</li>
</ol>
<h2 id="step-install-package-dependencies">
Step 1 - Install Package Dependencies</h2>
First of all, we're going to install some packages dependencies for deploying the Private Docker Registry.<br />
<div style="background-color: white; float: left; margin: 10px 15px 10px 0px; width: 336px;">
<div data-google-query-id="CIyBoMOnt-ACFZM4Kwodbp4GKA" id="div-gpt-ad-1527185271042-6" style="height: 250px; width: 300px;">
</div>
</div>
Install packages dependencies using the following command.<br />
<pre class="command"><code spellcheck="false">sudo apt install -y gnupg2 pass apache2-utils httpie</code></pre>
The gnupg2 and pass packages will be used to store the password
authentication to the docker registry. And the apache2-utils will be
used to generate the basic authentication, and httpie will be used for
testing.<br />
<h2 id="step-install-docker-and-dockercompose">
Step 2 - Install Docker and Docker-compose</h2>
Now we're going to install the docker and docker-compose from the official Ubuntu repository.<br />
Install Docker and Docker-compose by running the following command.<br />
<pre class="command"><code spellcheck="false">sudo apt install -y docker.io docker-compose -y</code></pre>
Once the installation is finished, start the docker service and add it to the boot time.<br />
<pre class="command"><code spellcheck="false">sudo systemctl start docker
sudo systemctl enable docker</code></pre>
The Docker is up and running, and the Docker-compose has been installed. Check using the command below.<br />
<pre class="command"><code spellcheck="false">docker version
docker-compose version</code></pre>
And you will be displayed version of Docker and Docker-compose installed on your system.<br />
<div style="text-align: center;">
<a class="fancybox" href="https://www.howtoforge.com/images/how_to_setup_private_docker_registry_on_ubuntu_1804_lts/big/11.png" id="img-11"><img alt="Install Docker" height="370" src="https://www.howtoforge.com/images/how_to_setup_private_docker_registry_on_ubuntu_1804_lts/11.png" width="500" /></a></div>
<h2 id="step-setup-private-docker-registry">
Step 3 - Setup Private Docker Registry</h2>
In this step, we're going to configure the Docker Registry
environment by creating some directories environment, and create some
configuration including the docker-compose.yml, nginx virtual host and
additional configuration etc.<br />
<strong>- Create Project Directories</strong><br />
Create a new directory for the project called 'registry' and create the 'nginx' and 'auth' directories inside.<br />
<pre class="command"><code spellcheck="false">mkdir -p registry/{nginx,auth}</code></pre>
After that, go to the directory 'registry' and create new directories again inside 'nginx'.<br />
<pre class="command"><code spellcheck="false">cd registry/
mkdir -p nginx/{conf.d/,ssl}</code></pre>
And as a result, the project directories look like the following picture.<br />
<pre class="command"><code spellcheck="false">tree</code></pre>
<div style="text-align: center;">
<a class="fancybox" href="https://www.howtoforge.com/images/how_to_setup_private_docker_registry_on_ubuntu_1804_lts/big/21.png" id="img-21"><img alt="Create directories for Docker Registry" height="278" src="https://www.howtoforge.com/images/how_to_setup_private_docker_registry_on_ubuntu_1804_lts/21.png" width="500" /></a></div>
<strong>- Create Docker-compose Script</strong><br />
Now we want to create a new docker-compose.yml script for deploying the Docker Registry.<br />
Go to the 'registry' directory and create a new configuration file 'docker-compose.yml'.<br />
<pre class="command"><code spellcheck="false">cd registry/
vim docker-compose.yml</code></pre>
Firstly, define the compose version that you want to use and the service.<br />
<pre><code spellcheck="false">version: '3'
services:</code></pre>
After that, add the first service named 'registry'. The Docker
Registry service will be using the docker image that's provided by
docker team 'registry:2. It will mount the docker volume 'registrydata'
and the local directory named 'auth' that contains basic authentication
file 'registry.passwd'. And the last, it will run on the custom docker
image named 'mynet' and expose the port 5000 on both container and host.<br />
<pre>#Registry
registry:
image: registry:2
restart: always
ports:
- "5000:5000"
environment:
REGISTRY_AUTH: htpasswd
REGISTRY_AUTH_HTPASSWD_REALM: Registry-Realm
REGISTRY_AUTH_HTPASSWD_PATH: /auth/registry.passwd
REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY: /data
volumes:
- registrydata:/data
- ./auth:/auth
networks:
- mynet</pre>
Next, the configuration of 'nginx' service that will run HTTP and
HTTPS ports and mount the local directory 'conf.d' for virtual host
configuration, and the 'ssl' for ssl certificates.<br />
<pre>#Nginx Service
nginx:
image: nginx:alpine
container_name: nginx
restart: unless-stopped
tty: true
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx/conf.d/:/etc/nginx/conf.d/
- ./nginx/ssl/:/etc/nginx/ssl/
networks:
- mynet</pre>
And the last, define the custom network 'mynet' with bridge driver and the 'registrydata' with a local driver.<br />
<pre>#Docker Networks
networks:
mynet:
driver: bridge
#Volumes
volumes:
registrydata:
driver: local</pre>
Save and close the configuration.<br />
Below is the complete configuration:<br />
<pre>version: '3'
services:
#Registry
registry:
image: registry:2
restart: always
ports:
- "5000:5000"
environment:
REGISTRY_AUTH: htpasswd
REGISTRY_AUTH_HTPASSWD_REALM: Registry-Realm
REGISTRY_AUTH_HTPASSWD_PATH: /auth/registry.passwd
REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY: /data
volumes:
- registrydata:/data
- ./auth:/auth
networks:
- mynet
#Nginx Service
nginx:
image: nginx:alpine
container_name: nginx
restart: unless-stopped
tty: true
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx/conf.d/:/etc/nginx/conf.d/
- ./nginx/ssl/:/etc/nginx/ssl/
networks:
- mynet
#Docker Networks
networks:
mynet:
driver: bridge
#Volumes
volumes:
registrydata:
driver: local</pre>
<strong>- Configure Nginx Virtual Host</strong><br />
After creating the docker-compose script, we will create the virtual host and additional configuration for the nginx service.<br />
Go to 'nginx/conf.d/' directory and create a new virtual host file called 'registry.conf'.<br />
<pre class="command"><code spellcheck="false">cd nginx/conf.d/
vim registry.conf</code></pre>
Paste the following configuration.<br />
<pre>upstream docker-registry {
server registry:5000;
}
server {
listen 80;
server_name registry.hakase-labs.io;
return 301 https://registry.hakase-labs.io$request_uri;
}
server {
listen 443 ssl http2;
server_name registry.hakase-labs.io;
ssl_certificate /etc/nginx/ssl/fullchain.pem;
ssl_certificate_key /etc/nginx/ssl/privkey.pem;
# Log files for Debug
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
location / {
# Do not allow connections from docker 1.5 and earlier
# docker pre-1.6.0 did not properly set the user agent on ping, catch "Go *" user agents
if ($http_user_agent ~ "^(docker\/1\.(3|4|5(?!\.[0-9]-dev))|Go ).*$" ) {
return 404;
}
proxy_pass http://docker-registry;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 900;
}
}</pre>
Save and close.<br />
Next, create an additional configuration to increase the
max_body_size on nginx. This will allow you to upload docker images with
max size 2GB.<br />
<pre class="command"><code spellcheck="false">vim additional.conf</code></pre>
Paste configuration below.<br />
<pre><code spellcheck="false">client_max_body_size 2G;</code></pre>
Save and close.<br />
<strong>- Configure SSL Certificate and Basic Authentication</strong><br />
Copy SSL certificate files of your domain to the 'ssl' directory.<br />
<pre class="command"><code spellcheck="false">cp /path/to/ssl/fullchain.pem ssl/
cp /path/to/ssl/privkey.pem ssl/</code></pre>
Now go to the 'auth' directory and generate the new password file 'registry.passwd'.<br />
<pre class="command"><code spellcheck="false">cd auth/</code></pre>
Generate a new password for user hakase.<br />
<pre class="command"><code spellcheck="false">htpasswd -Bc registry.passwd hakase
TYPE THE STRONG PASSWORD</code></pre>
<div style="text-align: center;">
<a class="fancybox" href="https://www.howtoforge.com/images/how_to_setup_private_docker_registry_on_ubuntu_1804_lts/big/31.png" id="img-31"><img alt="Password protect the registry" height="340" src="https://www.howtoforge.com/images/how_to_setup_private_docker_registry_on_ubuntu_1804_lts/31.png" width="500" /></a></div>
And the environment setup for deploying Private Docker Registry has been completed.<br />
Below is the screenshot of our environment files and directories.<br />
<pre class="command"><code spellcheck="false">tree</code></pre>
<div style="text-align: center;">
<a class="fancybox" href="https://www.howtoforge.com/images/how_to_setup_private_docker_registry_on_ubuntu_1804_lts/big/41.png" id="img-41"><img alt="Directory list" height="327" src="https://www.howtoforge.com/images/how_to_setup_private_docker_registry_on_ubuntu_1804_lts/41.png" width="500" /></a></div>
<strong>- Run Docker Registry</strong><br />
Run the Docker Registry using the docker-compose command below.<br />
<pre class="command"><code spellcheck="false">docker-compose up -d</code></pre>
And you will get the result as below.<br />
<div style="text-align: center;">
<a class="fancybox" href="https://www.howtoforge.com/images/how_to_setup_private_docker_registry_on_ubuntu_1804_lts/big/51.png" id="img-51"><img alt="Start docker Registry" height="381" src="https://www.howtoforge.com/images/how_to_setup_private_docker_registry_on_ubuntu_1804_lts/51.png" width="500" /></a></div>
After that, make sure the registry and nginx service is up and running. Check using the following command.<br />
<pre class="command"><code spellcheck="false">docker-compose ps
netstat -plntu</code></pre>
And you will be shown the 'registry' service is running on port
'5000', and the 'nginx' service will expose the HTTP and HTTPS ports as
below.<br />
<div style="text-align: center;">
<a class="fancybox" href="https://www.howtoforge.com/images/how_to_setup_private_docker_registry_on_ubuntu_1804_lts/big/61.png" id="img-61"><img alt="Check Nginx service" height="221" src="https://www.howtoforge.com/images/how_to_setup_private_docker_registry_on_ubuntu_1804_lts/61.png" width="500" /></a></div>
<h2 id="step-testing">
Step 4 - Testing</h2>
Before we test our Private Docker Registry, we need to add the Root CA certificate to the docker itself and to the system.<br />
If you're using the pem file certificate, export it to the .crt file using the OpenSSL command.<br />
<pre class="command"><code spellcheck="false">openssl x509 -in rootCA.pem -inform PEM -out rootCA.crt</code></pre>
Now create a new directory for docker certificate and copy the Root CA certificate into it.<br />
<pre class="command"><code spellcheck="false">mkdir -p /etc/docker/certs.d/registry.hakase-labs.io/
cp rootCA.crt /etc/docker/certs.d/registry.hakase-labs.io/</code></pre>
And then create a new directory '/usr/share/ca-certificate/extra' and copy the Root CA certificate into it.<br />
<pre class="command"><code spellcheck="false">mkdir -p /usr/share/ca-certificates/extra/
cp rootCA.crt /usr/share/ca-certificates/extra/</code></pre>
After that, reconfigure the 'ca-certificate' package and restart the Docker service.<br />
<pre class="command"><code spellcheck="false">dpkg-reconfigure ca-certificates
systemctl restart docker</code></pre>
<div style="text-align: center;">
<a class="fancybox" href="https://www.howtoforge.com/images/how_to_setup_private_docker_registry_on_ubuntu_1804_lts/big/71.png" id="img-71"><img alt="Create SSL certificate" height="270" src="https://www.howtoforge.com/images/how_to_setup_private_docker_registry_on_ubuntu_1804_lts/71.png" width="500" /></a></div>
<strong>- Download Docker Image</strong><br />
Download new Docker image using the following command.<br />
<pre class="command"><code spellcheck="false">docker pull ubuntu:16.04</code></pre>
When it's complete, tag the image for the private registry with the command below.<br />
<pre class="command"><code spellcheck="false">docker image tag ubuntu:16.04 registry.hakase-labs.io/ubuntu16</code></pre>
Check again the list of Docker images on the system and you will get new images as below.<br />
<pre class="command"><code spellcheck="false">docker images</code></pre>
<div style="text-align: center;">
<a class="fancybox" href="https://www.howtoforge.com/images/how_to_setup_private_docker_registry_on_ubuntu_1804_lts/big/81.png" id="img-81"><img alt="Download Docker Image" height="265" src="https://www.howtoforge.com/images/how_to_setup_private_docker_registry_on_ubuntu_1804_lts/81.png" width="500" /></a></div>
<strong>- Push Image to Private Local Registry</strong><br />
Log in to the Private Docker Registry using the following command.<br />
<pre class="command"><code spellcheck="false">docker login https://registry.hakase-labs.io/v2/</code></pre>
Type the username and password based on the 'registry.htpasswd' file.<br />
Now check the available of docker image on the Registry.<br />
<pre class="command"><code spellcheck="false">http -a hakase https://registry.hakase-labs.io/v2/_catalog</code></pre>
And there is no docker image on the Registry.<br />
<div style="text-align: center;">
<a class="fancybox" href="https://www.howtoforge.com/images/how_to_setup_private_docker_registry_on_ubuntu_1804_lts/big/91.png" id="img-91"><img alt="Push Image to Private Local Registry" height="381" src="https://www.howtoforge.com/images/how_to_setup_private_docker_registry_on_ubuntu_1804_lts/91.png" width="500" /></a></div>
Now push our custom image to the Private Docker Registry.<br />
<pre class="command"><code spellcheck="false">docker push registry.hakase-labs.io/ubuntu16</code></pre>
Check again and make sure you get the 'ubuntu16' docker image on the Private Repository.<br />
<pre class="command"><code spellcheck="false">http -a hakase https://registry.hakase-labs.io/v2/_catalog</code></pre>
<div style="text-align: center;">
<a class="fancybox" href="https://www.howtoforge.com/images/how_to_setup_private_docker_registry_on_ubuntu_1804_lts/big/101.png" id="img-101"><img alt="Registry Push" height="321" src="https://www.howtoforge.com/images/how_to_setup_private_docker_registry_on_ubuntu_1804_lts/101.png" width="500" /></a></div>
And finally, the installation and configuration of Private Docker
Registry with Nginx and Basic Authentication has been completed
successfully.</div>
Sameh Attiahttp://www.blogger.com/profile/06829656663776752624noreply@blogger.com0tag:blogger.com,1999:blog-3950073089426506979.post-40995025625068601222019-02-13T00:49:00.001+02:002019-02-13T00:49:56.320+02:00How to Check Disk Space in Linux Using the df Command<div dir="ltr" style="text-align: left;" trbidi="on">
https://linuxize.com/post/how-to-check-disk-space-in-linux-using-the-df-command<br />
<br />
<figure class="relative -mx-6 lg:mx-0 mb-6"><div class="w-full mx-auto my-0 block relative">
<div class="w-full h-full absolute m-auto pin bg-grey-lighter overflow-hidden">
<img alt="" class="w-full h-full absolute m-auto pin lazy lazyautosizes lazyloaded" data-sizes="auto" data-src="/post/how-to-check-disk-space-in-linux-using-the-df-command/featured_hud84ff0000a7401053c7c193b26508bf8_30032_600x0_resize_q95_box.jpg" data-srcset="
/post/how-to-check-disk-space-in-linux-using-the-df-command/featured_hud84ff0000a7401053c7c193b26508bf8_30032_600x0_resize_q95_box.jpg 600w,
/post/how-to-check-disk-space-in-linux-using-the-df-command/featured.jpg 1000w
" src="https://linuxize.com/post/how-to-check-disk-space-in-linux-using-the-df-command/featured_hud84ff0000a7401053c7c193b26508bf8_30032_600x0_resize_q95_box.jpg" /></div>
</div>
</figure>How much
space do I have left on my hard drive? Is there enough free disk space
to download a large file or install a new application?<br />
On Linux based systems you can use the <code>df</code> command to get a detailed report on the system’s disk space usage.<br />
<h2 aria-hidden="true" class="anchor" id="using-the-df-command">
<a data-scroll="" href="https://linuxize.com/post/how-to-check-disk-space-in-linux-using-the-df-command/#using-the-df-command">Using the df Command<svg viewbox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><use xlink:href="https://linuxize.com/post/how-to-check-disk-space-in-linux-using-the-df-command/#link"></use></svg></a></h2>
When used without any argument, the <code>df</code> command will display information about all mounted file systems:<br />
<div class="highlight">
<pre class="chroma console-bash"><code class="language-console-bash" data-lang="console-bash"><span class="line">df</span></code></pre>
<span class="code-copy button main small" data-clipboard-text="df">Copy</span></div>
<div class="highlight">
<pre class="chroma"><code class="language-output" data-lang="output">Filesystem 1K-blocks Used Available Use% Mounted on
dev 8172848 0 8172848 0% /dev
run 8218640 1696 8216944 1% /run
/dev/nvme0n1p3 222284728 183057872 27865672 87% /
tmpfs 8218640 150256 8068384 2% /dev/shm
tmpfs 8218640 0 8218640 0% /sys/fs/cgroup
tmpfs 8218640 24 8218616 1% /tmp
/dev/nvme0n1p1 523248 107912 415336 21% /boot
/dev/sda1 480588496 172832632 283320260 38% /data
tmpfs 1643728 40 1643688 1% /run/user/1000</code></pre>
<span class="code-copy button main small" data-clipboard-text="Filesystem 1K-blocks Used Available Use% Mounted on
dev 8172848 0 8172848 0% /dev
run 8218640 1696 8216944 1% /run
/dev/nvme0n1p3 222284728 183057872 27865672 87% /
tmpfs 8218640 150256 8068384 2% /dev/shm
tmpfs 8218640 0 8218640 0% /sys/fs/cgroup
tmpfs 8218640 24 8218616 1% /tmp
/dev/nvme0n1p1 523248 107912 415336 21% /boot
/dev/sda1 480588496 172832632 283320260 38% /data
tmpfs 1643728 40 1643688 1% /run/user/1000">Copy</span></div>
Each
line includes information about the file system name (Filesystem), the
size (1K-blocks), the used space (Used), the available space
(Available), the percentage of used space (Use%), and the directory in
which the filesystem is mounted (Mounted on).<br />
To display
information only for a specific file system pass the filesystem name or
the mount point to the df command. For example to show the space
available on the file system mounted to system root directory <code>/</code> you can use either <code>df /dev/nvme0n1p3</code> or <code>df /</code>.<br />
<div class="highlight">
<pre class="chroma console-bash"><code class="language-console-bash" data-lang="console-bash"><span class="line">df /</span></code></pre>
<span class="code-copy button main small" data-clipboard-text="df /">Copy</span></div>
<div class="highlight">
<pre class="chroma"><code class="language-output" data-lang="output">Filesystem 1K-blocks Used Available Use% Mounted on
/dev/nvme0n1p3 222284728 183057872 27865672 87% /</code></pre>
<span class="code-copy button main small" data-clipboard-text="Filesystem 1K-blocks Used Available Use% Mounted on
/dev/nvme0n1p3 222284728 183057872 27865672 87% /">Copy</span></div>
<h2 aria-hidden="true" class="anchor" id="show-disk-space-usage-in-human-readable-format">
<a data-scroll="" href="https://linuxize.com/post/how-to-check-disk-space-in-linux-using-the-df-command/#show-disk-space-usage-in-human-readable-format">Show Disk Space Usage in Human Readable Format<svg viewbox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><use xlink:href="https://linuxize.com/post/how-to-check-disk-space-in-linux-using-the-df-command/#link"></use></svg></a></h2>
By default, the <code>df</code>
command shows the disk space in 1 kilobyte blocks and the size of used
and available disk space in kilobytes. To view the information
human-readable format (megabytes and gigabytes), pass the <code>-h</code> option:<br />
<div class="highlight">
<pre class="chroma console-bash"><code class="language-console-bash" data-lang="console-bash"><span class="line">df -h</span></code></pre>
<span class="code-copy button main small" data-clipboard-text="df -h">Copy</span></div>
<div class="highlight">
<pre class="chroma"><code class="language-output" data-lang="output">Filesystem 1K-blocks Used Available Use% Mounted on
Filesystem Size Used Avail Use% Mounted on
dev 7.8G 0 7.8G 0% /dev
run 7.9G 1.8M 7.9G 1% /run
/dev/nvme0n1p3 212G 176G 27G 88% /
tmpfs 7.9G 145M 7.7G 2% /dev/shm
tmpfs 7.9G 0 7.9G 0% /sys/fs/cgroup
tmpfs 7.9G 24K 7.9G 1% /tmp
/dev/nvme0n1p1 511M 106M 406M 21% /boot
/dev/sda1 459G 165G 271G 38% /data
tmpfs 1.6G 16K 1.6G 1% /run/user/1000</code></pre>
<span class="code-copy button main small" data-clipboard-text="Filesystem 1K-blocks Used Available Use% Mounted on
Filesystem Size Used Avail Use% Mounted on
dev 7.8G 0 7.8G 0% /dev
run 7.9G 1.8M 7.9G 1% /run
/dev/nvme0n1p3 212G 176G 27G 88% /
tmpfs 7.9G 145M 7.7G 2% /dev/shm
tmpfs 7.9G 0 7.9G 0% /sys/fs/cgroup
tmpfs 7.9G 24K 7.9G 1% /tmp
/dev/nvme0n1p1 511M 106M 406M 21% /boot
/dev/sda1 459G 165G 271G 38% /data
tmpfs 1.6G 16K 1.6G 1% /run/user/1000">Copy</span></div>
<h2 aria-hidden="true" class="anchor" id="file-system-types">
<a data-scroll="" href="https://linuxize.com/post/how-to-check-disk-space-in-linux-using-the-df-command/#file-system-types">File System Types<svg viewbox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><use xlink:href="https://linuxize.com/post/how-to-check-disk-space-in-linux-using-the-df-command/#link"></use></svg></a></h2>
To display file system types, use the <code>df</code> command followed the <code>-T</code> option:<br />
<div class="highlight">
<pre class="chroma console-bash"><code class="language-console-bash" data-lang="console-bash"><span class="line">df -t</span></code></pre>
<span class="code-copy button main small" data-clipboard-text="df -t">Copy</span></div>
<div class="highlight">
<pre class="chroma"><code class="language-output" data-lang="output">Filesystem Type 1K-blocks Used Available Use% Mounted on
dev devtmpfs 8172848 0 8172848 0% /dev
run tmpfs 8218640 1744 8216896 1% /run
/dev/nvme0n1p3 ext4 222284728 183666100 27257444 88% /
tmpfs tmpfs 8218640 383076 7835564 5% /dev/shm
tmpfs tmpfs 8218640 0 8218640 0% /sys/fs/cgroup
tmpfs tmpfs 8218640 24 8218616 1% /tmp
/dev/nvme0n1p1 vfat 523248 107912 415336 21% /boot
/dev/sda1 ext4 480588496 172832632 283320260 38% /data
tmpfs tmpfs 1643728 40 1643688 1% /run/user/1000</code></pre>
<span class="code-copy button main small" data-clipboard-text="Filesystem Type 1K-blocks Used Available Use% Mounted on
dev devtmpfs 8172848 0 8172848 0% /dev
run tmpfs 8218640 1744 8216896 1% /run
/dev/nvme0n1p3 ext4 222284728 183666100 27257444 88% /
tmpfs tmpfs 8218640 383076 7835564 5% /dev/shm
tmpfs tmpfs 8218640 0 8218640 0% /sys/fs/cgroup
tmpfs tmpfs 8218640 24 8218616 1% /tmp
/dev/nvme0n1p1 vfat 523248 107912 415336 21% /boot
/dev/sda1 ext4 480588496 172832632 283320260 38% /data
tmpfs tmpfs 1643728 40 1643688 1% /run/user/1000">Copy</span></div>
If you want to limit listing to file systems of a specific type use the <code>-t</code> option followed by the type. For example to list all ext4 partitions you would run:<br />
<div class="highlight">
<pre class="chroma console-bash"><code class="language-console-bash" data-lang="console-bash"><span class="line">df -t ext4</span></code></pre>
<span class="code-copy button main small" data-clipboard-text="df -t ext4">Copy</span></div>
<div class="highlight">
<pre class="chroma"><code class="language-output" data-lang="output">Filesystem 1K-blocks Used Available Use% Mounted on
/dev/nvme0n1p3 222284728 183666112 27257432 88% /
/dev/sda1 480588496 172832632 283320260 38% /data</code></pre>
<span class="code-copy button main small" data-clipboard-text="Filesystem 1K-blocks Used Available Use% Mounted on
/dev/nvme0n1p3 222284728 183666112 27257432 88% /
/dev/sda1 480588496 172832632 283320260 38% /data">Copy</span></div>
Similar to above, the <code>-x</code> option allows you to limit the output to file systems that are not of a specific type,<br />
<h2 aria-hidden="true" class="anchor" id="display-inode-usage">
<a data-scroll="" href="https://linuxize.com/post/how-to-check-disk-space-in-linux-using-the-df-command/#display-inode-usage">Display Inode Usage<svg viewbox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><use xlink:href="https://linuxize.com/post/how-to-check-disk-space-in-linux-using-the-df-command/#link"></use></svg></a></h2>
When used with the <code>-i</code>
option the df command will display information about the filesystem
inodes usage. For example to show information about the inodes on the
file system mounted to system root directory <code>/</code> in human-readable format you would use:<br />
<div class="highlight">
<pre class="chroma console-bash"><code class="language-console-bash" data-lang="console-bash"><span class="line">df -ih /</span></code></pre>
<span class="code-copy button main small" data-clipboard-text="df -ih /">Copy</span></div>
<div class="highlight">
<pre class="chroma"><code class="language-output" data-lang="output">Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/nvme0n1p3 14M 1.9M 12M 14% /</code></pre>
<span class="code-copy button main small" data-clipboard-text="Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/nvme0n1p3 14M 1.9M 12M 14% /">Copy</span></div>
<div class="my-6 bg-yellow-lightest border-l-4 border-yellow-light note p-6 text-yellow-darkest">
<div class="flex">
<div class="w-full text-sm font-sans">
An
inode is a data structure in a Unix and Linux file systems, which
contains information about a file or directory such as its size, owner,
device node, socket, pipe, etc., except da.</div>
</div>
</div>
<h2 aria-hidden="true" class="anchor" id="output-format">
<a data-scroll="" href="https://linuxize.com/post/how-to-check-disk-space-in-linux-using-the-df-command/#output-format">Output format<svg viewbox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><use xlink:href="https://linuxize.com/post/how-to-check-disk-space-in-linux-using-the-df-command/#link"></use></svg></a></h2>
The <code>df</code> command also allows you to specify the output format.<br />
To limit the reported fields shown in the df output use the <code>--output[=FIELD_LIST]</code> option. <code>FIELD_LIST</code> is a comma-separated list of columns to be included in the output. Each field can be used only once. Valid field names are:<br />
<ul>
<li><code>source</code> - The File system source.</li>
<li><code>fstype</code> - The File system type.</li>
<li><code>itotal</code> - Total number of inodes.</li>
<li><code>iused</code> - Number of the used inodes.</li>
<li><code>iavail</code> - Number of the available inodes.</li>
<li><code>ipcent</code> - Percentage of used inodes.</li>
<li><code>size</code> - Total disk space.</li>
<li><code>used</code> - Used disk space.</li>
<li><code>avail</code> - Available disk space.</li>
<li><code>pcent</code> - Percentage of used space.</li>
<li><code>file</code> - The file name if specified on the command line.</li>
<li><code>target</code> - The mount point.</li>
</ul>
For
example to display the output of all ext4 partition in human-readable
format, showing only the filesystem name and size and the percentage of
the used space you would use:<br />
<div class="highlight">
<pre class="chroma console-bash"><code class="language-console-bash" data-lang="console-bash"><span class="line">df -h -t ext4 --output=source,size,pcent</span></code></pre>
<span class="code-copy button main small" data-clipboard-text="df -h -t ext4 --output=source,size,pcent">Copy</span></div>
<div class="highlight">
<pre class="chroma"><code class="language-output" data-lang="output">Filesystem Size Use%
/dev/nvme0n1p3 212G 88%
/dev/sda1 459G 38%</code></pre>
<span class="code-copy button main small" data-clipboard-text="Filesystem Size Use%
/dev/nvme0n1p3 212G 88%
/dev/sda1 459G 38%">Copy</span></div>
<h2 aria-hidden="true" class="anchor" id="conclusion">
<a data-scroll="" href="https://linuxize.com/post/how-to-check-disk-space-in-linux-using-the-df-command/#conclusion">Conclusion<svg viewbox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><use xlink:href="https://linuxize.com/post/how-to-check-disk-space-in-linux-using-the-df-command/#link"></use></svg></a></h2>
By now you should have a good understanding of how to use the <code>df</code> command. You can always view all available <code>df</code> command options by typing <code>man df</code> in your terminal.</div>
Sameh Attiahttp://www.blogger.com/profile/06829656663776752624noreply@blogger.com0tag:blogger.com,1999:blog-3950073089426506979.post-3012271023902498082019-02-13T00:44:00.002+02:002019-02-13T00:44:48.613+02:00How to Find Your Public IP Address on Linux Command Line<div dir="ltr" style="text-align: left;" trbidi="on">
https://www.putorius.net/find-public-ip-address-linux-command-line.html<br />
<br />
<div class="post-content">
This Linux quick tip will show you many different way to get your
public IP address from the command line using different tools. Since
not all Linux distributions have the same set of packages (programs)
installed, some of these example may or may not work on your system.
For example, default Red Hat and CentOS installations do not have the
dig tool installed.<br />
All of these options will depend on external sources. We will try to
use as many different sources as possible in the examples to ensure
reliability.<br />
<h2>
Using the curl Command</h2>
Curl is a tool used to transfer data to and from a server using many
different supported protocols. Here we will use the HTTPS protocol to
pull a webpage and grep to extract our public IP address. Here are some
examples of how to get your public IP address from the command line
using curl.<br />
WhatismyIP.com<br />
<pre class="wp-block-preformatted">curl https://whatsmyip.com/ -s | grep -oE "\b([0-9]{1,3}.){3}[0-9]{1,3}\b" -m1</pre>
Google.com<br />
<div class="code-block code-block-3" style="clear: both; margin: 8px 0;">
<ins class="adsbygoogle" data-ad-client="ca-pub-8729877671232535" data-ad-format="fluid" data-ad-layout="in-article" data-ad-slot="4973377891" data-adsbygoogle-status="done" style="display: block; height: 190px; text-align: center;"><ins id="aswift_1_expand" style="background-color: transparent; border: none; display: inline-table; height: 190px; margin: 0; padding: 0; position: relative; visibility: visible; width: 759px;"><ins id="aswift_1_anchor" style="background-color: transparent; border: none; display: block; height: 190px; margin: 0; padding: 0; position: relative; visibility: visible; width: 759px;"></ins></ins></ins>
</div>
<pre class="wp-block-preformatted">curl https://www.google.com/search?q=what+is+my+ip+address -s | grep -oE "\b([0-9]{1,3}.){3}[0-9]{1,3}\b" -m1</pre>
ipecho.net<br />
<pre class="wp-block-preformatted">curl -s http://ipecho.net/plain</pre>
akamai.com<br />
<pre class="wp-block-preformatted"><code>curl -s http://whatismyip.akamai.com</code></pre>
<h2>
Using the wget Command</h2>
The wget command is a command line utility for non-interactive
download of files from the web. It supports most HTTP, HTTPS, and FTP
as well as connecting through a HTTP Proxy server. Here are some
examples of how to get your public IP address from the command line
using wget.<br />
ipecho.net<br />
<pre class="wp-block-preformatted">wget -qO- http://ipecho.net/plain</pre>
icanhazip.com<br />
<pre class="wp-block-preformatted">wget -qO - icanhazip.com</pre>
<h2>
Using the dig Command</h2>
The dig command is a command line tool for querying DNS servers. This
utility is not always available. If you want to install dig, it is
usually packaged in bind-utils on Red Hat based distros and dnsutils on
Debian based distros. Here are some examples of how to get your public
IP address from the command line using dig.<br />
google.com<br />
<pre class="wp-block-preformatted">dig @ns1.google.com TXT o-o.myaddr.l.google.com +short</pre>
opendns.com<br />
<pre class="wp-block-preformatted">dig +short myip.opendns.com @resolver1.opendns.com</pre>
<h2>
Using the host Command</h2>
The host command is a simple command line utility for performing DNS
queries. Here are some examples of how to get your public IP address
from the command line using the host command.<br />
opendns.com<br />
<pre class="wp-block-preformatted">host myip.opendns.com resolver1.opendns.com | grep -m2 -oE "\b([0-9]{1,3}.){3}[0-9]{1,3}\b" | tail -n1</pre>
<h2>
Using the nslookup Command</h2>
The nslookup command is tool that queries DNS Servers, much like dig.
This command is available on many operating systems including Linux,
UNIX and Windows. Here are some examples of how to get your public IP
address from the command line using nslookup.<br />
google.com<br />
<pre class="wp-block-preformatted">nslookup -query=TXT o-o.myaddr.l.google.com ns1.google.com | grep -m2 -oE "\b([0-9]{1,3}.){3}[0-9]{1,3}\b" | tail -n1</pre>
opendns.com<br />
<div class="code-block code-block-4" style="clear: both; margin: 8px 0;">
<ins class="adsbygoogle" data-ad-client="ca-pub-8729877671232535" data-ad-format="fluid" data-ad-layout="in-article" data-ad-slot="4973377891" data-adsbygoogle-status="done" style="display: block; height: 190px; text-align: center;"><ins id="aswift_2_expand" style="background-color: transparent; border: none; display: inline-table; height: 190px; margin: 0; padding: 0; position: relative; visibility: visible; width: 759px;"><ins id="aswift_2_anchor" style="background-color: transparent; border: none; display: block; height: 190px; margin: 0; padding: 0; position: relative; visibility: visible; width: 759px;"></ins></ins></ins>
</div>
<pre class="wp-block-preformatted">nslookup myip.opendns.com resolver1.opendns.com | grep -m2 -oE "\b([0-9]{1,3}.){3}[0-9]{1,3}\b" | tail -n1</pre>
<h2>
Conclusion</h2>
There are many different ways to get your public IP address from the
command line. Which you use will mostly depend on what is installed on
your system. Our preferred method would be from a DNS server using the
dig command, but as we stated, dig isn’t always available.<br />
<h2>
References</h2>
<a href="https://curl.haxx.se/">The Curl Project Home Page</a><br />
<a href="https://www.gnu.org/software/wget/">The Wget Project Home Page on Gnu.org</a></div>
</div>
Sameh Attiahttp://www.blogger.com/profile/06829656663776752624noreply@blogger.com0tag:blogger.com,1999:blog-3950073089426506979.post-20763411883126931532019-02-13T00:06:00.001+02:002019-02-13T00:06:30.764+02:00What is nice and how to change the priority of any process in Linux?<div dir="ltr" style="text-align: left;" trbidi="on">
https://www.golinuxhub.com/2014/11/what-is-nice-and-how-to-change-priority.html<br />
<br />
<span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">If you want to change the priority of any process there are two things which you need to consider. There are two terms which will be used in this article i.e. NICE and PRIORITY.</span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">In case you haven't notice when you run<span> </span></span><a href="http://www.golinuxhub.com/2014/03/8-examples-to-help-you-understand-top.html" style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: red; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" target="_blank">top</a><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span> </span>command you get two different values for any process as I have marked in different color below</span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><code style="-webkit-text-stroke-width: 0px; background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat; border: 1px solid rgb(224, 224, 224); box-sizing: border-box; color: #111111; display: block; font-family: Consolas, "Andale Mono", Monaco, Courier, "Courier New", Verdana, sans-serif; font-size: 13px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; line-height: 1.5em; margin: 0px 0px 0em; orphans: 2; outline: 0px; overflow: auto; padding: 0.667em 0.917em; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"> PID USER <span style="box-sizing: border-box; color: blue; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">PR</span><span> </span> <span style="box-sizing: border-box; color: #cc0000; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">NI</span><span> </span> VIRT RES SHR S %CPU %MEM TIME+ COMMAND<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" /> 2899 root <span style="box-sizing: border-box; color: blue; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">20</span><span> </span> <span> </span><span style="box-sizing: border-box; color: #cc0000; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">0<span> </span></span> 2704 1128 868 R 0.3 0.1 0:02.26 top<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" /> 1 root <span style="box-sizing: border-box; color: blue; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">20<span> </span></span> <span style="box-sizing: border-box; color: #cc0000; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;"><span> </span>0</span><span> </span> 2892 1420 1200 S 0.0 0.1 0:01.29 init</code><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">Here PR denoted PRIORITY and NI denotes NICE value where the PRIORITY range varies from 0 to 39 for any process in Linux and NICE value varies from -20 to 19.</span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">`</span><span style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: "courier new", courier, monospace; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;">nice</span><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">' prints or modifies a process's "niceness", a parameter that affects whether the process is scheduled favorably.</span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><b style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;">Syntax</b><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><code style="-webkit-text-stroke-width: 0px; background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat; border: 1px solid rgb(224, 224, 224); box-sizing: border-box; color: #111111; display: block; font-family: Consolas, "Andale Mono", Monaco, Courier, "Courier New", Verdana, sans-serif; font-size: 13px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; line-height: 1.5em; margin: 0px 0px 0em; orphans: 2; outline: 0px; overflow: auto; padding: 0.667em 0.917em; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"># nice [OPTION] [COMMAND [ARG]...]</code><b style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"><br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" /></b><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"></span><b style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;">Example:</b><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">The below command will give a nice value of -20 to 2342 PID</span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><code style="-webkit-text-stroke-width: 0px; background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat; border: 1px solid rgb(224, 224, 224); box-sizing: border-box; color: #111111; display: block; font-family: Consolas, "Andale Mono", Monaco, Courier, "Courier New", Verdana, sans-serif; font-size: 13px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; line-height: 1.5em; margin: 0px 0px 0em; orphans: 2; outline: 0px; overflow: auto; padding: 0.667em 0.917em; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"># nice --20 2342</code><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><b style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"><span style="box-sizing: border-box; color: #cc0000; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">NOTE:</span></b><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span> </span>Use (--) to give a negative nice value and (-) to give a positive nice value</span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">The below command will give a nice value of 20 to 2342 PID</span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><code style="-webkit-text-stroke-width: 0px; background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat; border: 1px solid rgb(224, 224, 224); box-sizing: border-box; color: #111111; display: block; font-family: Consolas, "Andale Mono", Monaco, Courier, "Courier New", Verdana, sans-serif; font-size: 13px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; line-height: 1.5em; margin: 0px 0px 0em; orphans: 2; outline: 0px; overflow: auto; padding: 0.667em 0.917em; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"># nice<span> </span><span style="box-sizing: border-box; color: blue; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">-20</span><span> </span>2342</code><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">Below comes the complicated part so please bear with me.</span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><br />
<center style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;">
<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" /><br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" /></center>
<br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><b style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"><span style="box-sizing: border-box; color: #cc0000; font-family: arial, helvetica, sans-serif; font-size: 15px; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">How do I understand from the NICE value about the priority of the process?</span></b><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">If you consider to look after NICE value to determine the priority of the process then as I said above its value ranges from -20 to 19 where</span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><ul style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; line-height: 1.5; list-style: none; margin: 0.5em 0px; orphans: 2; outline: 0px; padding: 0px 0px 0px 40px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;">
<li style="box-sizing: border-box; line-height: 18px; list-style: none; margin: 13px 0px; outline: 0px; padding: 0px; text-align: left; text-indent: 0px; transition: all 0.3s ease 0s;"><b style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">-20</b><span> </span>(process has high priority and gets more resources, thus slowing down other processes)</li>
<li style="box-sizing: border-box; line-height: 18px; list-style: none; margin: 13px 0px; outline: 0px; padding: 0px; text-align: left; text-indent: 0px; transition: all 0.3s ease 0s;"><b style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">19</b><span> </span>(process has lower priority and runs slowly itself, but has less impact on the speed of other running processes)</li>
</ul>
<span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">So in case you want any process to be given high priority (considering the fact that other processes might get slow) you can change their priority to any negative value upto -20 which will decrease the execution time of the process and the process will complete faster comparatively.</span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><b style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;">Let us see some real time examples</b><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">Run a process with nice value as -20</span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><code style="-webkit-text-stroke-width: 0px; background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat; border: 1px solid rgb(224, 224, 224); box-sizing: border-box; color: #111111; display: block; font-family: Consolas, "Andale Mono", Monaco, Courier, "Courier New", Verdana, sans-serif; font-size: 13px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; line-height: 1.5em; margin: 0px 0px 0em; orphans: 2; outline: 0px; overflow: auto; padding: 0.667em 0.917em; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"># time nice --20 seq 4234567 > file.txt<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" />real <span style="box-sizing: border-box; color: blue; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">0m2.572s</span><br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" />user <span style="box-sizing: border-box; color: blue; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">0m2.519s</span><br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" />sys <span> </span><span style="box-sizing: border-box; color: blue; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">0m0.047s</span></code><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">Deleted the file and ran the same process with nice value of +20</span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><code style="-webkit-text-stroke-width: 0px; background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat; border: 1px solid rgb(224, 224, 224); box-sizing: border-box; color: #111111; display: block; font-family: Consolas, "Andale Mono", Monaco, Courier, "Courier New", Verdana, sans-serif; font-size: 13px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; line-height: 1.5em; margin: 0px 0px 0em; orphans: 2; outline: 0px; overflow: auto; padding: 0.667em 0.917em; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"># time nice -20 seq 4234567 > file.txt<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" />real <span style="box-sizing: border-box; color: blue; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">0m2.693s</span><br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" />user <span style="box-sizing: border-box; color: blue; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">0m2.626s</span><br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" />sys <span> </span><span style="box-sizing: border-box; color: blue; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">0m0.059s</span></code><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">As you can see the former command executed faster with a negative nice value.</span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><table border="1" cellpadding="0" cellspacing="0" class="MsoTable15Grid4Accent5" style="-webkit-text-stroke-width: 0px; background-color: white; border-collapse: collapse; border: none; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"><tbody style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">
<tr style="box-sizing: border-box; height: 8.85pt; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;"><td style="background: rgb(68, 114, 196); border: 1pt solid rgb(68, 114, 196); box-sizing: border-box; height: 8.85pt; margin: 0px; outline: 0px; padding: 0in 5.4pt; transition: all 0.3s ease 0s; width: 81.6pt;" width="109"><div align="center" class="MsoNormal" style="box-sizing: border-box; margin: 0px 0px 0.0001pt; outline: 0px; padding: 0px; text-align: center; transition: all 0.3s ease 0s;">
<b style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;"><span style="box-sizing: border-box; color: white; font-size: 9pt; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">Value</span></b></div>
</td><td style="background: rgb(68, 114, 196); border: 1pt solid rgb(68, 114, 196); box-sizing: border-box; height: 8.85pt; margin: 0px; outline: 0px; padding: 0in 5.4pt; transition: all 0.3s ease 0s; width: 385.15pt;" width="514"><div align="center" class="MsoNormal" style="box-sizing: border-box; margin: 0px 0px 0.0001pt; outline: 0px; padding: 0px; text-align: center; transition: all 0.3s ease 0s;">
<b style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;"><span style="box-sizing: border-box; color: white; font-size: 9pt; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">Description</span></b></div>
</td></tr>
<tr style="box-sizing: border-box; height: 17.05pt; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;"><td style="background: rgb(217, 226, 243); border: 1pt solid rgb(142, 170, 219); box-sizing: border-box; height: 17.05pt; margin: 0px; outline: 0px; padding: 0in 5.4pt; transition: all 0.3s ease 0s; width: 81.6pt;" width="109"><div align="center" class="MsoNormal" style="box-sizing: border-box; margin: 0px 0px 0.0001pt; outline: 0px; padding: 0px; text-align: center; transition: all 0.3s ease 0s;">
<b style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;"><span style="box-sizing: border-box; font-size: 9pt; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">real</span></b></div>
</td><td style="background: rgb(217, 226, 243); border-bottom: 1pt solid rgb(142, 170, 219); border-left: none; border-right: 1pt solid rgb(142, 170, 219); border-top: none; box-sizing: border-box; height: 17.05pt; margin: 0px; outline: 0px; padding: 0in 5.4pt; transition: all 0.3s ease 0s; width: 385.15pt;" width="514"><div class="MsoNormal" style="box-sizing: border-box; margin: 0px 0px 0.0001pt; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">
<span style="box-sizing: border-box; font-size: 9pt; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">It represents time taken by command to execute since its initiation to its termination</span></div>
</td></tr>
<tr style="box-sizing: border-box; height: 17.8pt; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;"><td style="border: 1pt solid rgb(142, 170, 219); box-sizing: border-box; height: 17.8pt; margin: 0px; outline: 0px; padding: 0in 5.4pt; transition: all 0.3s ease 0s; width: 81.6pt;" width="109"><div align="center" class="MsoNormal" style="box-sizing: border-box; margin: 0px 0px 0.0001pt; outline: 0px; padding: 0px; text-align: center; transition: all 0.3s ease 0s;">
<b style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;"><span style="box-sizing: border-box; font-size: 9pt; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">user</span></b></div>
</td><td style="border-bottom: 1pt solid rgb(142, 170, 219); border-left: none; border-right: 1pt solid rgb(142, 170, 219); border-top: none; box-sizing: border-box; height: 17.8pt; margin: 0px; outline: 0px; padding: 0in 5.4pt; transition: all 0.3s ease 0s; width: 385.15pt;" width="514"><div class="MsoNormal" style="box-sizing: border-box; margin: 0px 0px 0.0001pt; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">
<span style="box-sizing: border-box; font-size: 9pt; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">It represents the amount of time that command/program took to execute its own code</span></div>
</td></tr>
<tr style="box-sizing: border-box; height: 16.25pt; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;"><td style="background: rgb(217, 226, 243); border: 1pt solid rgb(142, 170, 219); box-sizing: border-box; height: 16.25pt; margin: 0px; outline: 0px; padding: 0in 5.4pt; transition: all 0.3s ease 0s; width: 81.6pt;" width="109"><div align="center" class="MsoNormal" style="box-sizing: border-box; margin: 0px 0px 0.0001pt; outline: 0px; padding: 0px; text-align: center; transition: all 0.3s ease 0s;">
<b style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;"><span style="box-sizing: border-box; font-size: 9pt; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">sys</span></b></div>
</td><td style="background: rgb(217, 226, 243); border-bottom: 1pt solid rgb(142, 170, 219); border-left: none; border-right: 1pt solid rgb(142, 170, 219); border-top: none; box-sizing: border-box; height: 16.25pt; margin: 0px; outline: 0px; padding: 0in 5.4pt; transition: all 0.3s ease 0s; width: 385.15pt;" width="514"><div class="MsoNormal" style="box-sizing: border-box; margin: 0px 0px 0.0001pt; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">
<span style="box-sizing: border-box; font-size: 9pt; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">It represents time taken by Unix to fire the command</span></div>
</td></tr>
</tbody></table>
<b style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"><span style="box-sizing: border-box; color: #cc0000; font-family: arial, helvetica, sans-serif; font-size: 15px; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;"><br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" /></span></b><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"></span><b style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"><span style="box-sizing: border-box; color: #cc0000; font-family: arial, helvetica, sans-serif; font-size: 15px; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">How do I understand from the PRIORITY value about the priority of the process?</span></b><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">Again in case you consider to look at PR value for understanding the priority of the process the value ranges from 0 to 39 where</span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><ul style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; line-height: 1.5; list-style: none; margin: 0.5em 0px; orphans: 2; outline: 0px; padding: 0px 0px 0px 40px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;">
<li style="box-sizing: border-box; line-height: 18px; list-style: none; margin: 13px 0px; outline: 0px; padding: 0px; text-align: left; text-indent: 0px; transition: all 0.3s ease 0s;"><b style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">0</b><span> </span>(process has high priority and gets more resources, thus slowing down other processes)</li>
<li style="box-sizing: border-box; line-height: 18px; list-style: none; margin: 13px 0px; outline: 0px; padding: 0px; text-align: left; text-indent: 0px; transition: all 0.3s ease 0s;"><b style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">39</b><span> </span>(process has lower priority and runs slowly itself, but has less impact on the speed of other running processes)</li>
</ul>
<b style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;">Let us see some real time examples</b><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><b style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"><br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" /></b><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">Run a process with<span> </span></span><b style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;">positive</b><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span> </span>nice value</span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><code style="-webkit-text-stroke-width: 0px; background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat; border: 1px solid rgb(224, 224, 224); box-sizing: border-box; color: #111111; display: block; font-family: Consolas, "Andale Mono", Monaco, Courier, "Courier New", Verdana, sans-serif; font-size: 13px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; line-height: 1.5em; margin: 0px 0px 0em; orphans: 2; outline: 0px; overflow: auto; padding: 0.667em 0.917em; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"># time nice<span> </span><span style="box-sizing: border-box; color: #cc0000; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">-20</span><span> </span>seq 42345671 > file.txt<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" />real 0m27.548s<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" />user 0m26.091s<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" />sys 0m1.004s</code><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">As you see we are running a process with nice value +20 for which the NI appears 19 and PR as 39 which means the process will have the least priority and it will give priority to other process with higher nice value to use the system resources for their execution.</span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><code style="-webkit-text-stroke-width: 0px; background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat; border: 1px solid rgb(224, 224, 224); box-sizing: border-box; color: #111111; display: block; font-family: Consolas, "Andale Mono", Monaco, Courier, "Courier New", Verdana, sans-serif; font-size: 13px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; line-height: 1.5em; margin: 0px 0px 0em; orphans: 2; outline: 0px; overflow: auto; padding: 0.667em 0.917em; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"># top<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" /> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" /> 3192 root <span style="box-sizing: border-box; color: #cc0000; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">39 19</span><span> </span> 4084 568 512 R 99.8 0.1 0:03.29 seq<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" /> 1 root <span style="box-sizing: border-box; color: #cc0000; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">20 0<span> </span></span> 2892 1420 1200 S 0.0 0.1 0:01.29 init</code><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">Similarly for a<span> </span></span><b style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;">negative<span> </span></b><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">nice value</span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><code style="-webkit-text-stroke-width: 0px; background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat; border: 1px solid rgb(224, 224, 224); box-sizing: border-box; color: #111111; display: block; font-family: Consolas, "Andale Mono", Monaco, Courier, "Courier New", Verdana, sans-serif; font-size: 13px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; line-height: 1.5em; margin: 0px 0px 0em; orphans: 2; outline: 0px; overflow: auto; padding: 0.667em 0.917em; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"># time nice<span> </span><span style="box-sizing: border-box; color: #cc0000; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">--20</span><span> </span>seq 42345671 > file.txt<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" />real 0m27.397s<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" />user 0m26.555s<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" />sys 0m0.600s</code><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">As you see the NI value is changed to -20 for PR value of 0.</span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><code style="-webkit-text-stroke-width: 0px; background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat; border: 1px solid rgb(224, 224, 224); box-sizing: border-box; color: #111111; display: block; font-family: Consolas, "Andale Mono", Monaco, Courier, "Courier New", Verdana, sans-serif; font-size: 13px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; line-height: 1.5em; margin: 0px 0px 0em; orphans: 2; outline: 0px; overflow: auto; padding: 0.667em 0.917em; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"># top<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" /> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" /> 3205 root <span> </span><span style="box-sizing: border-box; color: #cc0000; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">0 -20</span><span> </span> 4084 568 512 R 75.0 0.1 0:02.26 seq<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" /> 1 root <span style="box-sizing: border-box; color: #cc0000; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">20 0</span><span> </span> 2892 1420 1200 S 0.0 0.1 0:01.29 init</code><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><span style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: #cc0000; font-family: arial, helvetica, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"><b style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;"><br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" /></b></span><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"></span><span style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: #cc0000; font-family: arial, helvetica, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"><b style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">What would happen if I give a nice value out of range i.e. -20 to 19 to any process?</b></span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">It can happen but your system won't understand any value other than -20 to 19 and will take the default value of -20 for high priority and 19 for least priority.</span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><center style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;">
<div id="gpt_unit_/21751243814/GOLINUXHUB_STD_IAB_DISPLAY_GOLINUXHUB.COM_320X480_GLOBAL_DFPSS_ST_5_ad_container" style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">
<ins style="border: 0px; box-sizing: border-box; display: inline-table; height: 480px; margin: 0px; outline: 0px; padding: 0px; position: relative; text-decoration: underline; transition: all 0.3s ease 0s; vertical-align: bottom; width: 320px;"><ins style="border: 0px; box-sizing: border-box; display: block; height: 480px; margin: 0px; outline: 0px; padding: 0px; position: relative; text-decoration: underline; transition: all 0.3s ease 0s; width: 320px;"></ins></ins></div>
<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" /></center>
<br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><b style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;">Let us see some real time examples</b><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">Assigning a nice value of -40</span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><code style="-webkit-text-stroke-width: 0px; background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat; border: 1px solid rgb(224, 224, 224); box-sizing: border-box; color: #111111; display: block; font-family: Consolas, "Andale Mono", Monaco, Courier, "Courier New", Verdana, sans-serif; font-size: 13px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; line-height: 1.5em; margin: 0px 0px 0em; orphans: 2; outline: 0px; overflow: auto; padding: 0.667em 0.917em; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"># time nice<span> </span><span style="box-sizing: border-box; color: blue; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">--40</span><span> </span>seq 42345671 > file.txt</code><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">But still as you see the system is taking the nice value as -20 which is the highest recognizable value</span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><code style="-webkit-text-stroke-width: 0px; background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat; border: 1px solid rgb(224, 224, 224); box-sizing: border-box; color: #111111; display: block; font-family: Consolas, "Andale Mono", Monaco, Courier, "Courier New", Verdana, sans-serif; font-size: 13px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; line-height: 1.5em; margin: 0px 0px 0em; orphans: 2; outline: 0px; overflow: auto; padding: 0.667em 0.917em; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"># top<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" /> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" /> 3226 root <span> </span><span style="box-sizing: border-box; color: blue; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">0</span><span> </span>-20 4084 568 512 R 7.6 0.1 0:00.23 seq<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" /> 1600 root 20 0 38616 3976 3284 S 0.3 0.4 0:01.68 vmtoolsd</code><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">Assigning a nice value of 40</span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><code style="-webkit-text-stroke-width: 0px; background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat; border: 1px solid rgb(224, 224, 224); box-sizing: border-box; color: #111111; display: block; font-family: Consolas, "Andale Mono", Monaco, Courier, "Courier New", Verdana, sans-serif; font-size: 13px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; line-height: 1.5em; margin: 0px 0px 0em; orphans: 2; outline: 0px; overflow: auto; padding: 0.667em 0.917em; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"># time nice<span> </span><span style="box-sizing: border-box; color: blue; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">-40</span><span> </span>seq 42345671 > file.txt</code><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">Naah, it didn't worked either as<span> </span></span><a href="http://www.golinuxhub.com/2014/03/8-examples-to-help-you-understand-top.html" style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: red; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" target="_blank">top</a><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span> </span>shows the process is using 19 as the nice value.</span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><code style="-webkit-text-stroke-width: 0px; background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat; border: 1px solid rgb(224, 224, 224); box-sizing: border-box; color: #111111; display: block; font-family: Consolas, "Andale Mono", Monaco, Courier, "Courier New", Verdana, sans-serif; font-size: 13px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; line-height: 1.5em; margin: 0px 0px 0em; orphans: 2; outline: 0px; overflow: auto; padding: 0.667em 0.917em; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"># top<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" /> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" /> 3235 root <span style="box-sizing: border-box; color: blue; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">39</span><span> </span> 19 4084 568 512 R 62.0 0.1 0:01.87 seq<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" /> 2899 root 20 0 2704 1128 868 R 0.7 0.1 0:08.66 top</code><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">So I guess I made my point.</span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">If you want to manually check the nice value along with the CPU and memory usage bu any process then use this command</span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><code style="-webkit-text-stroke-width: 0px; background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat; border: 1px solid rgb(224, 224, 224); box-sizing: border-box; color: #111111; display: block; font-family: Consolas, "Andale Mono", Monaco, Courier, "Courier New", Verdana, sans-serif; font-size: 13px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; line-height: 1.5em; margin: 0px 0px 0em; orphans: 2; outline: 0px; overflow: auto; padding: 0.667em 0.917em; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"># ps -o pid,pcpu,pmem,ni -p 88<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" /> PID %CPU %MEM NI<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" /> 88 0.0 0.0 -10</code><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">This will show you PID, %CPU,%MEM and nice value along with the process ID where 88 is the process id.</span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><center style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;">
<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" /></center>
<br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><span style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: #cc0000; font-family: arial, helvetica, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"><b style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">How to change the nice value of a running process?</b></span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">In the above examples I started the process with a pre-defined nice value but what if the process is running and you want to change its nice value. For this we have another command i.e. renice</span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><b style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;">Syntax</b><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><code style="-webkit-text-stroke-width: 0px; background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat; border: 1px solid rgb(224, 224, 224); box-sizing: border-box; color: #111111; display: block; font-family: Consolas, "Andale Mono", Monaco, Courier, "Courier New", Verdana, sans-serif; font-size: 13px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; line-height: 1.5em; margin: 0px 0px 0em; orphans: 2; outline: 0px; overflow: auto; padding: 0.667em 0.917em; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"># renice [-n] priority [[-p] pid ...]</code><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><b style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;">Some Examples:</b><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><code style="-webkit-text-stroke-width: 0px; background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat; border: 1px solid rgb(224, 224, 224); box-sizing: border-box; color: #111111; display: block; font-family: Consolas, "Andale Mono", Monaco, Courier, "Courier New", Verdana, sans-serif; font-size: 13px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; line-height: 1.5em; margin: 0px 0px 0em; orphans: 2; outline: 0px; overflow: auto; padding: 0.667em 0.917em; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"># seq 4234567112 > file.txt</code><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><code style="-webkit-text-stroke-width: 0px; background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat; border: 1px solid rgb(224, 224, 224); box-sizing: border-box; color: #111111; display: block; font-family: Consolas, "Andale Mono", Monaco, Courier, "Courier New", Verdana, sans-serif; font-size: 13px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; line-height: 1.5em; margin: 0px 0px 0em; orphans: 2; outline: 0px; overflow: auto; padding: 0.667em 0.917em; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"># top<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" /> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" /> 3354 root 20 0 4084 568 512 R 95.4 0.1 0:07.19 seq</code><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">Changing the nice value to -5</span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><code style="-webkit-text-stroke-width: 0px; background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat; border: 1px solid rgb(224, 224, 224); box-sizing: border-box; color: #111111; display: block; font-family: Consolas, "Andale Mono", Monaco, Courier, "Courier New", Verdana, sans-serif; font-size: 13px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; line-height: 1.5em; margin: 0px 0px 0em; orphans: 2; outline: 0px; overflow: auto; padding: 0.667em 0.917em; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"># renice<span> </span><span style="box-sizing: border-box; color: blue; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">-n -5</span><span> </span>-p 3354<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" />3354: old priority<span> </span><span style="box-sizing: border-box; color: #cc0000; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">0</span>, new priority<span> </span><span style="box-sizing: border-box; color: blue; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">-5</span></code><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><code style="-webkit-text-stroke-width: 0px; background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat; border: 1px solid rgb(224, 224, 224); box-sizing: border-box; color: #111111; display: block; font-family: Consolas, "Andale Mono", Monaco, Courier, "Courier New", Verdana, sans-serif; font-size: 13px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; line-height: 1.5em; margin: 0px 0px 0em; orphans: 2; outline: 0px; overflow: auto; padding: 0.667em 0.917em; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"># top<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" /> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" /> 3354 root 15 <span style="box-sizing: border-box; color: blue; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">-5</span><span> </span> 4084 568 512 R 99.7 0.1 0:30.26 seq</code><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">Changing the nice value to 10</span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><code style="-webkit-text-stroke-width: 0px; background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat; border: 1px solid rgb(224, 224, 224); box-sizing: border-box; color: #111111; display: block; font-family: Consolas, "Andale Mono", Monaco, Courier, "Courier New", Verdana, sans-serif; font-size: 13px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; line-height: 1.5em; margin: 0px 0px 0em; orphans: 2; outline: 0px; overflow: auto; padding: 0.667em 0.917em; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"># renice<span> </span><span style="box-sizing: border-box; color: blue; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">-n 10</span><span> </span>-p 3354<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" />3354: old priority<span> </span><span style="box-sizing: border-box; color: #cc0000; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">-5</span>, new priority<span> </span><span style="box-sizing: border-box; color: blue; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">10</span></code><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><code style="-webkit-text-stroke-width: 0px; background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat; border: 1px solid rgb(224, 224, 224); box-sizing: border-box; color: #111111; display: block; font-family: Consolas, "Andale Mono", Monaco, Courier, "Courier New", Verdana, sans-serif; font-size: 13px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; line-height: 1.5em; margin: 0px 0px 0em; orphans: 2; outline: 0px; overflow: auto; padding: 0.667em 0.917em; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"># top<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" /> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" /> 3354 root 30 <span style="box-sizing: border-box; color: blue; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">10</span><span> </span> 4084 568 512 R 99.1 0.1 0:51.16 seq</code><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">Changing the nice value to -15</span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><code style="-webkit-text-stroke-width: 0px; background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat; border: 1px solid rgb(224, 224, 224); box-sizing: border-box; color: #111111; display: block; font-family: Consolas, "Andale Mono", Monaco, Courier, "Courier New", Verdana, sans-serif; font-size: 13px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; line-height: 1.5em; margin: 0px 0px 0em; orphans: 2; outline: 0px; overflow: auto; padding: 0.667em 0.917em; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"># renice -n<span> </span><span style="box-sizing: border-box; color: blue; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">-15</span><span> </span>-p 3354<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" />3354: old priority<span> </span><span style="box-sizing: border-box; color: #cc0000; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">10</span>, new priority<span> </span><span style="box-sizing: border-box; color: blue; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">-15</span></code><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><code style="-webkit-text-stroke-width: 0px; background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat; border: 1px solid rgb(224, 224, 224); box-sizing: border-box; color: #111111; display: block; font-family: Consolas, "Andale Mono", Monaco, Courier, "Courier New", Verdana, sans-serif; font-size: 13px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; line-height: 1.5em; margin: 0px 0px 0em; orphans: 2; outline: 0px; overflow: auto; padding: 0.667em 0.917em; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"># top<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" /> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" /> 3354 root 5<span> </span><span style="box-sizing: border-box; color: blue; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">-15</span><span> </span> 4084 568 512 R 98.0 0.1 1:12.04 seq</code><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><center style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;">
<div id="gpt_unit_/21751243814/GOLINUXHUB_STD_IAB_DISPLAY_GOLINUXHUB.COM_336X280_GLOBAL_ST_7_ad_container" style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">
<ins style="border: 0px; box-sizing: border-box; display: inline-table; height: 280px; margin: 0px; outline: 0px; padding: 0px; position: relative; text-decoration: underline; transition: all 0.3s ease 0s; vertical-align: bottom; width: 336px;"><ins style="border: 0px; box-sizing: border-box; display: block; height: 280px; margin: 0px; outline: 0px; padding: 0px; position: relative; text-decoration: underline; transition: all 0.3s ease 0s; width: 336px;"></ins></ins></div>
<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" /></center>
<br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><span style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: #cc0000; font-family: arial, helvetica, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"><b style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;"><br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" /></b></span><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"></span><span style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: #cc0000; font-family: arial, helvetica, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"><b style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">How to change the nice value of any user?</b></span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">Suppose you do not want a particular user to use much of your system resource, I thoses cases you can assign low nice value so that every process started by that user will use less system resources.</span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><code style="-webkit-text-stroke-width: 0px; background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat; border: 1px solid rgb(224, 224, 224); box-sizing: border-box; color: #111111; display: block; font-family: Consolas, "Andale Mono", Monaco, Courier, "Courier New", Verdana, sans-serif; font-size: 13px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; line-height: 1.5em; margin: 0px 0px 0em; orphans: 2; outline: 0px; overflow: auto; padding: 0.667em 0.917em; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"># renice -n 5 -u<span> </span><span style="box-sizing: border-box; color: blue; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">deepak</span><br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" />500: old priority 0, new priority 5</code><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">Execute a process by user "</span><span style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: "courier new", courier, monospace; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;">deepak</span><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">"</span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><code style="-webkit-text-stroke-width: 0px; background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat; border: 1px solid rgb(224, 224, 224); box-sizing: border-box; color: #111111; display: block; font-family: Consolas, "Andale Mono", Monaco, Courier, "Courier New", Verdana, sans-serif; font-size: 13px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; line-height: 1.5em; margin: 0px 0px 0em; orphans: 2; outline: 0px; overflow: auto; padding: 0.667em 0.917em; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;">[<span style="box-sizing: border-box; color: blue; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">deepak</span>@test ~]$ seq 12345678 > file.txt</code><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">Verify the NI value for "</span><span style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: "courier new", courier, monospace; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;">deepak</span><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">"</span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><code style="-webkit-text-stroke-width: 0px; background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat; border: 1px solid rgb(224, 224, 224); box-sizing: border-box; color: #111111; display: block; font-family: Consolas, "Andale Mono", Monaco, Courier, "Courier New", Verdana, sans-serif; font-size: 13px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; line-height: 1.5em; margin: 0px 0px 0em; orphans: 2; outline: 0px; overflow: auto; padding: 0.667em 0.917em; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"># top<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" /> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" /> 4414<span> </span><span style="box-sizing: border-box; color: blue; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">deepak </span><span style="box-sizing: border-box; color: #cc0000; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">25 5</span><span> </span> 4084 588 532 R 97.3 0.1 0:05.54 seq</code><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><span style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: #cc0000; font-family: arial, helvetica, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"><b style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;"><br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" /></b></span><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"></span><span style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: #cc0000; font-family: arial, helvetica, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"><b style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">How to change the nice value of any user?</b></span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">The same magic can be done for any particular group as well using the below command</span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><code style="-webkit-text-stroke-width: 0px; background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat; border: 1px solid rgb(224, 224, 224); box-sizing: border-box; color: #111111; display: block; font-family: Consolas, "Andale Mono", Monaco, Courier, "Courier New", Verdana, sans-serif; font-size: 13px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; line-height: 1.5em; margin: 0px 0px 0em; orphans: 2; outline: 0px; overflow: auto; padding: 0.667em 0.917em; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"># renice -n 5 -g<span> </span><span style="box-sizing: border-box; color: blue; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">work</span></code><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">The above command will change the default nice value of "work" group to 5 for any process running under their ownership.</span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><span style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: #cc0000; font-family: arial, helvetica, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"><b style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">What is the default NI value for any process?</b></span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">The default NI value is 0 and PR value is 20 for any process running under Linux.</span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><b style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"><span style="box-sizing: border-box; color: #cc0000; font-family: arial, helvetica, sans-serif; font-size: 15px; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">How to change the nice value for any user or group permanently?</span></b><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">The above shown examples are terminal based hence temporary. As soon as you reboot your machine the default nice value would be applicable for the defined user.</span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">To make these changes permanent follow the below steps</span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><b style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"><span style="box-sizing: border-box; color: #cc0000; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;">NOTE:</span></b><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span> </span>You can either user PR value or NI value to set the priority. I would suggest to use NICE value</span><br style="-webkit-text-stroke-width: 0px; background-color: white; box-sizing: border-box; color: black; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;" /><code style="-webkit-text-stroke-width: 0px; background-attachment: scroll; background-color: #eeeeee; background-image: none; background-position: 0px 0px; background-repeat: repeat; border: 1px solid rgb(224, 224, 224); box-sizing: border-box; color: #111111; display: block; font-family: Consolas, "Andale Mono", Monaco, Courier, "Courier New", Verdana, sans-serif; font-size: 13px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; line-height: 1.5em; margin: 0px 0px 0em; orphans: 2; outline: 0px; overflow: auto; padding: 0.667em 0.917em; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; transition: all 0.3s ease 0s; white-space: normal; widows: 2; word-spacing: 0px;"># vi /etc/security/limits.conf<br style="box-sizing: border-box; margin: 0px; outline: 0px; padding: 0px; transition: all 0.3s ease 0s;" />deepak hard priority 5</code><span style="-webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font-family: Calibri, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">This will set hard priority for user deepak as "5"</span></div>
Sameh Attiahttp://www.blogger.com/profile/06829656663776752624noreply@blogger.com0tag:blogger.com,1999:blog-3950073089426506979.post-65909901964986573782018-10-30T23:58:00.001+02:002018-10-30T23:58:10.831+02:008 Common Uses of the Linux Touch Command<div dir="ltr" style="text-align: left;" trbidi="on">
https://vitux.com/8-common-uses-of-the-linux-touch-command<br />
<br />
The Linux touch command can be used for much more than simply
creating an empty file on Linux. You can use it to change the timestamp
of existing files including their access as well as modification times.
This article presents 8 scenarios where you can utilize the touch
command through your Linux Terminal.<br />
We have run the commands and
procedures mentioned in this article on a Ubuntu 18.04 LTS system. Since
the touch command is a command line utility, we will be using the
Ubuntu Terminal for this article. You can open the Terminal either
through the system Dash or the Ctrl+Alt+T shortcut.<br />
<h2>
1. Create a single empty file with the touch command</h2>
The
simplest and the most basic use of the touch command is to create an
empty file through the command line. If you are a Terminal-savvy person,
you can quickly create a new file in the command line through the
following command:<br />
<em>$ touch “filename”</em><br />
Example:<br />
<pre>$ touch samplefile</pre>
In
the following example, I have created an empty file with the name
“samplefile” through the touch command. I have then used the ls command
to view the presence of the file on my system as the touch command does
not prompt if the file has been created or not.<br />
<img alt="Create empty file with touch command" class="aligncenter wp-image-2089 lazy-loaded" data-lazy-type="image" data-src="https://vitux.com/wp-content/uploads/2018/10/word-image-132.png" data-srcset="" height="147" src="https://vitux.com/wp-content/uploads/2018/10/word-image-132.png" width="668" /><br />
<h2>
2. Create multiple files at once with touch command</h2>
Although
the cat command and the standard redirect symbol are also ways to
create files through the command line, the touch command takes an edge
because you can create multiple files with it at once. You can use the
following syntax in order to create multiple files through the touch
command:<br />
<pre>$ touch samplefile1 samplefile2 samplefile3 ….</pre>
In
the following example I have created three files simultaneously through
the touch command and then used the ls command in order to view the
presence of those files:<br />
<img alt="Create multiple files with touch command" class="aligncenter wp-image-2090 lazy-loaded" data-lazy-type="image" data-src="https://vitux.com/wp-content/uploads/2018/10/word-image-133.png" data-srcset="" height="149" src="https://vitux.com/wp-content/uploads/2018/10/word-image-133.png" width="643" /><br />
<h2>
3. Force avoid creating a new file with touch command</h2>
At
times there is a need to avoid creating a new file if it already does
not exist. In that case, you can use the ‘-c’ option with the touch
command as follows:<br />
<pre>$ touch -c “filename”</pre>
In the following example, I have used the touch command to forcefully avoid the creation of the mentioned new file.<br />
<img class="wp-image-2091 aligncenter lazy-loaded" data-lazy-type="image" data-src="https://vitux.com/wp-content/uploads/2018/10/word-image-134.png" data-srcset="" src="https://vitux.com/wp-content/uploads/2018/10/word-image-134.png" /><br />
When I use the ls command to list that file, the following output verifies that such a file does not exist in my system.<br />
<img class="wp-image-2092 aligncenter lazy-loaded" data-lazy-type="image" data-src="https://vitux.com/wp-content/uploads/2018/10/word-image-135.png" data-srcset="" src="https://vitux.com/wp-content/uploads/2018/10/word-image-135.png" /><br />
<h2>
4. Change both access and modification times of a file</h2>
Another use of the touch command is to change both the access time and the modification time of a file.<br />
Let
us present an example to show how you can do it. I created a file named
“testfile” through the touch command and viewed its statistics through
the stat command:<br />
<img alt="Change modification time of file" class="aligncenter wp-image-2093 lazy-loaded" data-lazy-type="image" data-src="https://vitux.com/wp-content/uploads/2018/10/word-image-136.png" data-srcset="" height="182" src="https://vitux.com/wp-content/uploads/2018/10/word-image-136.png" width="622" /><br />
Then I entered the following touch command:<br />
<pre>$ touch testfile</pre>
This
touch command changed the access and modification time to the time when
I ran the touch command again for the “testfile”. You can see the
changed access and modification times in the following image:<br />
<img alt="File modification and access time changed" class="aligncenter wp-image-2094 lazy-loaded" data-lazy-type="image" data-src="https://vitux.com/wp-content/uploads/2018/10/word-image-137.png" data-srcset="" height="173" src="https://vitux.com/wp-content/uploads/2018/10/word-image-137.png" width="658" /><br />
<h2>
5. Change either access time or modification time</h2>
Instead of changing both the access and modification times, we can choose to change only one of them through the touch command.<br />
In the following example, I created a file by the name of “samplefile” and viewed it statistics through the stat command:<br />
<img alt="File details" class="aligncenter wp-image-2095 lazy-loaded" data-lazy-type="image" data-src="https://vitux.com/wp-content/uploads/2018/10/word-image-138.png" data-srcset="" height="208" src="https://vitux.com/wp-content/uploads/2018/10/word-image-138.png" width="630" /><br />
I can change only the access time of this file by using the ‘-a’ option through the touch command on this file:<br />
<pre>$ touch -a samplefile</pre>
The
output of the stat command now shows that the access time has been
changed to the time when I ran the touch command with the ‘-a’ option:<br />
<img alt="Change access time" class="aligncenter wp-image-2096 lazy-loaded" data-lazy-type="image" data-src="https://vitux.com/wp-content/uploads/2018/10/word-image-139.png" data-srcset="" height="182" src="https://vitux.com/wp-content/uploads/2018/10/word-image-139.png" width="526" /><br />
I can change only the modification time of this file by using the ‘-m’ option through the touch command on this file:<br />
<pre>$ touch -m samplefile</pre>
The
output of the stat command now shows that the modification time has
been changed to the time when I ran the touch command with the ‘-m’
option:<br />
<img alt="Change modification time" class="aligncenter wp-image-2097 lazy-loaded" data-lazy-type="image" data-src="https://vitux.com/wp-content/uploads/2018/10/word-image-140.png" data-srcset="" height="177" src="https://vitux.com/wp-content/uploads/2018/10/word-image-140.png" width="663" /><br />
<h2>
6. How to copy access & modification time from one file to another file</h2>
Let us suppose we have a file named samplefileA:<br />
<img alt="First sample file" class="aligncenter wp-image-2098 lazy-loaded" data-lazy-type="image" data-src="https://vitux.com/wp-content/uploads/2018/10/word-image-141.png" data-srcset="" height="195" src="https://vitux.com/wp-content/uploads/2018/10/word-image-141.png" width="719" /><br />
And another file named samplefileB:<br />
<img alt="Second sample file" class="aligncenter wp-image-2099 lazy-loaded" data-lazy-type="image" data-src="https://vitux.com/wp-content/uploads/2018/10/word-image-142.png" data-srcset="" height="162" src="https://vitux.com/wp-content/uploads/2018/10/word-image-142.png" width="717" /><br />
If
you want to change the access & modification time of samplefileA to
that of the samplefileB, you can sue the touch command as follows:<br />
<pre>$ touch samplefileA -r sampleFileB</pre>
<img alt="Copy modification and access time from file a to b" class="aligncenter wp-image-2100 lazy-loaded" data-lazy-type="image" data-src="https://vitux.com/wp-content/uploads/2018/10/word-image-143.png" data-srcset="" height="180" src="https://vitux.com/wp-content/uploads/2018/10/word-image-143.png" width="722" /><br />
The
output of the stat command in the above image shows that the
samplefileA now has the same access and modify values as that of
samplefileB.<br />
<h2>
7. Create a new file with a specified timestamp</h2>
In
order to create a new empty file with a specified timestamp instead of
the actual time you created it, you can use the following syntax of the
touch command:<br />
<pre>$ touch -t YYMMDDHHMM.SS “filename”</pre>
The
following example shows how the stat command on my samplefile shows that
its access and modification times are based on the timestamp I provided
while creating it through the touch command:<br />
<img alt="Create a new file with a specified timestamp" class="aligncenter wp-image-2101 lazy-loaded" data-lazy-type="image" data-src="https://vitux.com/wp-content/uploads/2018/10/word-image-144.png" data-srcset="" height="210" src="https://vitux.com/wp-content/uploads/2018/10/word-image-144.png" width="553" /><br />
<h2>
8. Change timestamp of a file to some other time</h2>
You can change the timestamp of an existing file to some other time using the following syntax of the touch command:<br />
<pre>$ touch -c -t YYMMDDHHMM.SS “filename”</pre>
In
the following example, I have changed the timestamp of an existing file
through the touch command and then verified the changes through the
stat command on that sample file:<br />
<img alt="Change timestamp of a file to some other time" class="aligncenter wp-image-2102 lazy-loaded" data-lazy-type="image" data-src="https://vitux.com/wp-content/uploads/2018/10/word-image-145.png" data-srcset="" height="185" src="https://vitux.com/wp-content/uploads/2018/10/word-image-145.png" width="533" /><br />
Through
the basic yet useful scenarios we presented in this article, you can
begin to master the touch command and use it for quickly performing some
seemingly complex tasks through the Linux command line.</div>
Sameh Attiahttp://www.blogger.com/profile/06829656663776752624noreply@blogger.com0tag:blogger.com,1999:blog-3950073089426506979.post-16418757667774802782018-10-30T23:36:00.004+02:002018-10-30T23:36:31.865+02:00How to Multi-Task in Linux with the Command Line<div dir="ltr" style="text-align: left;" trbidi="on">
https://www.rosehosting.com/blog/how-to-multi-task-in-linux-with-the-command-line<br />
<br />
<br />
<br />
<a href="https://www.rosehosting.com/blog/wp-content/uploads/2018/10/How-to-Multi-Task-in-Linux-with-the-Command-Line.jpg"><img alt="How to Multi-Task in Linux with the Command Line" class="size-full wp-image-28910" height="372" src="https://www.rosehosting.com/blog/wp-content/uploads/2018/10/How-to-Multi-Task-in-Linux-with-the-Command-Line.jpg" width="742" /></a><br />
<div class="wp-caption alignnone" id="attachment_28910" style="width: 752px;">
<div class="wp-caption-text">
How to Multi-Task in Linux with the Command Line</div>
</div>
One of the most jarring moments when moving from a Windows-based
environment to using the command line is the loss of easy multi-tasking.
Even on Linux, if you use an X Window system, you can use the mouse to
just click on a new program and open it. On the command line, however,
you’re pretty much stuck with what’s on your screen at any given time.
In this tutorial, we will show you<strong> how to multi-task in Linux with the command line.</strong><span id="more-28905"></span><br />
<h2 class="western">
Background and Foreground Process Management</h2>
However, there are still ways to multi-task in Linux, and some of
them are more comprehensive than others. One in-built way that doesn’t
require any kind of additional software is simply moving processes into
the background and the foreground. We’d <a href="https://www.rosehosting.com/blog/how-to-run-commands-simultaneously-in-linux/">written a tutorial</a> on that a short while back. However, it has some disadvantages.<br />
<h3 class="western">
Disadvantages</h3>
<b>First</b>, to send a process into the background, you have to
pause it first. There’s no way to send an already running program into
the background and keep it running in one go.<br />
<b>Second</b>, you need to break your workflow to start a new
command. You have to exit what you’re currently doing and type more
commands into the shell. It works, but it’s inconvenient.<br />
<b>Third</b>, you have to look out for output from the background
processes. Any output from them will appear on the command line and
interfere with what you’re doing in the current moment. So background
tasks need to either redirect their output to a separate file, or they
need to be muted altogether.<br />
Because of these disadvantages, there are huge problems with
background and foreground process management. A better solution is to
use the “screen” command utility as shown below.<br />
<h2 class="western">
But First – You Can Always Open a new SSH Session</h2>
Don’t forget that you just open a new SSH session. Here’s a screenshot of we doing just that:<br />
<a href="https://www.rosehosting.com/blog/wp-content/uploads/2018/10/Open-Two-Separate-SSH-Shells.jpg"><img alt="Open Two Separate SSH Shells" class="aligncenter size-full wp-image-28906" height="299" src="https://www.rosehosting.com/blog/wp-content/uploads/2018/10/Open-Two-Separate-SSH-Shells.jpg" width="560" /></a><br />
It can get inconvenient to open new sessions all the time. And that’s when you need “screen”<br />
<h2 class="western">
Using “Screen” Instead</h2>
The “screen” utility allows you to have multiple workflows open at
the same times – the closest analog to “windows”. It’s available by
default within the regular Linux repositories. Install it in CentOS/RHEL
like this:<br />
<pre>sudo yum install screen
<a href="https://www.rosehosting.com/blog/wp-content/uploads/2018/10/Install-Screen.jpg"><img alt="install screen linux" class="aligncenter size-full wp-image-28907" height="431" src="https://www.rosehosting.com/blog/wp-content/uploads/2018/10/Install-Screen.jpg" width="560" /></a></pre>
<h2 class="western">
Opening a New Screen</h2>
Now start your session by typing “screen”.<br />
This will create a blank window within your existing SSH session and give it a number that’s shown in the title bar like this:<br />
<a href="https://www.rosehosting.com/blog/wp-content/uploads/2018/10/Waiting-for-Input.jpg"><img alt="Waiting for Input" class="aligncenter size-full wp-image-28908" height="203" src="https://www.rosehosting.com/blog/wp-content/uploads/2018/10/Waiting-for-Input.jpg" width="650" /></a><br />
My screen here has the number “0” as shown. In this screenshot, I’m
using a dummy “read” command to block the terminal and make it wait for
input. Now let’s say we want to do something else while we wait.<br />
To open a new screen and do something else, we type:<br />
<pre>ctrl+a c</pre>
“ctrl+a” is the default key combination for managing screens within
the screen program. What you type after it, determines the action. So
for example:<br />
<ul>
<li>ctrl+a c – <b>C</b>reates a new screen</li>
<li>ctrl+a <i>[number]</i> – Goes to a specific screen number</li>
<li>ctrl+a k – <b>K</b>ills the current screen</li>
<li>ctrl+a n – Goes to the <b>n</b>ext screen</li>
<li>ctrl+a ” – Lists all active screens in the session</li>
</ul>
So if we press “ctrl+a c”, we get a new screen with a new number as shown here:<br />
<a href="https://www.rosehosting.com/blog/wp-content/uploads/2018/10/Second-Screen-Linux.jpg"><img alt="Second Screen Linux" class="aligncenter size-full wp-image-28909" height="189" src="https://www.rosehosting.com/blog/wp-content/uploads/2018/10/Second-Screen-Linux.jpg" width="650" /></a><br />
You can use the cursor keys to navigate the list and go to whichever screen you want.<br />
Screens are the closest thing you’ll get to a “windows” like system in
the Linux command line. Sure, it’s not as easy as clicking with the
mouse, but then the graphical subsystem is very resource intensive in
the first place. With screens, you can get almost the same functionality
and enable full multi-tasking!<br />
<hr />
If you are one of our managed VPS hosting customers, you can always
ask our system administrators to set up this for you, They are available
24/7 and can take care of your request immediately.<br />
If you liked this post on how to multi-task in Linux command line,
please share it with your friends on social media networks, or if you
have any question regarding the blog post please leave a comment below
and one of our system administrators will reply to it.</div>
Sameh Attiahttp://www.blogger.com/profile/06829656663776752624noreply@blogger.com0tag:blogger.com,1999:blog-3950073089426506979.post-43496091133419816192018-10-29T04:15:00.001+02:002018-10-29T04:15:48.633+02:00How to start a vnc server for the actual display (scraping) with TigerVNC<div dir="ltr" style="text-align: left;" trbidi="on">
https://www.howtoforge.com/tutorial/how-to-start-a-vnc-server-for-the-actual-display-scraping-with-tigervnc<br />
<br />
VNC is a desktop sharing application (Virtual Network Computing) to
connect and control a (remote or local) computer's desktop over a
network connection.<br />
However, on linux systems, many VNC server applications allow only to
connect to a virtual desktop and not to the actual one. This howto
offers you a solution, to connect via TigerVNC server to the actual
active session on your Linux desktop.<br />
<h2 id="requirements">
Requirements</h2>
<ul>
<li>A fully functional linux desktop environment</li>
<li>root privilege (to install the TigerVNC server)</li>
<li>basic knowledge of the linux shell</li>
</ul>
In order to get the latest packages, you may want to update.<br />
<div class="command">
<span>user@hostname</span><span>:~$ sudo apt-get update</span></div>
<div style="background-color: white; float: left; margin: 10px 15px 10px 0px; width: 336px;">
<div data-google-query-id="CL3Jo-S3qt4CFYcX4Aodk9EKhQ" id="div-gpt-ad-1527185271042-6" style="height: 250px; width: 300px;">
</div>
</div>
This howto was tested on Debian/GNU Linux 9.5 (stretch) and Ubuntu 18.04<br />
<h2 id="install-tigervnc">
Install TigerVNC</h2>
First, you have to install the TigerVNC server.<br />
<div class="command">
<span>user@hostname</span><span>:~$ </span>sudo apt-get install tigervnc-scraping-server</div>
Note, that on most debian-based systems, there is a small package
called tigervnc-scraping-server, which you need to install. You don't
have to install the main TigerVNC server (package name:
tigervnc-standalone-server) to have the functionality to connect to the
running desktop session, only if you prefer to connect to a virtual
desktop, too.<br />
The TigerVNC server provides a smaller application (x0vncserver) to grant access to the active session.<br />
Then, create a .vnc directory in your home:<br />
<div class="command">
user@hostname:~$ mkdir -p ~/.vnc</div>
Create a password for your vnc session:<br />
<div class="command">
<span>user@hostname</span><span>:~$ vncpasswd<br />Password:<br />Verify:<br />Would you like to enter a view-only password (y/n)? n</span></div>
<h2 id="starting-the-vnc-server">
Starting the VNC server</h2>
A short description of the x0vncserver:<br />
<pre>x0tigervncserver is a TigerVNC Server which makes any X display remotely accessible via VNC, TigerVNC or compatible viewers. Unlike Xvnc(1), it does not create a virtual display. Instead, it just shares an existing X server (typically, that one connected to the physical screen).</pre>
Now that you have successfully installed TigerVNC server on your
computer, created a password with the vncpasswd command, we can begin to
start our vnc server. Make sure that you're on the active session, and
write (as user):<br />
<div class="command">
<span>user@hostname</span><span>:~$ x0vncserver -passwordfile ~/.vnc/passwd -display :0<br /><br />Wed Oct 10 22:17:16 2018<br />Geometry: Desktop geometry is set to 1920x1080+0+0<br />Main: XTest extension present - version 2.2<br />Main: Listening on port 5900</span></div>
<div class="google-auto-placed ap_container" style="clear: none; height: auto; text-align: center; width: 100%;">
<ins class="adsbygoogle adsbygoogle-noablate" data-ad-client="ca-pub-3043223216276099" data-ad-format="auto" data-adsbygoogle-status="done" style="background-color: transparent; display: block; margin: auto;"><ins id="aswift_3_expand" style="background-color: transparent; border: none; display: inline-table; height: 200px; margin: 0; padding: 0; position: relative; visibility: visible; width: 896px;"><ins id="aswift_3_anchor" style="background-color: transparent; border: none; display: block; height: 200px; margin: 0; padding: 0; position: relative; visibility: visible; width: 896px;"></ins></ins></ins></div>
The option <em>-passwordfile ~/.vnc/passwd</em> reads the password file created earlier with the <em>vncpasswd</em> command. The second option <em>-display :0</em> means, that you want to connect to the session on the display :0, which is usually the active session.<br />
Now you can access your actual desktop with any vnc viewer application on the default vnc port 5900.<br />
You can stop this process whenever you want by pressing Ctrl-c.<br />
If you wish to run it in the background, type:<br />
<div class="command">
<span>user@hostname</span><span>:~$ x0vncserver -passwordfile ~/.vnc/passwd -display :0 >/dev/null 2>&1 &</span></div>
Now all the output standard output and errors are redirected to
/dev/null and with the & at the end, it will run in the background.
However, you won't be able anymore to stop the vnc server by pressing
Ctrl-c, instead you have to kill it's process id (see below section
"Stopping the vnc server").<br />
For more options and syntax, check the <a href="https://tigervnc.org/doc/x0vncserver.html" target="_blank">x0vncserver manual</a>.<br />
<h2 id="stopping-the-vnc-server">
Stopping the VNC server</h2>
If your vnc server runs in the background, you have to know the process id, in order to stop it.<br />
<div class="command">
<span>user@hostname</span><span>:~$<span> </span></span>ps -fu user | grep [x]0vncserver<br />user
1328 1 0 23:11 pts/2 00:00:00 /usr/bin/x0vncserver
-display :0 -passwordfile /home/user/.vnc/passwd -rfbport 5900</div>
<div class="google-auto-placed ap_container" style="clear: none; height: auto; text-align: center; width: 100%;">
<ins class="adsbygoogle adsbygoogle-noablate" data-ad-client="ca-pub-3043223216276099" data-ad-format="auto" data-adsbygoogle-status="done" style="background-color: transparent; display: block; margin: auto;"><ins id="aswift_4_expand" style="background-color: transparent; border: none; display: inline-table; height: 200px; margin: 0; padding: 0; position: relative; visibility: visible; width: 896px;"><ins id="aswift_4_anchor" style="background-color: transparent; border: none; display: block; height: 200px; margin: 0; padding: 0; position: relative; visibility: visible; width: 896px;"></ins></ins></ins></div>
The output will be like this, so notice the pid 1328. In order to stop the vnc server, we have to "kill" this process.<br />
<div class="command">
<span>user@hostname</span><span>:~$<span> kill -9 1328</span></span></div>
The option -9 for the kill command will send the KILL signal to the process id to make sure that it stops.<br />
<h2 id="script-to-run-the-vnc-server">
Script to run the VNC server</h2>
There is a script to start and stop the x0vncserver application on
github. For testing purposes, you download the psmisc package, too:<br />
<div class="command">
<span>user@hostname</span><span>:~$ sudo apt-get install git psmisc</span></div>
Then, download the startvnc script using the git command:<br />
<div class="command">
<span>user@hostname</span><span>:~$ git clone <a href="https://github.com/sebestyenistvan/runvncserver">https://github.com/sebestyenistvan/runvncserver</a><br />Cloning into 'runvncserver'...<br />remote: Enumerating objects: 77, done.<br />remote: Counting objects: 100% (77/77), done.<br />remote: Compressing objects: 100% (57/57), done.<br />remote: Total 77 (delta 25), reused 60 (delta 18), pack-reused 0<br />Unpacking objects: 100% (77/77), done.<br /></span></div>
Your output will look something like above.<br />
Copy the startvnc script from the runvncserver directory to your home:<br />
<div class="command">
<span>user@hostname</span><span>:~$<span> cp ~/runvncserver/startvnc ~</span></span></div>
Change permissions to executable, in order to execute the script:<br />
<div class="command">
<span>user@hostname</span><span>:~$ chmod +x ~/startvnc</span></div>
Then, run the script.<br />
<div class="command">
<span>user@hostname</span><span>:~$ ./startvnc<br /><br />Usage: ./startvnc start|stop|restart|status</span></div>
This script will only work, if you have a .vnc directory in your home
and created a vncpasswd (it checks for ~/.vnc/passwd file). We already
created the .vnc directory and the password earlier.<br />
<div class="google-auto-placed ap_container" style="clear: none; height: auto; text-align: center; width: 100%;">
<ins class="adsbygoogle adsbygoogle-noablate" data-ad-client="ca-pub-3043223216276099" data-ad-format="auto" data-adsbygoogle-status="done" style="background-color: transparent; display: block; margin: auto;"><ins id="aswift_5_expand" style="background-color: transparent; border: none; display: inline-table; height: 200px; margin: 0; padding: 0; position: relative; visibility: visible; width: 896px;"><ins id="aswift_5_anchor" style="background-color: transparent; border: none; display: block; height: 200px; margin: 0; padding: 0; position: relative; visibility: visible; width: 896px;"></ins></ins></ins></div>
To start the vnc server on the actual display, just type:<br />
<div class="command">
<span>user@hostname</span><span>:~$ ./startvnc start<br />Starting VNC Server on display :0 [ok]</span></div>
You can test, if your vnc server is running with the option:<br />
<div class="command">
<span>user@hostname</span><span>:~$ ./startvnc status<br />Status of the VNC server: [running] (pid: 1328)</span></div>
Few examples:<br />
<a class="fancybox" href="https://www.howtoforge.com/images/how_to_start_a_vnc_server_for_the_actual_display_scraping_with_tigervnc/big/Screenshot_from_2018-10-11_15-09-32.png" id="img-Screenshot_from_2018-10-11_15-09-32"><img alt="Using TigerVNC" height="307" src="https://www.howtoforge.com/images/how_to_start_a_vnc_server_for_the_actual_display_scraping_with_tigervnc/Screenshot_from_2018-10-11_15-09-32.png" style="display: block; margin-left: auto; margin-right: auto;" width="550" /></a><br />
Or by checking the 5900 TCP port on your system with the fuser command (from the psmisc package):<br />
<div class="command">
<span>user@hostname</span><span>:~$<span> fuser -vn tcp 5900<br /> USER PID ACCESS COMMAND<br />5900/tcp: user 1328 F.... x0vncserver</span></span></div>
You'll get an output like this if the vnc server is running on port 5900.<br />
<a class="fancybox" href="https://www.howtoforge.com/images/how_to_start_a_vnc_server_for_the_actual_display_scraping_with_tigervnc/big/Screenshot-from-2018-10-11-15-11-22.png" id="img-Screenshot-from-2018-10-11-15-11-22"><img alt="Check port with fuser command" height="307" src="https://www.howtoforge.com/images/how_to_start_a_vnc_server_for_the_actual_display_scraping_with_tigervnc/Screenshot-from-2018-10-11-15-11-22.png" style="display: block; margin-left: auto; margin-right: auto;" width="550" /></a><br />
More instructions for this script you can find in the readme file:<br />
<div class="command">
<span>user@hostname</span><span>:~$<span> less runvncserver/README.md</span></span></div>
The script will create a logfile, where the output is stored. If
something goes wrong or you can't start or stop the x0vncserver, take a
look at the logfile under ~/.vnc/logfile<br />
<h2 id="start-the-vnc-server-automatically">
Start the VNC server automatically</h2>
If you want to access the active desktop session automatically, you need to edit the .xsessionrc file in your home directory.<br />
<div class="command">
<span>user@hostname</span><span>:~$<span> echo "/home/user/startvnc start >/dev/null 2>&1" >> ~/.xsessionrc</span></span></div>
<div class="google-auto-placed ap_container" style="clear: none; height: auto; text-align: center; width: 100%;">
<ins class="adsbygoogle adsbygoogle-noablate" data-ad-client="ca-pub-3043223216276099" data-ad-format="auto" data-adsbygoogle-status="done" style="background-color: transparent; display: block; margin: auto;"><ins id="aswift_6_expand" style="background-color: transparent; border: none; display: inline-table; height: 200px; margin: 0; padding: 0; position: relative; visibility: visible; width: 896px;"><ins id="aswift_6_anchor" style="background-color: transparent; border: none; display: block; height: 200px; margin: 0; padding: 0; position: relative; visibility: visible; width: 896px;"></ins></ins></ins></div>
Replace user by your username and it will automatically run when
starting the X session. The script logs its activity in ~/.vnc/logfile,
if something goes wrong, you can check the log file there.<br />
<a class="fancybox" href="https://www.howtoforge.com/images/how_to_start_a_vnc_server_for_the_actual_display_scraping_with_tigervnc/big/Screenshot_from_2018-10-11_15-07-30.png" id="img-Screenshot_from_2018-10-11_15-07-30"><img alt="Automatic VNC server start" height="307" src="https://www.howtoforge.com/images/how_to_start_a_vnc_server_for_the_actual_display_scraping_with_tigervnc/Screenshot_from_2018-10-11_15-07-30.png" style="display: block; margin-left: auto; margin-right: auto;" width="550" /></a><br />
<h2 id="notes">
Notes</h2>
This tutorial doesn't deal with setting up a VNC virtual desktop.<br />
<h3 id="security">
Security</h3>
Be aware, that the x0vncserver doesn't use encryption by default, so
use it carefully over the internet. If you want to use it remotely, you
can tunnel it via ssh. However, there are other howtos where you can
find a solution to encrypt your VNC session.<br />
Or you can take a look at the ssvnc package.<br />
<h3 id="vnc-viewers">
VNC viewers</h3>
If you're looking for VNC viewers, there are plenty of them, for instance:<br />
<ul>
<li>gvncviewer</li>
<li>tigervnc-viewer</li>
<li>xtightvncviewer</li>
<li>xvnc4viewer</li>
</ul>
<h3 id="geometry">
Geometry</h3>
The x0vncserver on the actual display will use the same geometry as
the running desktop on the :0 display. So if you set the -geometry
option to a lower size, it won't get scaled, you'll just see a fraction
of the desktop size.<br />
<h3 id="feedback">
Feedback</h3>
Feel free to write feedback. If you tested this tutorial or even the script on another system.<br />
<div style="text-align: center;">
<a class="fancybox" href="https://www.howtoforge.com/images/how_to_start_a_vnc_server_for_the_actual_display_scraping_with_tigervnc/big/screenshot_800width.png" id="img-screenshot_800width"><img alt="Desktop shared via VNC" height="333" src="https://www.howtoforge.com/images/how_to_start_a_vnc_server_for_the_actual_display_scraping_with_tigervnc/screenshot_800width.png" width="550" /></a></div>
<img src="https://www.howtoforge.com/images/pdficon_small.png" /></div>
Sameh Attiahttp://www.blogger.com/profile/06829656663776752624noreply@blogger.com0tag:blogger.com,1999:blog-3950073089426506979.post-18461275348021776592018-10-29T00:54:00.003+02:002018-10-29T00:54:53.790+02:00Linux tr Command Tutorial for Beginners (with Examples)<div dir="ltr" style="text-align: left;" trbidi="on">
https://www.howtoforge.com/linux-tr-command<br />
<br />
Depending on the kind of work you do on the command line in Linux,
you may want a utility that can act as a Swiss army knife of quick text
editing. Gladly, there exists a tool dubbed tr, which qualifies for this
role. In this tutorial, we will discuss the basics of tr using some
easy to understand examples.<br />
<div style="background-color: white; float: left; margin: 10px 15px 10px 0px; width: 336px;">
<div data-google-query-id="CK-n7fiaqt4CFRc44AodzHEBtA" id="div-gpt-ad-1527185271042-6" style="height: 250px; width: 300px;">
</div>
</div>
But before we do that, it's worth mentioning that all examples in this article have been tested on an Ubuntu 18.04 LTS machine.<br />
<h2 id="linux-tr-command">
Linux tr command</h2>
Here's how the tool's man page explains it:<br />
<pre>Translate, squeeze, and/or delete characters from standard input, writing to standard output.</pre>
And following is its syntax:<br />
<div class="command">
tr [OPTION]... SET1 [SET2]</div>
here's what SET means:<br />
<pre>SETs are specified as strings of characters. Most represent themselves. Interpreted sequences are:
\NNN character with octal value NNN (1 to 3 octal digits)
\\ backslash
\a audible BEL
\b backspace
\f form feed
\n new line
\r return
\t horizontal tab
\v vertical tab</pre>
Following are some Q&A styled examples that should give you a better idea on how the tr command works.<br />
<h2 id="q-how-to-convert-lower-case-to-upper-case-using-tr">
Q1. How to convert lower case to upper case using tr?</h2>
Suppose you want to convert the sentence "linux tutorial on howtoforge" to uppercase, then here's how you can do this using tr.<br />
<div class="command">
echo 'linux tutorial on howtoforge' | tr "[:lower:]" "[:upper:]"</div>
The above command produced the following output on my system:<br />
<pre>LINUX TUTORIAL ON HOWTOFORGE</pre>
<h2 id="q-how-to-strip-extra-spaces-using-tr">
Q2. How to strip extra spaces using tr?</h2>
Suppose you have a line like: "HowtoForge is an extremely
good resource for Linux tutorials". And the requirement is to
strip extra spaces from this line.<br />
Here's how you can use tr to do this:<br />
<div class="command">
echo 'HowtoForge is an extremely good resource for Linux tutorials' | tr -s '[:space:]'</div>
Here's the output:<br />
<pre>HowtoForge is an extremely good resource for Linux tutorials</pre>
<a class="fancybox" href="https://www.howtoforge.com/images/command-tutorial/big/tr-space.png" id="img-tr-space"><img src="https://www.howtoforge.com/images/command-tutorial/tr-space.png" style="display: block; margin-left: auto; margin-right: auto;" /></a><br />
<h2 id="q-how-to-delete-text-using-tr">
Q3. How to delete text using tr?</h2>
Suppose you want to delete the hyphens from the following line:
"HowtoForge -- is -- an -- extremely -- good -- resource -- for -- Linux
-- tutorials." Then here's how you can do this using tr.<br />
<div class="command">
echo 'HowtoForge -- is -- an -- extremely -- good -- resource -- for -- Linux -- tutorials' | tr -d '-'</div>
Following is the output it produces:<br />
<pre>HowtoForge is an extremely good resource for Linux tutorials</pre>
<h2 id="q-how-to-replace-characters-using-tr">
Q4. How to replace characters using tr?</h2>
In the previous section, suppose the requirement was to replace
hyphens with, let's say, dots. Then here's how you can do that using tr.<br />
<div class="command">
echo 'HowtoForge -- is -- an -- extremely -- good -- resource -- for -- Linux -- tutorials' | tr '-' '.'</div>
Following is the output it produced:<br />
<pre>HowtoForge .. is .. an .. extremely .. good .. resource .. for .. Linux .. tutorials</pre>
<h2 id="conclusion">
Conclusion</h2>
So you can see the tr command is an extremely helpful tool when it
comes to editing text. We have discussed some main options here, but the
utility offers many other command line options as well. First try
these, and once you've got a good idea about what we've discussed here,
then you can learn more about tr by heading to its <a href="https://linux.die.net/man/1/tr" target="_blank">man page</a>.</div>
Sameh Attiahttp://www.blogger.com/profile/06829656663776752624noreply@blogger.com0tag:blogger.com,1999:blog-3950073089426506979.post-48675522348799464502018-10-28T23:30:00.003+02:002018-10-28T23:30:48.518+02:00How to compile and install Linux Kernel 4.19 from source code<div dir="ltr" style="text-align: left;" trbidi="on">
https://www.cyberciti.biz/tips/compiling-linux-kernel-26.html<br />
<br />
<span class="cat-links"></span><br />
<div class="entry-content">
<div style="float: right; margin-left: 5px; margin-top: 0px;">
<a href="https://www.cyberciti.biz/tips/category/linux" title="See all GNU/Linux related tips/articles"><img border="0" src="https://www.cyberciti.biz/media/new/category/old/linux-logo.png" /></a></div>
<span class="drop_cap">C</span>ompiling
a custom kernel has its advantages and disadvantages. However, new
Linux user/admin find it difficult to compile Linux kernel. Compiling
kernel needs to understand few things and then type a couple of
commands. This step by step howto covers compiling Linux kernel version
4.19.xx under an Ubuntu or Debian Linux. The following instructions
successfully tested on an RHEL 7/CentOS 7 (and clones), Debian Linux,
Ubuntu Linux and Fedora Linux 28. However, instructions remain the same
for any other Linux distribution.<br /> <span id="more-710"></span><br />
<center>
</center>
<h2>
How to compile and install Linux Kernel 4.19</h2>
The procedure to build (compile) and install the latest Linux kernel from source is as follows:<br />
<ol>
<li>Grab the latest kernel from kernel.org</li>
<li>Verify kernel</li>
<li>Untar the kernel tarball</li>
<li>Copy existing Linux kernel config file</li>
<li>Compile and build Linux kernel 4.19</li>
<li>Install Linux kernel and modules (drivers)</li>
<li>Update Grub configuration</li>
<li>Reboot the system</li>
</ol>
Let us see all steps in details.<br />
<h2>
Step 1. Get the latest Linux kernel source code</h2>
Visit the official project <a href="https://www.kernel.org/" rel="noopener" target="_blank">site</a> and download the latest source code. Click on the big yellow button that read as “<strong>Latest Stable Kernel</strong>“:<br /> <img alt="Download Linux Kernel Source Code" class="aligncenter size-full wp-image-114596" height="465" src="https://www.cyberciti.biz/tips/wp-content/uploads/2005/09/Download-Linux-Kernel-Source-Code.png" width="599" /><br />
The filename would be linux-x.y.z.tar.xz, where x.y.z is actual Linux
kernel version number. For example file linux-4.19.tar.xz represents
Linux kernel version 4.19. Use the wget command to download Linux kernel
source code:<br /> <code>$ wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.19.tar.xz</code><br /> <img alt="wget Linux kernel source code from kerne.org" class="aligncenter size-full wp-image-114600" height="402" src="https://www.cyberciti.biz/tips/wp-content/uploads/2005/09/wget-Linux-kernel-source-code-from-kerne.org_.png" width="599" /><br />
<h2>
Step 2. Extract tar.xz file</h2>
You
really don’t have to extract the source code in /usr/src. You can
extract the source code in your $HOME directory or any other directory
using the following unzx command or xz command:<br /> <code>$ unzx -v linux-4.19.tar.xz</code><br /> OR<br /> <code>$ xz -d -v linux-4.19.tar.xz</code><br />
<h3>
Verify Linux kernel tartball with pgp</h3>
First grab the PGP signature for linux-4.19.tar:<br /> <code>$ wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.19.tar.sign</code><br /> Try to verify it:<br /> <code>$ gpg --verify linux-4.19.tar.sign </code><br /> Sample outputs:<br />
<pre>gpg: assuming signed data in 'linux-4.19.tar'
gpg: Signature made Sun 12 Aug 2018 04:00:28 PM CDT
gpg: using RSA key <strong>79BE3E4300411886</strong>
gpg: Can't check signature: No public key</pre>
Grab the public key
from the PGP keyserver in order to verify the signature i.e. RSA key ID
79BE3E4300411886 (from the above outputs):<br /> <code>$ gpg --recv-keys 79BE3E4300411886</code><br /> Sample outputs:<br />
<div class="wp_syntax" style="position: relative;">
<table><tbody>
<tr><td class="code"><pre class="ini" style="font-family: monospace;">gpg: key 79BE3E4300411886: <span>7</span> duplicate signatures removed
gpg: key 79BE3E4300411886: <span>172</span> signatures not checked due to missing keys
gpg: /home/vivek/.gnupg/trustdb.gpg: trustdb created
gpg: key 79BE3E4300411886: public key <span style="color: #993333;">"Linus Torvalds <torvalds kernel.org="">"</torvalds></span> imported
gpg: no ultimately trusted keys found
gpg: Total number processed: <span>1</span>
gpg: imported: <span>1</span></pre>
</td></tr>
</tbody></table>
</div>
Now <a href="https://www.cyberciti.biz/faq/pgp-tarball-file-signature-keys-verification/">verify gpg key again with the gpg command</a>:<br /> <code>$ gpg --verify linux-4.19.tar.sign</code><br /> Sample outputs:<br />
<div class="wp_syntax" style="position: relative;">
<table><tbody>
<tr><td class="code"><pre class="ini" style="font-family: monospace;">gpg: assuming signed data in 'linux-<span>4.19</span>.tar'
gpg: Signature made Sun <span>12</span> Aug <span>2018</span> 04:00:<span>28</span> PM CDT
gpg: using RSA key 79BE3E4300411886
gpg: Good signature from <span style="color: #993333;">"Linus Torvalds <torvalds kernel.org="">"</torvalds></span> <span style="color: #000066; font-weight: bold;"><span>[</span>unknown<span>]</span></span>
gpg: aka <span style="color: #993333;">"Linus Torvalds <torvalds linux-foundation.org="">"</torvalds></span> <span style="color: #000066; font-weight: bold;"><span>[</span>unknown<span>]</span></span>
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: ABAF 11C6 5A29 70B1 30AB E3C4 79BE 3E43 0041 <span>1886</span></pre>
</td></tr>
</tbody></table>
</div>
If you do not get “<strong>BAD signature</strong>” output from the “gpg –verify” command, <a href="https://www.cyberciti.biz/faq/tar-extract-linux/">untar/extract the Linux kernel tarball</a> using the tar command, enter:<br /> <code>$ tar xvf linux-4.19.tar</code><br />
<h2>
Step 3. Configure the Linux kernel features and modules</h2>
Before
start building the kernel, one must configure Linux kernel features.
You must also specify which kernel modules (drivers) needed for your
system. The task can be overwhelming for a new user. I suggest that you
copy existing config file using the <a href="https://www.cyberciti.biz/faq/cp-copy-command-in-unix-examples/" title="See Linux/Unix cp command examples for more info">cp command</a>:<br /> <code>$ cd linux-4.19<br /> $ cp -v /boot/config-$(uname -r) .config</code><br /> Sample outputs:<br />
<pre>'/boot/config-4.15.0-30-generic' -> '.config'</pre>
<h2>
Step 4. Install the required compilers and other tools</h2>
You must have development tools such as GCC compilers and related tools installed to compile the Linux kernel.<br />
<h3>
<a href="https://www.cyberciti.biz/faq/debian-linux-install-gnu-gcc-compiler/">How to install GCC and development tools on a <span style="color: #6666cc;">Debian/Ubuntu Linux</span></a></h3>
Type the following <a href="https://www.cyberciti.biz/faq/ubuntu-lts-debian-linux-apt-command-examples/" title="See Linux/Unix apt command examples for more info">apt command</a> or <a href="https://www.cyberciti.biz/tips/linux-debian-package-management-cheat-sheet.html" title="See Linux/Unix apt-get command examples for more info">apt-get command</a> to install the same:<br /> <code>$ sudo apt-get install build-essential libncurses-dev bison flex libssl-dev libelf-dev</code><br /> See “<a href="https://www.cyberciti.biz/faq/howto-installing-gnu-c-compiler-development-environment-on-ubuntu/">Ubuntu Linux Install GNU GCC Compiler and Development Environment</a>” for more info.<br />
<h3>
<a href="https://www.cyberciti.biz/faq/centos-rhel-7-redhat-linux-install-gcc-compiler-development-tools/">How to install GCC and development tools on a <span style="color: red;">CentOS/RHEL/Oracle/Scientific Linux</span></a></h3>
Try <a href="https://www.cyberciti.biz/faq/rhel-centos-fedora-linux-yum-command-howto/" title="See Linux/Unix yum command examples for more info">yum command</a>:<br /> <code>$ sudo yum group install "Development Tools" </code><br /> OR<br /> <code>$ sudo yum groupinstall "Development Tools"</code><br /> Additional packages too:<br /> <code>$ sudo yum install ncurses-devel bison flex elfutils-libelf-devel openssl-devel</code><br />
<h3>
How to install GCC and development tools on a Fedora Linux</h3>
Run the following dnf command:<br /> <code>$ sudo dnf group install "Development Tools"<br /> $ sudo dnf ncurses-devel bison flex elfutils-libelf-devel openssl-devel</code><br />
<h2>
Step 5. Configuring the kernel</h2>
Now you can start the kernel configuration by typing any one of the following command in source code directory:<br />
<ul>
<li><strong>$ <kbd>make menuconfig</kbd></strong>
– Text based color menus, radiolists & dialogs. This option also
useful on remote server if you wanna compile kernel remotely.</li>
<li><strong>$ <kbd>make xconfig</kbd></strong> – X windows (Qt) based configuration tool, works best under KDE desktop</li>
<li><strong>$ <kbd>make gconfig</kbd></strong> – X windows (Gtk) based configuration tool, works best under Gnome Dekstop.</li>
</ul>
For example, run <kbd>make menuconfig</kbd> command launches following screen:<br /> <code>$ make menuconfig</code><br /> <img alt="How to compile and install Linux Kernel 4.19" class="aligncenter size-full wp-image-114610" height="324" src="https://www.cyberciti.biz/tips/wp-content/uploads/2005/09/The-make-menuconfig-command-in-action-on-Linux.png" width="599" /><br />
You have to select different options as per your need. Each
configuration option has HELP button associated with it so select help
button to get help. Please note that ‘make menuconfig’ is optional. I
used it here to demonstration purpose only. You can enable or disable
certain features or kernel driver with this option. It is easy to remove
support for a device driver or option and end up with a broken kernel.
For example, if the ext4 driver is removed from the kernel configuration
file, a system may not boot. When in doubt, just leave support in the
kernel.<br />
<h2>
Step 5. How to compile a Linux Kernel</h2>
Start compiling and tocreate a compressed kernel image, enter:<br /> <code>$ make</code><br /> To speed up compile time, pass the <kbd>-j</kbd> as follows:<br /> <code>## use 4 core/thread ##<br /> $ make -j 4<br /> ## get thread or cpu core count using nproc command ##<br /> $ make -j $(nproc)</code><br /> <img alt="Linux kernel compiled and bzImage is ready" class="aligncenter size-full wp-image-114621" height="703" src="https://www.cyberciti.biz/tips/wp-content/uploads/2005/09/Linux-kernel-compiled-and-bzImage-is-ready.png" width="599" /><br />
Compiling and building the Linux kernel going take a significant amount
of time. The build time depends upon your system’s resources such as
available CPU core and the current system load. So have some patience.<br />
<h3>
Install the Linux kernel modules</h3>
<code>$ sudo make modules_install </code><br /> <img alt="How to install the Linux kernel modules" class="aligncenter size-full wp-image-114614" height="819" src="https://www.cyberciti.biz/tips/wp-content/uploads/2005/09/How-to-install-the-Linux-kernel-modules.png" width="599" /><br />
<h3>
Install the Linux kernel</h3>
So far we have compiled the Linux kernel and installed kernel modules. It is time to install the kernel itself:<br /> <code>$ sudo make install </code><br /> <img alt="make install output" class="aligncenter size-full wp-image-114627" height="173" src="https://www.cyberciti.biz/tips/wp-content/uploads/2005/09/make-install-output.png" width="619" /><br /> It will install three files into /boot directory as well as modification to your kernel grub configuration file:<br />
<ul>
<li>initramfs-4.19.img</li>
<li>System.map-4.19</li>
<li>vmlinuz-4.19</li>
</ul>
<h2>
Step 6. Update grub config</h2>
You need to modify Grub 2 boot loader configurations. Type the following command at a shell prompt as per your Linux distro:<br />
<h3>
<span style="color: red;">CentOS/RHEL/Oracle/Scientific and Fedora Linux</span></h3>
<code>$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg<br /> $ sudo grubby --set-default /boot/vmlinuz-4.19</code><br /> You can confirm the details with the following commands:<br /> <code>grubby --info=ALL | more<br /> grubby --default-index<br /> grubby --default-kernel</code><br />
<h3>
<span style="color: #6666cc;">Debian/Ubuntu Linux</span></h3>
The following commands are optional as make install does everything for your but included here for historical reasons only:<br /> <code>$ sudo update-initramfs -c -k 4.19<br /> $ sudo update-grub</code><br />
<h2>
How to build and install the latest Linux kernel from source code</h2>
You
have compiled a Linux kernel. The process takes some time, however now
you have a custom Linux kernel for your system. Let us reboot the
system.<br />
<h3>
<a href="https://www.cyberciti.biz/faq/howto-reboot-linux/">Reboot Linux computer and boot into your new kernel</a></h3>
Just issue the <a href="https://www.cyberciti.biz/faq/linux-reboot-command/" title="See Linux/Unix reboot command examples for more info">reboot command</a> or shutdown command:<br /> <code># reboot</code><br /> Verify <a href="https://www.cyberciti.biz/faq/find-linux-kernel-version/">new Linux kernel version after reboo</a>t:<br /> <code>$ uname -mrs</code><br /> Sample outputs:<br />
<pre>Linux 4.19 x86_64</pre>
<h2>
Conclusion</h2>
Configurations!
You completed various steps to build the Linux kernel from source code.
I strongly suggest that you always keep backup of essential data and
visit the kernel.org page <a href="https://www.kernel.org/" rel="noopener" target="_blank">here</a> for more info.</div>
</div>
Sameh Attiahttp://www.blogger.com/profile/06829656663776752624noreply@blogger.com0tag:blogger.com,1999:blog-3950073089426506979.post-57664406339232173342018-10-27T00:46:00.000+02:002018-10-27T00:46:24.780+02:00How to Change your Ubuntu Computer Name (Hostname)<div dir="ltr" style="text-align: left;" trbidi="on">
https://vitux.com/how-to-change-your-ubuntu-computer-name-hostname<br />
<br />
<div class="header-post-title-container clearfix">
<div class="inner-wrap">
<div class="post-title-wrapper">
<h1 class="header-post-title-class">
How to Change your Ubuntu Computer Name (Hostname)</h1>
</div>
</div>
</div>
<h2 style="text-align: center;">
<img alt="Change Ubuntu Hostname" class="alignnone size-large wp-image-2198 lazy-loaded" data-lazy-type="image" data-src="https://vitux.com/wp-content/uploads/2018/10/ubuntu-change-hostname-1024x512.jpg" data-srcset="" height="375" src="https://vitux.com/wp-content/uploads/2018/10/ubuntu-change-hostname-1024x512.jpg" width="750" /></h2>
<h2>
What is a computer name (hostname)?</h2>
Your
computer name, in technical terms, is also referred to as the hostname
of your computer system. A hostname is how other computers recognize
your computer over a local network. Like on the Internet, we have URLs
instead of hostnames. These URLs contain regular words like google.com
that we can easily understand instead of remembering the numeric IP
address of a server.<br />
We can give easy computer name/hostname for
our systems so that other computers can easily identify it over a local
network. So instead of remembering your IP address, other people can
access local web pages and other authorized data on your system through
your hostname.<br />
In this article, we will give a few simple ways to
change your computer name through the graphical user interface and the
command line.<br />
The commands and procedures mentioned in this article have been run on a Ubuntu 18.04 LTS system.<br />
<h2>
How to change the hostname?</h2>
<h3>
Method 1: Through the GUI</h3>
Through
the UI, you can change your computer’s device name. It can be called a
“pretty hostname” as it is not the permanent or static hostname of your
computer. Nevertheless, you can change the device name as follows:<br />
Open
your system settings either by clicking the downward arrow located at
the top-right corner of your Ubuntu screen and then clicking the
settings icon from the following view:<br />
<img alt="Ubuntu Settings" class="aligncenter wp-image-2150 lazy-loaded" data-lazy-type="image" data-src="https://vitux.com/wp-content/uploads/2018/10/word-image-174.png" data-srcset="" height="310" src="https://vitux.com/wp-content/uploads/2018/10/word-image-174.png" width="265" /><br />
OR<br />
Open the Settings utility through the system Dash as follows:<br />
<img alt="Search for settings utility" class="aligncenter wp-image-2151 lazy-loaded" data-lazy-type="image" data-src="https://vitux.com/wp-content/uploads/2018/10/word-image-175.png" height="222" src="https://vitux.com/wp-content/uploads/2018/10/word-image-175.png" width="172" /><br />
The Settings utility will by default open in the Wi-Fi view as follows:<br />
<img alt="Wi-Fi View" class="aligncenter wp-image-2152 lazy-loaded" data-lazy-type="image" data-src="https://vitux.com/wp-content/uploads/2018/10/word-image-176.png" data-srcset="" height="323" src="https://vitux.com/wp-content/uploads/2018/10/word-image-176.png" width="346" /><br />
Move
to the Details view by clicking the Details tab from the left pane. You
will be able to view the Device name in the About view as follows:<br />
<img alt="Details tab" class="aligncenter wp-image-2153 lazy-loaded" data-lazy-type="image" data-src="https://vitux.com/wp-content/uploads/2018/10/word-image-177.png" data-srcset="" height="436" src="https://vitux.com/wp-content/uploads/2018/10/word-image-177.png" width="626" /><br />
The device name will change as soon as you enter a new name in the Device name textbox.<br />
Please
note that this is not your computer’s permanent hostname. Please read
further in this article to view how you can change your computer’s
permanent hostname.<br />
<h3>
Method 2: Manually through the hostname and hosts file</h3>
You can view the hostname of your computer by entering the following command in your Terminal:<br />
(Click the <em><strong>Ctrl+Alt+T</strong></em> shortcut to open the Terminal application)<br />
<pre>$ hostname</pre>
<img alt="Get current hostname" class="aligncenter wp-image-2154 lazy-loaded" data-lazy-type="image" data-src="https://vitux.com/wp-content/uploads/2018/10/word-image-178.png" height="91" src="https://vitux.com/wp-content/uploads/2018/10/word-image-178.png" width="298" /><br />
One way to change the hostname is through the following command:<br />
<em>$ sudo hostname new-hostname</em><br />
Example:<br />
<pre>$ sudo hostname Linux-system</pre>
<img alt="Set new hostname with hostname command" class="aligncenter wp-image-2155 lazy-loaded" data-lazy-type="image" data-src="https://vitux.com/wp-content/uploads/2018/10/word-image-179.png" data-srcset="" height="77" src="https://vitux.com/wp-content/uploads/2018/10/word-image-179.png" width="371" /><br />
The drawbackof this method is that the hostname will revert to the original when you restart your system.<br />
The
proper way to change the hostname is by changing it in two
configuration files named the hostname and hosts file located in the
/etc/ folder.<br />
You can open these files through any of your favorite text editors. We are opening this file in the nano editor as follows:<br />
<pre>$ sudo nano /etc/hostname</pre>
<img alt="Edit the /etc/hostname file" class="aligncenter wp-image-2156 lazy-loaded" data-lazy-type="image" data-src="https://vitux.com/wp-content/uploads/2018/10/word-image-180.png" data-srcset="" height="385" src="https://vitux.com/wp-content/uploads/2018/10/word-image-180.png" width="508" /><br />
The
only text in this file lists the hostname of your computer. Simply
change the text to a new hostname and then exit and save the file by
clicking Ctrl+X, and then y and hit enter.<br />
Then open the hosts file as follows:<br />
<pre>$ sudo nano /etc/hostname</pre>
In this file, the hostname is listed against the IP: 127.0.1.1<br />
<img alt="Edit /etc/hosts file" class="aligncenter wp-image-2157 lazy-loaded" data-lazy-type="image" data-src="https://vitux.com/wp-content/uploads/2018/10/word-image-181.png" data-srcset="" height="353" src="https://vitux.com/wp-content/uploads/2018/10/word-image-181.png" width="508" /><br />
Change this hostname to a new hostname and then exit and save the file by clicking Ctrl+X, and then y and hit enter.<br />
Now when you restart the system, your hostname will change to a static new hostname.<br />
<h3>
Method 3: Through the hostnamectl command</h3>
The
smartest way to change your hostname is through the hostnamectl command
that is a part of the Systemd utility. If Systemd is not already
installed on your system, you can install it through the following
command as root:<br />
<pre>$ sudo apt install systemd</pre>
You can check the version number of the Systemd utility by running the following command:<br />
<pre>$ systemd --version</pre>
This command will give you the version number of the utility and also ensure that it is indeed installed on your system<br />
Now
that the Systemd utility is installed on your system, you can run the
following command in order to view detailed information about your
system, including the hostname:<br />
<pre>$ hostnamectl</pre>
<img alt="Output of hostnamectl command" class="aligncenter wp-image-2158 lazy-loaded" data-lazy-type="image" data-src="https://vitux.com/wp-content/uploads/2018/10/word-image-182.png" data-srcset="" height="179" src="https://vitux.com/wp-content/uploads/2018/10/word-image-182.png" width="306" /><br />
In
this output, the Static hostname lists the permanent hostname of your
machine. The Pretty hostname lists the Device name you have set up
through the UI in the Settings utility. The hostnamectl lists the Pretty
hostname(device name) only if it is different from the static hostname.<br />
In order to change your computer’s hostname through the hostnamectl command, use the following syntax:<br />
<em>$ hostnamectl set-hostname “new-hostname”</em><br />
Example:<br />
<pre>$ hostnamectl set-hostname Linux-system</pre>
<img alt="Set new hostname with hostnamectl command" class="aligncenter wp-image-2159 lazy-loaded" data-lazy-type="image" data-src="https://vitux.com/wp-content/uploads/2018/10/word-image-183.png" data-srcset="" height="170" src="https://vitux.com/wp-content/uploads/2018/10/word-image-183.png" width="446" /><br />
Now
when you see, the hostname through the hostnamectl command, it will
show the static hostname as the new hostname you have set. The system
has also changed the device name to the hostname you specified through
the set-hostname command.<br />
You can verify through the UI that your
device name will also be the same as your static hostname. Open the
Settings utility and move to the Details tab to view your device name.<br />
<img alt="New hostname shows up in the GUI as well" class="aligncenter wp-image-2160 lazy-loaded" data-lazy-type="image" data-src="https://vitux.com/wp-content/uploads/2018/10/word-image-184.png" data-srcset="" height="343" src="https://vitux.com/wp-content/uploads/2018/10/word-image-184.png" width="369" /><br />
The
plus point of the Hostnamectl command is that you do not need to
restart your computer in order to permanently change the hostname.<br />
<h2>
Conclusion</h2>
Through
this tutorial, you learned to change the device name and computer
name(hostname) of your system. Now you can change your computer’s
hostname either temporarily or permanently through the Ubuntu command
line. All you need to do is change a few configuration files or simply
use the hostnamectl command to do so. Now you can have a customized
computer name through which other computers over the local area will
identify you.</div>
Sameh Attiahttp://www.blogger.com/profile/06829656663776752624noreply@blogger.com0tag:blogger.com,1999:blog-3950073089426506979.post-76227847824412438332018-10-27T00:23:00.000+02:002018-10-27T00:23:00.149+02:00How to Set Up SSH Keys on Debian 9<div dir="ltr" style="text-align: left;" trbidi="on">
https://linuxize.com/post/how-to-set-up-ssh-keys-on-debian-9<br />
<br />
<svg id="__SVG_SPRITE_NODE__" style="height: 0; position: absolute; width: 0;" xmlns="http://www.w3.org/2000/svg"><br /></svg>
<article class="single-post relative"><div class="w-full mx-auto max-w-screen-2xl">
<div class="lg:flex">
<div class="w-full lg:static lg:max-h-full lg:overflow-visible min-h-screen">
<div class="flex">
<div class="w-full pb-8">
<div class="mx-auto lg:ml-0 lg:mr-auto lg:pr-6 xl:mx-0 max-w-lg mb-6 xl:max-w-full xl:pr-8">
<div class="post-header">
<h1 class="font-bold leading-none lg:text-3xl mb-4 text-2xl text-black xl:mb-8 xxl:text-4xl">
How to Set Up SSH Keys on Debian 9</h1>
</div>
</div>
<div class="flex flex-col xl:flex-relative xl:flex-row">
<aside class="w-full block lg:hidden xl:block" id="sidebar2"><div class="hidden flex-col justify-between xl:flex -mt-12 pb-4 pt-12 sticky top-16">
<div class="mb-6 p-4 pb-2 toc bg-grey-lighter table-of-contents">
<div class="font-medium mb-3 mb-3 text-xs tracking-tight uppercase xxl:text-sm text-grey-darker">
Contents</div>
<nav id="TableOfContents"><ul>
<li><ul>
<li><a href="https://linuxize.com/post/how-to-set-up-ssh-keys-on-debian-9/#creating-ssh-keys-on-debian">Creating SSH keys on Debian</a></li>
<li><a href="https://linuxize.com/post/how-to-set-up-ssh-keys-on-debian-9/#copy-the-public-key-to-the-server">Copy the Public Key to the Server</a></li>
<li><a href="https://linuxize.com/post/how-to-set-up-ssh-keys-on-debian-9/#login-to-the-server-using-ssh-keys">Login to the Server using SSH Keys</a></li>
<li><a href="https://linuxize.com/post/how-to-set-up-ssh-keys-on-debian-9/#disabling-ssh-password-authentication">Disabling SSH Password Authentication</a></li>
<li><a href="https://linuxize.com/post/how-to-set-up-ssh-keys-on-debian-9/#conclusion">Conclusion</a></li>
</ul>
</li>
</ul>
</nav><nav class="flex flex-wrap">Secure
Shell (SSH) is a cryptographic network protocol used for secure
connection between a client and a server and supports various
authentication mechanisms.</nav></div>
</div>
</aside><section class="w-full mx-auto lg:ml-0 lg:mr-auto lg:pr-6 min-w-0 xl:mx-0 xl:px-8 xl:w-full"><div class="markdown">
The two most popular mechanisms are
passwords based authentication and public key based authentication.
Using SSH keys is more secure and convenient than traditional password
authentication.<br />
In this tutorial we will describe how to generate
SSH keys on Debian 9 systems. We will also show you how to setup a SSH
key-based authentication and connect to your remote Linux servers
without entering a password.<br />
<h2 class="anchor" id="creating-ssh-keys-on-debian">
<a data-scroll="" href="https://linuxize.com/post/how-to-set-up-ssh-keys-on-debian-9/#creating-ssh-keys-on-debian">Creating SSH keys on Debian</a></h2>
Before
generating a new SSH key pair, first check for existing SSH keys on
your Debian client machine. You can do that by running the following
command:<br />
<div class="highlight">
<pre class="chroma console-bash"><code class="language-console-bash" data-lang="console-bash"><span class="line">ls -l ~/.ssh/id_*.pub</span></code></pre>
<span class="code-copy button main small" data-clipboard-text="ls -l ~/.ssh/id_*.pub">Copy</span></div>
If the output of the command above contains something like <code>No such file or directory</code> or <code>no matches found</code> it means that you don’t have SSH keys and you can continue with the next step and generate a new SSH key pair.<br />
If there are existing keys, you can either use those and skip the next step or backup up the old keys and generate new ones.<br />
Start by generating a new 4096 bits SSH key pair with your email address as a comment using the following command:<br />
<div class="highlight">
<pre class="chroma console-bash"><code class="language-console-bash" data-lang="console-bash"><span class="line">ssh-keygen -t rsa -b 4096 -C "your_email@domain.com"</span></code></pre>
<span class="code-copy button main small" data-clipboard-text="ssh-keygen -t rsa -b 4096 -C "your_email@domain.com"">Copy</span></div>
The output will look similar to the following:<br />
<div class="highlight">
<pre class="chroma"><code class="language-output" data-lang="output">Enter file in which to save the key (/home/yourusername/.ssh/id_rsa):</code></pre>
<span class="code-copy button main small" data-clipboard-text="Enter file in which to save the key (/home/yourusername/.ssh/id_rsa):">Copy</span></div>
Press <code>Enter</code> to accept the default file location and file name.<br />
Next,
you’ll be prompted to type a secure passphrase. Whether you want to use
passphrase its up to you. With passphrase, an extra layer of security
is added to your key.<br />
<div class="highlight">
<pre class="chroma"><code class="language-output" data-lang="output">Enter passphrase (empty for no passphrase):</code></pre>
<span class="code-copy button main small" data-clipboard-text="Enter passphrase (empty for no passphrase):">Copy</span></div>
If you don’t want to use passphrase just press <code>Enter</code><br />
The whole interaction looks like this:<br />
<figure class="relative"><div class="w-full mx-auto my-0 block relative">
<div class="w-full text-center absolute h-full m-auto overflow-hidden pin">
<img alt="" class="medium-zoom-image" data-action="zoom" src="https://linuxize.com/post/how-to-set-up-ssh-keys-on-debian-9/generate-a-new-ssh-key-pair.jpg" /></div>
</div>
</figure>To verify that the SSH key pair was generated, type:<br />
<div class="highlight">
<pre class="chroma console-bash"><code class="language-console-bash" data-lang="console-bash"><span class="line">ls ~/.ssh/id_*</span></code></pre>
<span class="code-copy button main small" data-clipboard-text="ls ~/.ssh/id_*">Copy</span></div>
The output should look something like this:<br />
<div class="highlight">
<pre class="chroma"><code class="language-output" data-lang="output">/home/yourusername/.ssh/id_rsa /home/yourusername/.ssh/id_rsa.pub</code></pre>
<span class="code-copy button main small" data-clipboard-text="/home/yourusername/.ssh/id_rsa /home/yourusername/.ssh/id_rsa.pub">Copy</span></div>
<div class="w-full flex justify-center content-center">
<div class="w-full relative">
<ins class="adsbygoogle" data-ad-client="ca-pub-9439755881064125" data-ad-format="fluid" data-ad-layout="in-article" data-ad-slot="5120214995" data-adsbygoogle-status="done" style="display: block; height: 0px;"><ins id="aswift_2_expand" style="background-color: transparent; border: medium none; display: inline-table; height: 0px; margin: 0px; padding: 0px; position: relative; visibility: visible; width: 691px;"><ins id="aswift_2_anchor" style="background-color: transparent; border: medium none; display: block; height: 0px; margin: 0px; opacity: 0; overflow: hidden; padding: 0px; position: relative; visibility: visible; width: 691px;"></ins></ins></ins></div>
</div>
<h2 class="anchor" id="copy-the-public-key-to-the-server">
<a data-scroll="" href="https://linuxize.com/post/how-to-set-up-ssh-keys-on-debian-9/#copy-the-public-key-to-the-server">Copy the Public Key to the Server</a></h2>
Now that you have your SSH key pair, the next step is to copy the public key to the server you want to manage.<br />
The easiest and the recommended way to copy the public key to the remote server is to use the <code>ssh-copy-id</code> tool.<br />
On your local machine terminal tun the following command:<br />
<div class="highlight">
<pre class="chroma console-bash"><code class="language-console-bash" data-lang="console-bash"><span class="line">ssh-copy-id remoteusername@server_ip_address</span></code></pre>
<span class="code-copy button main small" data-clipboard-text="ssh-copy-id remoteusername@server_ip_address">Copy</span></div>
You will be prompted to enter the <code>remoteusername</code> password:<br />
<div class="highlight">
<pre class="chroma"><code class="language-output" data-lang="output">remoteusername@server_ip_address's password:</code></pre>
<span class="code-copy button main small" data-clipboard-text="remoteusername@server_ip_address's password:">Copy</span></div>
Once the user is authenticated, the public key <code>~/.ssh/id_rsa.pub</code> will be appended to the remote user <code>~/.ssh/authorized_keys</code> file and connection will be closed.<br />
<div class="highlight">
<pre class="chroma"><code class="language-output" data-lang="output">Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'username@server_ip_address'"
and check to make sure that only the key(s) you wanted were added.</code></pre>
<span class="code-copy button main small" data-clipboard-text="Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'username@server_ip_address'"
and check to make sure that only the key(s) you wanted were added.">Copy</span></div>
If the <code>ssh-copy-id</code> utility is not available on your local computer you can use the following command to copy the public key:<br />
<div class="highlight">
<pre class="chroma console-bash"><code class="language-console-bash" data-lang="console-bash"><span class="line">cat ~/.ssh/id_rsa.pub | ssh remoteusername@server_ip_address "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"</span></code></pre>
<span class="code-copy button main small" data-clipboard-text="cat ~/.ssh/id_rsa.pub | ssh remoteusername@server_ip_address "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"">Copy</span></div>
<h2 class="anchor" id="login-to-the-server-using-ssh-keys">
<a data-scroll="" href="https://linuxize.com/post/how-to-set-up-ssh-keys-on-debian-9/#login-to-the-server-using-ssh-keys">Login to the Server using SSH Keys</a></h2>
At this point you should be able login to the remote server without being prompted for a password.<br />
To test it, try to connect to the server via SSH:<br />
<div class="highlight">
<pre class="chroma console-bash"><code class="language-console-bash" data-lang="console-bash"><span class="line">ssh remoteusername@server_ip_address</span></code></pre>
<span class="code-copy button main small" data-clipboard-text="ssh remoteusername@server_ip_address">Copy</span></div>
If you haven’t set a passphrase, you will be logged in immediately. Otherwise you will be prompted to enter the passphrase.<br />
<h2 class="anchor" id="disabling-ssh-password-authentication">
<a data-scroll="" href="https://linuxize.com/post/how-to-set-up-ssh-keys-on-debian-9/#disabling-ssh-password-authentication">Disabling SSH Password Authentication</a></h2>
To add an extra layer of security to your server you can disable the password authentication for SSH.<br />
Before
disabling SSH password authentication make sure you can login to your
server without a password and the user you are logging in with has <a href="https://linuxize.com/post/how-to-create-a-sudo-user-on-debian/">sudo privileges</a>.<br />
Log into your remote server:<br />
<div class="highlight">
<pre class="chroma console-bash"><code class="language-console-bash" data-lang="console-bash"><span class="line">ssh sudo_user@server_ip_address</span></code></pre>
<span class="code-copy button main small" data-clipboard-text="ssh sudo_user@server_ip_address">Copy</span></div>
Open the SSH configuration file <code>/etc/ssh/sshd_config</code>:<br />
<div class="highlight">
<pre class="chroma console-bash"><code class="language-console-bash" data-lang="console-bash"><span class="line">sudo nano /etc/ssh/sshd_config</span></code></pre>
<span class="code-copy button main small" data-clipboard-text="sudo nano /etc/ssh/sshd_config">Copy</span></div>
Search for the following directives and modify as it follows:<br />
<div class="code-label">
/etc/ssh/sshd_config</div>
<pre><code>PasswordAuthentication no
ChallengeResponseAuthentication no
UsePAM no
</code></pre>
Once you are done save the file and restart the SSH service using the following command:<br />
<div class="highlight">
<pre class="chroma console-bash"><code class="language-console-bash" data-lang="console-bash"><span class="line">sudo systemctl restart ssh</span></code></pre>
<span class="code-copy button main small" data-clipboard-text="sudo systemctl restart ssh">Copy</span></div>
At this point, the password based authentication is disabled.<br />
<h2 class="anchor" id="conclusion">
<a data-scroll="" href="https://linuxize.com/post/how-to-set-up-ssh-keys-on-debian-9/#conclusion">Conclusion</a></h2>
In
this tutorial you have learned how to generate a new SSH key pair and
setup a SSH key-based authentication. You can add the same key to
multiple remote serves.<br />
We have also shown you how to disable SSH password authentication and add an extra layer of security to your server.<br />
If you have any question or feedback feel free to leave a comment.</div>
</section></div>
</div>
</div>
</div>
</div>
</div>
</article></div>
Sameh Attiahttp://www.blogger.com/profile/06829656663776752624noreply@blogger.com0tag:blogger.com,1999:blog-3950073089426506979.post-32570353828454055532018-10-19T10:13:00.002+02:002018-10-19T10:13:33.664+02:00Kali Linux: What You Must Know Before Using it<div dir="ltr" style="text-align: left;" trbidi="on">
https://fosspost.org/articles/must-know-before-using-kali-linux<br />
<br />
<div class="bdaia-post-content">
Kali Linux is the industry’s leading Linux distribution in
penetration testing and ethical hacking. It is a distribution that comes
shipped with tons and tons of hacking and penetration tools and
software by default, and is widely recognized in all parts of the world,
even among Windows users who may not even know what Linux is.<br />
Because of the latter, many people are trying to get alone with Kali
Linux although they don’t even understand the basics of a Linux system.
The reasons may vary from having fun, faking being a hacker to impress a
girlfriend or simply trying to hack the neighbors’ WiFi network to get a
free Internet, all of which is a bad thing to do if you are planning to
use Kali Linux.<br />
Here are some tips that you should know before even planning to use Kali Linux<br />
<h2>
Kali Linux is Not for Beginners</h2>
<figure class="wp-caption aligncenter" id="attachment_3792" style="width: 1366px;"><a href="https://i0.wp.com/fosspost.org/wp-content/uploads/2018/10/Kali-Linux-000.png?ssl=1"><img alt="Kali Linux Default GNOME Desktop" class="size-full wp-image-3792" height="461" src="https://i0.wp.com/fosspost.org/wp-content/uploads/2018/10/Kali-Linux-000.png?resize=850%2C478&ssl=1" width="820" /></a><figcaption class="wp-caption-text">Kali Linux Default GNOME Desktop</figcaption></figure>
If you are someone who has just started to use Linux few months ago,
or if you are don’t consider yourself to be above average in terms of
knowledge, then Kali Linux is not for you. If you are going to ask stuff
like “How do I install Steam on Kali? How do I make my printer work on
Kali? How do I solve the APT sources error on Kali”? Then Kali Linux is
not suitable for you.<br />
Kali Linux is mainly made for professionals wanting to run
penetration testing suits or people who want to learn ethical hacking
and digital forensics. But even if you were from the latter, the average
Kali Linux user is expected to face a lot of trouble while using Kali
Linux for his day-to-day usage. He’s also expected to take a very
careful approach to how he uses the tools and software, it’s not just
“let’s install it and run everything”. Every tool must be carefully
used, every software you install must be carefully examined.<br />
<strong>Good Read:</strong> <a href="https://fosspost.org/articles/what-are-the-components-of-a-linux-distribution">What are the components of a Linux system?</a><br />
Stuff which the average Linux user can’t do normally. A better
approach would be to spend few weeks learning about Linux and its
daemons, services, software, distributions and the way it works, and
then watch few dozens of videos and courses about ethical hacking, and
only then, try to use Kali to apply what you learned.<br />
<h2>
it Can Get You Hacked</h2>
<figure class="wp-caption aligncenter" id="attachment_3793" style="width: 1366px;"><a href="https://i0.wp.com/fosspost.org/wp-content/uploads/2018/10/Kali-Linux-001.png?ssl=1"><img alt="Kali Linux Hacking & Testing Tools" class="size-full wp-image-3793" height="461" src="https://i0.wp.com/fosspost.org/wp-content/uploads/2018/10/Kali-Linux-001.png?resize=850%2C478&ssl=1" width="820" /></a><figcaption class="wp-caption-text">Kali Linux Hacking & Testing Tools</figcaption></figure>
In a normal Linux system, there’s one account for normal user and one separate account for <span class="bdaia-shory-highlight">root</span>. This is not the case in Kali Linux. Kali Linux uses the <span class="bdaia-shory-highlight">root</span>
account by default and doesn’t provide you with a normal user account.
This is because almost all security tools available in Kali do require <span class="bdaia-shory-highlight">root</span> privileges, and to avoid asking you for <span class="bdaia-shory-highlight">root</span> password every minute, they designed it that way.<br />
Of course, you could simply create a normal user account and start
using it. Well, it’s still not recommended because that’s not how the
Kali Linux system design is meant to work. You’ll face a lot of problems
then in using programs, opening ports, debugging software, discovering
why this thing doesn’t work only to discover that it was a weird
privilege bug. You will also be annoyed by all the tools that will
require you to enter the password each time you try to do anything on
your system.<br />
Now, since you are forced to use it in as a <span class="bdaia-shory-highlight">root</span> user, all the software you run on your system will also run with <span class="bdaia-shory-highlight">root</span>
privileges. This is bad if you don’t know what you are doing, because
if there’s a vulnerability in Firefox for example and you visit one of
the infected dark web sites, the hacker will be able to get full root
permissions on your PC and hack you, which would have been limited if
you were using a normal user account. Also, some tools that you may
install and use can open ports and leak information without your
knowledge, so if you are not extremely careful, people can hack you in
the same way you may try to hack them.<br />
If you visit Facebook groups related to Kali Linux on few occasions,
you’ll notice that almost a quarter of the posts in these groups are
people calling for help because someone hacked them.<br />
<h2>
it Can Get You in Jail</h2>
Kali Linux provide the software as it is. Then, it is your own responsibility <em>alone</em> of how you use them.<br />
In most advanced countries around the world, using penetration
testing tools against public WiFi networks or the devices of others can
easily get you in jail. Now don’t think that you can’t be tracked just
because you are using Kali, many systems are configured to have complex
logging devices to simply track whoever tries to listen or hack their
networks, and you may stumble upon one of these, and it will destroy you
life.<br />
Don’t ever use Kali Linux tools against devices/networks which do not
belong to you or given explicit permission to try hacking them. If you
say that you didn’t know what you were doing, it won’t be accepted as an
excuse in a court.<br />
<h2>
Modified Kernel and Software</h2>
Kali is <a href="https://www.kali.org/news/kali-linux-rolling-edition-2016-1/">based</a>
on Debian (Testing branch, which means that Kali Linux uses a rolling
release model), so it uses most of the software architecture from there,
and you will find most of the software in Kali Linux just as they are
in Debian.<br />
However, some packages were modified to harden security and fix some
possible vulnerabilities. The Linux kernel that Kali uses for example is
patched to allow wireless injection on various devices. These patches
are not normally available in the vanilla kernel. Also, Kali Linux does
not depend on Debian servers and mirrors, but builds the packages by its
own servers. Here’s the default software sources in the latest release:<br />
<pre>deb http://http.kali.org/kali kali-rolling main contrib non-free
deb-src http://http.kali.org/kali kali-rolling main contrib non-free</pre>
That’s why, for some specific software, you will find a different
behaviour when using the same program in Kali Linux or using it in
Fedora, for example. You can see a full list of Kali Linux software from
<a href="http://git.kali.org/">git.kali.org</a>. You can also find our <a href="https://paste.ubuntu.com/p/bctSVWwpVw/">own generated list of installed packages</a> on Kali Linux (GNOME).<br />
More importantly, Kali Linux official documentation extremely suggests to <span style="color: red;"><em>NOT</em></span>
add any other 3rd-party software repositories, because since Kali Linux
is a rolling release and depends on Debian Testing, you will most
likely break your system by just adding a new repository source due to
dependencies conflicts and package hooks.<br />
<h2>
Don’t Install Kali Linux</h2>
<figure class="wp-caption aligncenter" id="attachment_3794" style="width: 750px;"><a href="https://i0.wp.com/fosspost.org/wp-content/uploads/2018/10/Kali-Linux-002.png?ssl=1"><img alt="Running wpscan on fosspost.org using Kali Linux" class="size-full wp-image-3794" height="504" src="https://i0.wp.com/fosspost.org/wp-content/uploads/2018/10/Kali-Linux-002.png?resize=750%2C504&ssl=1" width="750" /></a><figcaption class="wp-caption-text">Running wpscan on fosspost.org using Kali Linux</figcaption></figure>
I use Kali Linux on rare occasions to test the software and servers I
deploy. However, I will never dare to install it and use it as a
primary system.<br />
If you are going to use it as a primary system, then you will have to
keep your own personal files, password, data and everything else on
your system. You will also need to install tons of daily-use software in
order to ease your life. But as we mentioned above, using Kali Linux is
very risky and should be done very carefully, and if you get hacked,
you will lose all your data and it may get exposed to a wider audience.
Your personal information can also be used to track you if you are doing
non-legal stuff. You may even destroy your data by yourself if you are
not careful about how you use the tools.<br />
Even professional white hackers don’t recommend installing it as a
primary system, but rather, use it from USB to just do your penetration
testing work and then leave back to your normal Linux distribution.<br />
<h2>
The Bottom Line</h2>
As you may see now, using Kali is not an easy decision to take
lightly. If you are planning to be a whiter hacker and you need to use
Kali to learn, then go for it after learning the basics and spending few
months with a normal system. But be careful for what you are doing to
avoid being in trouble.<br />
If you are planning to use Kali or if you need any help, I’ll be happy to hear your thoughts in the comments.<br />
</div>
</div>
Sameh Attiahttp://www.blogger.com/profile/06829656663776752624noreply@blogger.com0