How to Enable Timestamp in Linux History Command Output

History is one the most useful command line tool for all Linux and Unix geeks. As the name suggests history command is used to keep track of all commands that were executed on a Linux server. By default, history command stores last one thousand commands in their output.

History command’s output becomes very handy during audit and in situations where we want to know which command were exactly executed to install applications and to do troubleshooting.

Sample Output of History Command,

# history


As we can see in above history command output what commands were executed but issue is here that we do not have timestamp in output. So, we can’t say anything about the timings of command execution.

So, to enable timestamp in history command output, we must configure “HISTTIMEFORMAT” variable.

Execute following command to configure this variable

# export HISTTIMEFORMAT="%F %T "


%F –> shows Date in the format ‘YYYY-M-D’ (Year-Month-Day)

%T –> shows Time in the format ‘HH:MM:S’ (Hour:Minute:Seconds)

Now execute the history command again and verify whether we can see date and time in front of each command,

# history


That’s it we have successfully enable timestamp in history command. To make “HISTTIMEFORMAT” variable persistent across the reboot, configure it permanently in ~.bashrc file , append the following code at end of file

# vi ~/.bashrc

Save and exit the file.

To make changes of bashrc file into the effect immediately, execute beneath command,

# source  ~/.bashrc

In case if you wish to remove timestamp from history  command then remove the line which contains “export HISTTIMEFORMAT=”%F %T ” from ~/.bashrc file

If you want to enable timestamp in history command for all local users too, then define the variable HISTTIMEFORMAT in /etc/profile file instead of root user’s ~/.bashrc file.

 # vi /etc/profile

Save and exit the file. To make above changes into the effect , source it.

# source  /etc/profile

Now run history command via local user and see whether date and time is visible in front of each command.

[[email protected] ~]# su - linuxtechi
[[email protected] ~]$ history
    1  2019-10-28 01:07:46 exit
    2  2019-10-28 01:07:46 exit
    3  2019-10-28 01:07:46 sudo vi /etc/fstab
    4  2019-10-28 01:07:46 vi /etc/ntp.conf
    5  2019-10-28 01:07:46 exit
    6  2019-10-28 01:07:46 echo $JAVA_HOME
    7  2019-10-28 01:07:46 exit

That’s all from this article. Please do share it among your technical friends and share your feedback and comments in the comments section below.

from Linuxtechi…

Read More

HDD and SSD – How Do They Differ?

Before we dive in with their differences, let’s look at their similarities. Hard Disk Drive (HDD) and Solid State Drive (SSD) are both storage components of your computer. Both also come in external or portable form. But how they function and store data are completely different.


Whenever consumers shop for new computers, even second-hand ones, they always check for the storage. And what they commonly encounter as the storage of say, example 1TB, is the hard drive, and very rarely the SSD. But some desktops and laptops have SSD in them as storage. Ultimately, what you use your computer for will determine which one you will need more. Wait, you can run a computer without an HDD? Well technically, yes. But it will be tricky.


The reason why HDD is one of the first things you see when shopping for a computer is because its quality and technology is tried and tested with time. 5 decades, to be precise.

The technology behind hard disk drives is well known and well-tested. Hard disk drives have been around for more than 50 years, steadily increasing their storage capacity and decreasing their physical size. HDDs rely on spinning disks, or platters, to read and write data.



Spinning platters and moving arms are what mainly compose a hard disk drive.

Hard disk drives consist of one or more magnetically-sensitive platters, an actuator arm with a read/write head on it for each platter, and a motor to spin the platters and move the arms. There is also an I/O controller and firmware that tells the hardware what to do and communicates with the rest of the system.



HDDs have stood the test of time. They have a trusted and reliable technology. Moreover, they are more affordable than SSDs even with the same storage amount. And compared to SSDs, they also come with more storage in the market. The bad? They use physical power. The moving parts can stop working when your computer is mishandled, especially laptops.

The drawbacks to HDDs are a result of the mechanical parts used to read and write data, as physically finding and retrieving data takes more time than electronically finding and retrieving data. The mechanical parts can skip or even fail if they are handled roughly or dropped. This is a concern in laptops, but not as much in desktops. HDDs are also heavier and use more energy than comparable SSDs.



An SSD, on the other hand, utilizes flash memory. This means that its processes are electronic, not physical.

Solid state drives use flash memory to deliver superior performance and durability. Because there are lots of small, moving parts inside your hard drive — magnetic heads, spindles, and spinning platters — it’s easy for things to go wrong and you could lose your important data. Without moving parts, SSDs are more durable, run cooler and use less energy..



SSDs run on NAND technology. And no, it is not an acronym. Unlike HDDs, SSDs have gates and charges.

SSDs can be thought of as large USB drives; they use the same base technology. NAND, the technology in solid state drives, is a kind

Read More

How to Install and Configure Nagios Core on RHEL 8 / CentOS 8

Nagios is a free and opensource network and alerting engine used to monitor various devices, such as network devices, and servers in a network. It supports both Linux and Windows OS and provides an intuitive web interface that allows you to easily monitor network resources. When professionally configured, it can alert you in the event a server or a network device goes down or malfunctions via email alerts. In this topic, we shed light on how you can install and configure Nagios core on RHEL 8 / CentOS 8.


Prerequisites of Nagios Core

Before we begin, perform a flight check and ensure you have the following:

  • An instance of RHEL 8 / CentOS 8
  • SSH access to the instance
  • A fast and stable internet connection

With the above requirements in check, let’s roll our sleeves!

Step 1: Install LAMP Stack

For Nagios to work as expected, you need to install LAMP stack or any other web hosting stack since it’s going to run on a browser. To achieve this, execute the command:

# dnf install httpd mariadb-server php-mysqlnd php-fpm


You need to ensure that Apache web server is up and running. To do so, start and enable Apache server using the commands:

# systemctl start httpd
# systemctl enable httpd


To check the status of Apache server run

# systemctl status httpd


Next, we need to start and enable MariaDB server, run the following commands

# systemctl start mariadb
# systemctl enable mariadb


To check MariaDB status run:

# systemctl status mariadb


Also, you might consider hardening or securing your server and making it less susceptible to unauthorized access. To secure your server, run the command:

# mysql_secure_installation

Be sure to set a strong password for your MySQL instance. For the subsequent prompts, Type Yes and hit ENTER


Step 2: Install Required packages

Apart from installing the LAMP server, some additional packages are needed for the installation and proper configuration of Nagios. Therefore, install the packages as shown below:

# dnf install gcc glibc glibc-common wget gd gd-devel perl postfix


Step 3: Create a Nagios user account

Next, we need to create a user account for the Nagios user. To achieve this , run the command:

# adduser nagios
# passwd nagios


Now, we need to create a group for Nagios and add the Nagios user to this group.

# groupadd nagiosxi

Now add the Nagios user to the group

# usermod -aG nagiosxi nagios

Also, add Apache user to the Nagios group

# usermod -aG nagiosxi apache


Step 5: Download and install Nagios core

We can now proceed and install Nagios Core. The latest stable version in Nagios 4.4.5 which was released on August 19, 2019.  But first, download the Nagios tarball file from its official site.

To download Nagios core, first head to the tmp directory

# cd /tmp

Next download the tarball file

# wget


After downloading the tarball file, extract it using the command:

# tar -xvf nagios-4.4.5.tar.gz

Next, navigate to the uncompressed folder

# cd nagios-4.4.5

Run the commands below in this order

# ./configure --with-command-group=nagcmd
# make all
# make install
# make install-init
# make install-daemoninit
# make install-config
# make install-commandmode
# make install-exfoliation

To setup Apache configuration issue the …

Read More

How To Make Your Computer Perform Faster

Do you remember that time you got your PC or laptop and how mighty fast it was? A few months in and it was beginning to be sluggish. Pages load slow, programs don’t open as fast as they did before, the computer starts and shuts off slower than ever – it’s beginning to be hard to tell what is which.

The truth is, a lot of things can cause your computer to slow down. Your storage may be almost full if not already, you have viruses and other malware lying around, you have a long list of search history, or you simply have a slow internet connection. These are just some of the many things that have been keeping your computer from performing at its fastest.

Here are some things you can do to help your computer work relatively faster.

Make way for the more important and current things.

If these temporary internet files and other useless items stick around for too long, they can not only cause programs to hang and become unresponsive and sluggish, but also take up valuable hard drive space.

Clean up your desktop if it’s cluttered. Making Windows Explorer load those icons and folders each time the desktop refreshes can put unnecessary load on your hardware, which takes away system resources that could be used elsewhere.

Remove unwanted programs that are just lingering on your computer. These are not only taking up hard drive space but they might open automatically with Windows and be running in the background all the time, sucking away at the processor and memory. There are several free uninstaller tools that make this really easy.

Also considered junk files is anything you simply don’t use or want anymore. So, delete those old video files that you downloaded a year ago and back up all the data you don’t readily use, like vacation pictures.

Defragging the hard drive.

To defrag your hard drive is to consolidate all the empty spaces that are created in the file system structure as you add and remove files. These empty spaces make your hard drive take longer to think, which in turn causes files, folders, and programs to open slowly.

Windows is more susceptible to viruses and malware than Mac. The best way to address this is by having an anti-virus or malware program.

Once the virus is on the computer, it usually stores itself in the system memory, hogging resources that could be used by legitimate programs, thus slowing everything down. Some malicious programs show pop-ups or trick you into buying their “antivirus program,” which are even more reasons to remove them.

You should periodically scan your computer for malware to get rid of these pesky memory hogs.

Errors occur when you force a command while the computer is doing a task on hand. Avoiding this will greatly prevent errors from frequently occurring.

Installing and uninstalling software and Windows updates, rebooting your computer during an update, forcing your computer to shut down immediately, and other things can cause errors within the Windows system files.

These errors can cause things to lock up, halt program installs and updates, and just generally prevent the experience of a smooth

Read More

How to dual boot Windows 10 and Debian 10

So, you finally made the bold decision to try out Linux after much convincing. However, you do not want to let go of your Windows 10 operating system yet as you will still be needing it before you learn the ropes on Linux. Thankfully, you can easily have a dual boot setup that allows you to switch to either of the operating systems upon booting your system. In this guide, you will learn how to dual boot  Windows 10 alongside Debian 10.



Before you get started, ensure you have the following:

  • A bootable USB  or DVD of Debian 10
  • A fast and stable internet connection ( For installation updates & third party applications)

Additionally, it worth paying attention to how your system boots (UEFI or Legacy) and ensure both the operating systems boot using the same boot mode.

Step 1: Create a free partition on your hard drive

To start off, you need to create a free partition on your hard drive. This is the partition where Debian will be installed during the installation process. To achieve this, you will invoke the disk management utility as shown:

Press Windows Key + R to launch the Run dialogue. Next, type diskmgmt.msc and hit ENTER


This launches the disk management window displaying all the drives existing on your Windows system.


Next, you need to create a free space for Debian installation. To do this, you need to shrink a partition from one of the volumes and create a new unallocated partition. In this case, I will create a 30 GB partition from Volume D.

To shrink a volume, right-click on it and select the ‘shrink’ option


In the pop-up dialogue, define the size that you want to shrink your space. Remember, this will be the disk space on which Debian 10 will be installed. In my case, I selected 30000MB  ( Approximately 30 GB). Once done, click on ‘Shrink’.


After the shrinking operation completes, you should have an unallocated partition as shown:


Perfect! We are now good to go and ready to begin the installation process.

Step 2: Begin the installation of Debian 10

With the free partition already created, plug in your bootable USB drive or insert the DVD installation medium in your PC and reboot your system. Be sure to make changes to the boot order in the BIOS set up by pressing the function keys (usually, F9, F10 or F12 depending on the vendor). This is crucial so that the PC boots into your installation medium. Saves the BIOS settings and reboot.

A new grub menu will be displayed as shown below: Click on ‘Graphical install


In the next step, select your preferred language and click ‘Continue


Next, select your location and click ‘Continue’. Based on this location the time will automatically be selected for you. If you cannot find you located, scroll down and click on ‘other’ then select your location.


Next, select your keyboard layout.


In the next step, specify your system’s hostname and click ‘Continue


Next, specify the domain name. If you are not in a domain environment, simply click on the ‘continue’ button.


In the …

Read More

How To Back Up Data On Your Android Smartphone Or Tablet

Backing up data isn’t only for your PC or laptop. There’s nothing like losing important data because of accidental deletion or a misplaced folder or location. When it comes to smartphones and tablets, you can always back them up by storing some data on your computer from your device. But if this isn’t an option for you or if your computer is almost full, other backup processes can be done instead.

Devices that store data like smartphones and tablets need to be backed up as well. You use your smartphone almost every time and take it with you wherever you go. Therefore, it only makes sense to back it up.

Back in the day, backing up phones is a tedious process. But today, it has become less dreary and confusing. Everyone’s got a different Android version on their device. But these steps can still apply to the recent ones. Android allows backing up from your Google account.

First step, you need to turn on the backup settings.

Open the Settings menu and look for Backup and reset. Check that the Back up my data option is enabled under Google account and that the correct Google account is shown under Backup account — tap this section to add another account, if necessary.
Also check that Automatic restore is enabled, this backs up your app settings.

After turning it on, you can now decide on what to sync with your Google account. Among these are your contacts, calendar, Google Drive, etc.

Go to Settings – Accounts and tap your Google account and you’ll see a list of what is being backed up to Google’s servers, including: Calendar, Contacts, Drive and Gmail.

Use the sliders to turn back up off.

Another thing you can backup is your photos. Better back them up than lose them.

Back up your photos using the Google Photos app.
The first time you use this it may give you the option to Back up your photos and videos.

Otherwise, launch the Photos app, sign in with the Google account you want to use, then click Settings – Back up & sync and turn on the slider next to Back up & sync.

The next thing is to choose how you want to back up your photos. You have two choices: over wi-fi or mobile data.

By default, backups takes place over wi-fi, but you can choose to use mobile data by tapping the slider next to Photos. If you opt for this make sure you keep an eye on how much data you use.

Google Photos provides ‘unlimited’ online storage for your photos and they’re private unless you share them with someone else. You can view them online at

If in case you lost your device due to theft, physical damage, or other reasons, you can always have access to these files and data if you have successfully backed them up in your Google account.

Log in with your Google account (or iOS account if you are an iPhone user) and all the data back-up related to that account will be restored.

Backing up data is truly an important step to consider …

Read More

14 SCP Command Examples to Securely Transfer Files in Linux

SCP (Secure Copy) is command line tool in Linux and Unix like systems which is used to transfer files and directories across the hosts securely over the network. When we use scp command to copy files and directories from our local system to remote system then in the backend it makes ssh connection to remote system. In other words, we can say scp uses the same SSH security mechanism in the backend, it needs either password or keys for authentication.


In this tutorial we will discuss 14 useful Linux scp command examples.

Syntax of scp command:

# scp <options> <files_or_directories> [email protected]_host:/<folder>

# scp <options> [email protected]_host:/files   <folder_local_system>

In the first syntax of scp command demonstrate how to copy files or directories from local system to target host under the specific folder.

Second syntax of scp command demonstrate how files from target host is copied into local system.

Some of the most widely used options in scp command are listed below,

  •  -C         Enable Compression
  •  -i           identity File or private key
  •  -l           limit the bandwidth while copying
  •  -P          ssh port number of target host
  •  -p          Preserves permissions, modes and access time of files while copying
  •  -q          Suppress warning message of SSH
  •   -r          Copy files and directories recursively
  •   -v          verbose output

Let’s jump into the examples now!!!!

Example:1 Copy a File from local system to remote system using scp

Let’s assume we want to copy jdk rpm package from our local Linux system to remote system ( using scp command, use the following command,

[[email protected] ~]$ scp jdk-linux-x64_bin.rpm [email protected]:/opt
[email protected]'s password:
jdk-linux-x64_bin.rpm                          100%   10MB  27.1MB/s   00:00
[[email protected] ~]$

Above command will copy jdk rpm package file to remote system under /opt folder.

Example:2) Copy a file from remote System to local system using scp

Let’s suppose we want to copy a file from remote system to our local system under the /tmp folder, execute the following scp command,

[[email protected] ~]$ scp [email protected]:/root/Technical-Doc-RHS.odt /tmp
[email protected]'s password:
Technical-Doc-RHS.odt                         100% 1109KB  31.8MB/s   00:00
[[email protected] ~]$ ls -l /tmp/Technical-Doc-RHS.odt
-rwx------. 1 pkumar pkumar 1135521 Oct 19 11:12 /tmp/Technical-Doc-RHS.odt
[[email protected] ~]$

 Example:3) Verbose Output while transferring files using scp (-v)

In scp command, we can enable the verbose output using -v option, using verbose output we can easily find what exactly is happening in the background. This becomes very useful in debugging connection, authentication and configuration problems.

[email protected] ~]$ scp -v jdk-linux-x64_bin.rpm [email protected]:/opt
Executing: program /usr/bin/ssh host, user root, command scp -v -t /opt
OpenSSH_7.8p1, OpenSSL 1.1.1 FIPS  11 Sep 2018
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Reading configuration data /etc/ssh/ssh_config.d/05-redhat.conf
debug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config
debug1: /etc/ssh/ssh_config.d/05-redhat.conf line 8: Applying options for *
debug1: Connecting to [] port 22.
debug1: Connection established.
debug1: Next authentication method: password
[email protected]'s password:

Example:4) Transfer multiple files to remote system

Multiple files can be copied / transferred to remote system using scp command in one go, in scp command specify the multiple files separated by space, example is shown below

[[email protected] ~]$ scp install.txt index.html jdk-linux-x64_bin.rpm [email protected]:/mnt
[email protected]'s password:
install.txt                                      100%    0     0.0KB/s   00:00
index.html                                       100%   85KB   7.2MB/s   00:00
jdk-linux-x64_bin.rpm                            100%   10MB  25.3MB/s   00:00
[[email protected] ~]$

Example:5) Transfer files across two remote hosts

Using scp command we can copy files and directories between two remote hosts, let’s suppose we …

Read More Promo Codes for 2019 is a Minecraft server provider with years of experience. They’re often recommended on the WebHostingTalk forums. Get a coupon/discount code here. Get 25% off for life with this coupon code If that^ coupon didn’t work, try this one: Get 25% off for life with this second coupon code Promo code: get 20% […]


from ThisHosting.Rocks…

Read More

How to Configure Rsyslog Server in CentOS 8 / RHEL 8

Rsyslog is a free and opensource logging utility that exists by default on  CentOS 8 and RHEL 8 systems. It provides an easy and effective way of centralizing logs from client nodes to a single central server. The centralization of logs is beneficial in two ways. First,  it simplifies viewing of logs as the Systems administrator can view all the logs of remote servers from a central point without logging into every client system to check the logs. This is greatly beneficial if there are several servers that need to be monitored and secondly, in the event that a remote client suffers a crash, you need not worry about losing the logs because all the logs will be saved on the central rsyslog server. Rsyslog has replaced syslog which only supported UDP protocol. It extends the basic syslog protocol with superior features such as support for both UDP and TCP protocols in transporting logs, augmented filtering abilities, and flexible configuration options. That said, let’s explore how to configure the Rsyslog server in CentOS 8 / RHEL 8 systems.



We are going to have the following lab setup to test the centralized logging process:

  • Rsyslog server       CentOS 8 Minimal    IP address:
  • Client system         RHEL 8 Minimal      IP address:

From the setup above, we will demonstrate how you can set up the Rsyslog server and later configure the client system to ship logs to the Rsyslog server for monitoring.

Let’s get started!

Configuring the Rsyslog Server on CentOS 8

By default, Rsyslog comes installed on CentOS 8 / RHEL 8 servers. To verify the status of Rsyslog, log in via SSH and issue the command:

$ systemctl status rsyslog

Sample Output


If rsyslog is not present for whatever reason, you can install it using the command:

$ sudo yum install rsyslog

Next, you need to modify a few settings in the Rsyslog configuration file. Open the configuration file.

$ sudo vim /etc/rsyslog.conf

Scroll and uncomment the lines shown below to allow reception of logs via UDP protocol

module(load="imudp") # needs to be done just once
input(type="imudp" port="514")


Similarly, if you prefer to enable TCP rsyslog reception uncomment the lines:

module(load="imtcp") # needs to be done just once
input(type="imtcp" port="514")


Save and exit the configuration file.

To receive the logs from the client system,  we need to open Rsyslog default port 514 on the firewall. To achieve this, run

# sudo firewall-cmd  --add-port=514/tcp  --zone=public  --permanent

Next, reload the firewall to save the changes

# sudo firewall-cmd --reload

Sample Output


Next, restart Rsyslog server

$ sudo systemctl restart rsyslog

To enable Rsyslog on boot, run beneath command

$ sudo systemctl enable rsyslog

To confirm that the Rsyslog server is listening on port 514, use the netstat command as follows:

$ sudo netstat -pnltu

Sample Output


Perfect! we have successfully configured our Rsyslog server to receive logs from the client system.

To view log messages in real-time run the command:

$ tail -f /var/log/messages

Let’s now configure the client system.

Configuring the client system on RHEL 8

Like the Rsyslog server, log in and check if the rsyslog daemon is running by issuing the command:

$ sudo systemctl status rsyslog

Sample Output


Next, proceed to open the rsyslog configuration file

Read More

Cloud Hosting Vs. Shared Hosting: Which One Is Right For You

Opting for the right hosting is a crucial decision to make, as it is the bedrock of your business website. There is a bevy of web hosting options made available today. Two such examples are cloud hosting and shared hosting, which you are very likely to come across when searching for a solution. Having a […]


from ThisHosting.Rocks…

Read More