×


Blog


Change Date, Time, and Time Zone in CentOS 8 - How to do it ?

This article covers how you can easily adjust the time, date, and time zone of your system in CentOS 8.

To change the time zone in Linux systems use the sudo timedatectl set-timezone command followed by the long name of the time zone you want to set.


How to Synchronize Time on Installed Linux Operating Systems ?

1. On the Linux machine, log in as root.

2. Run the ntpdate -u <ntpserver> command to update the machine clock. For example, ntpdate -u ntp-time.

3. Open the /etc/ntp. conf file and add the NTP servers used in your environment.

4. Run the service ntpd start command to start the NTP service and implement you configuration changes.


Importance of man command in Linux:

man command in Linux is used to display the user manual of any command that we can run on the terminal. 

It provides a detailed view of the command which includes NAME, SYNOPSIS, DESCRIPTION, OPTIONS, EXIT STATUS, RETURN VALUES, ERRORS, FILES, VERSIONS, EXAMPLES, AUTHORS.


Install and Configure Apache Web Server with Virtual Host on Debian 10 - Do it now ?

This article covers how to perform installation and configuration of Apache web server on Debian 10.

Also, you will learn how to create virtual hosts on an Apache server and troubleshoot errors. These steps are almost the same for Ubuntu and LinuxMint distributions.

Apache HTTP Server is a free and open-source web server that delivers web content through the internet. It is commonly referred to as Apache and after development, it quickly became the most popular HTTP client on the web.


On most systems if you installed Apache with a package manager, or it came preinstalled, the Apache configuration file is located in one of these locations: /etc/apache2/httpd. conf. /etc/apache2/apache2.


Debian/Ubuntu Linux Specific Commands to Start/Stop/Restart Apache:

1. Restart Apache 2 web server, enter: # /etc/init.d/apache2 restart. $ sudo /etc/init.d/apache2 restart.

2. To stop Apache 2 web server, enter: # /etc/init.d/apache2 stop.

3. To start Apache 2 web server, enter: # /etc/init.d/apache2 start.


To check running status of LAMP stack:

1. For Ubuntu: # service apache2 status.

2. For CentOS: # /etc/init.d/httpd status.

3. For Ubuntu: # service apache2 restart.

4. For CentOS: # /etc/init.d/httpd restart.

5. You can use mysqladmin command to find out whether mysql is running or not.


Install Slack on CentOS 8 - Step by Step process to perform it ?

This article covers how you can easily install slack platform on your CentOS 8 Linux system through the command line. 

Using a slack application, team members of an organization can unify all conversations from different sources.


Slack is one of the most popular collaboration platforms in the world that brings all your communication together. 

Conversations in Slack are organized in channels. 

You can create channels for your teams, projects, topics, or any other purpose. 

You can search through everything that's been posted in channels or your messages. 

Slack also allows you to talk with your teammates over audio or video calls and share documents, images, videos, and other files.


To Install Slack on CentOS:

1. Update system

sudo yum -y update

2. Download and Install Slack on CentOS

sudo yum -y install wget

wget https://downloads.slack-edge.com/linux_releases/slack-3.4.0-0.1.fc21.x86_64.rpm

sudo  yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

sudo yum localinstall slack-3.4.0-0.1.fc21.x86_64.rpm

3. Start and Use Slack

Now that Slack is installed on your CentOS / RHEL 8 desktop, you can launch it through the command line,

$ slack


Find Files in Debian 10 - How to perform this ?

This article covers the different methods of finding files in Debian 10. 


To find a file in Debian:

Use the Locate command

1. Debian and Ubuntu sudo apt-get install locate.

2. CentOS yum install locate.

3. Prepare locate command for first use. To update the mlocate.db database before first use, run: sudo updatedb. 

To use locate, open a terminal and type locate followed by the file name you are looking for.


To locate a file in Linux:

1. find . - name thisfile.txt. If you need to know how to find a file in Linux called thisfile.

2. find /home -name *.jpg. Look for all . jpg files in the /home and directories below it.

3. find . - type f -empty. Look for an empty file inside the current directory.

4. find /home -user randomperson-mtime 6 -iname ".db".


To find packages in Debian:

You can also search for a package using the aptitude Ncurses user interface. 

1. Type 'aptitude' in the terminal and the following interface will be displayed in the window. 

2. To search for a package, press '/' and then type the package name into the search bar.


How to use grep to find a file?

The grep command searches through the file, looking for matches to the pattern specified. 

To use it type grep , then the pattern we're searching for and finally the name of the file (or files) we're searching in. 

The output is the three lines in the file that contain the letters 'not'.


To list files in Linux:

The easiest way to list files by name is simply to list them using the ls command. Listing files by name (alphanumeric order) is, after all, the default. 

You can choose the ls (no details) or ls -l (lots of details) to determine your view.


Which command have more searching options to search a file in file system in Linux?

Grep is a Linux / Unix command-line tool used to search for a string of characters in a specified file. The text search pattern is called a regular expression. 

When it finds a match, it prints the line with the result. 

The grep command is handy when searching through large log files.


grep is a command-line utility for searching plain-text data sets for lines that match a regular expression. 

Its name comes from the ed command g/re/p (globally search for a regular expression and print matching lines), which has the same effect.


To grep recursively in a directory:

To recursively search for a pattern, invoke grep with the -r option (or --recursive ). When this option is used grep will search through all files in the specified directory, skipping the symlinks that are encountered recursively.


Block or Unblock Ping Request on Debian 10 - How to perform this task ?

This article covers how you can block/unblock ping requests to your Debian system. You will learn different ways for blocking/unblocking ping requests either temporarily or permanently.


The --query-icmp-block=<type> option can be used to determine if a type is confgured to allow or deny. 

The --add-icmp-block=<type> option can be used to block a certain type. 

The --remove-icmp-block=<type> option can be used to not block a certain type. 

After adding or removing a block, reload the firewall.


To block ping requests in Linux:

1. Edit /etc/sysctl.conf. Add the following line to your /etc/sysctl.conf : net.ipv4.icmp_echo_ignore_all=1. Then: sysctl -p.

2. Using iptables: iptables -I INPUT -p icmp --icmp-type echo-request -j DROP.

3. With cron. Run crontab -e as root, then add the following line: @reboot echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_all.


To block ping in iptables:

1. Add a rule that tells the iptables firewall to block ping in and out of a server by controlling the ICMP requests.

2. Remove the rule that tells the iptables firewall to allow ping in and out of a server by controlling the ICMP requests.


To enable ping on Linux server?

# iptables -D INPUT -p icmp --icmp-type echo-request -j REJECT D : 

This command switch is used to delete the rule. Once the ping enabled, the server should now respond to ping requests


Create and Run a Shell Script in Linux Mint 20 - Step by Step process to perform this ?

This article covers the method of creating and running a shell script in Linux Mint 20.

With this, you can write and execute complex shell scripts in Linux Mint 20 very easily.


To write and execute a script:

1. Open the terminal. Go to the directory where you want to create your script.

2. Create a file with . sh extension.

3. Write the script in the file using an editor.

4. Make the script executable with command chmod +x <fileName>.

5. Run the script using ./<fileName>.


To save a .sh file in Ubuntu:

1. Run nano hello.sh.

2. nano should open up and present an empty file for you to work in.

3. Then press Ctrl-X on your keyboard to Exit nano.

4. nano will ask you if you want to save the modified file.

5. nano will then confirm if you want to save to the file named hello.sh.


To Make a Bash Script Executable in Linux:

1) Create a new text file with a . sh extension.

2) Add #!/bin/bash to the top of it. This is necessary for the “make it executable” part.

3) Add lines that you'd normally type at the command line.

4) At the command line, run chmod u+x YourScriptFileName.sh.

5) Run it whenever you need!