×


Category: Linux Tutorial


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!


Create and Run a Perl Script in Linux Mint - How to perform this task ?

This article covers how to create and execute a Perl script in Linux Mint 20. Moreover, if Perl is not installed on your system already, then we have even shared with you the method of installing it on your system and also ensuring if its interpreter exists there or not.

Perl is a programming language that can be used to perform tasks that would be difficult or cumbersome on the command line. Perl is included by default with most GNU/Linux distributions. 

PERL- Practical Extraction and Reporting Language (not an official acronym), is a stable and cross-platform language and was created by Larry Wall. 

Perl is an open source, general-purpose, interpreted language. Programs written in Perl are called Perl scripts. 

Perl supports both Procedural language and Object Oriented language and has powerful built-in support for text processing and have a collection of third-party modules. Perl language is mainly used for Web Applications, System Administration, Batch Processing, Applications which involving text processing and most command line applications. 


To run a Perl script in Unix:

1. Find the interpreter/executors path. In this case its /usr/bin/perl or /usr/bin/env perl.

2. Add it to the first line of the file as #!/usr/bin/perl .

3. Give execute permission to the file chmod +x example.pl.


Features of Perl language:

1. Perl takes the best features from other languages, such as C, awk, sed, sh, and BASIC, among others.

2. Perls database integration interface DBI supports third-party databases including Oracle, Sybase, Postgres, MySQL, and others.

3. Perl works with HTML, XML, and other mark-up languages.

4. Perl supports Unicode.

5. Perl supports both procedural and object-oriented programming.

6. Perl interfaces with external C/C++ libraries through XS or SWIG.

7. Perl is extensible.

8. The Perl interpreter can be embedded into other systems.


To install Perl in Linux:

1. Before proceeding with the installation of Perl in your Linux system, please have a check Perl is installed or not on your Linux system by running the below command:

# perl -v

2. Download the zipped source code available for Unix/Linux by running the below command:

# wget https://www.cpan.org/src/5.0/perl-5.28.1.tar.gz

3. After download the zip file runs the below commands to extract and install Perl:

# tar -xzf perl-5.28.1.tar.gz

# cd perl-5.28.1

# ./Configure -de

#make

# make test

# make install


How to write your Perl script in Linux?

You can write your Perl script in a text file and the text file should have the extension '.pl'. 

To run your Perl script run the below command.

#perl filename

Eg: #perl hello.pl


Configure NFS Server and Client on Linux Mint 20 - Step by Step process to do it ?

This article covers how to setup the NFS server and client on Mint. You will learn how to install the NFS server and client, configure and share NFS export directories, and mount/unmount the NFS shares on the client.

Network File System (NFS), is a distributed file system that allows various remote systems to access a file share. We all know that files should be stored on a central server for security and ease of backup. NFS provides us with a file sharing service that is easily managed and controls client access to resources.


To Install the NFS Client on the Client Systems:

1. Install the NFS-Common Package. As is the norm, begin by updating the system packages and repositories before anything else.

2. Create a NFS Mount Point on Client.

3. Mount NFS Share on Client System.

4. Testing the NFS Share on Client System.


A Network File System (NFS) allows remote hosts to mount file systems over a network and interact with those file systems as though they are mounted locally. This enables system administrators to consolidate resources onto centralized servers on the network.


Benefits of setting up an NFS server:

1. Enables multiple computers to use the same files, so everyone on the network can access the same data.

2. Reduces storage costs by having computers share applications instead of needing local disk space for each user application.


Reboot Linux Mint 20 - How to do it ?

This article covers methods to reboot the Linux Mint. If you want to shut down your Linux Mint instead of rebooting, Learn How to Shutdown Linux Mint 20 .

Rebooting is the same as restarting, and close enough to powering off and then turning off your device. The purpose is to close and reopen the operating system. Resetting, on the other hand, means taking the device back to the state in which it left the factory. Resetting wipes all your personal data.


The systemctl command accepts, among many other options, halt (halts disk activity but does not cut power) reboot (halts disk activity and sends a reset signal to the motherboard) and poweroff (halts disk acitivity, and then cut power). These commands are mostly equivalent to starting the target file of the same name.


To reboot Linux:

1. To reboot the Linux system from a terminal session, sign in or "su"/"sudo" to the "root" account.

2. Then type " sudo reboot " to reboot the box.

3. Wait for some time and the Linux server will reboot itself.


To shut down Linux Mint:

Execute the following command:

sudo chmod u+s /sbin/shutdown

You will be prompted for your root password. After that, you're done and can type "exit" to exit out of the Terminal.


Linux Commands to Shutdown and Reboot the System:

1. Linux shutdown / reboot command. On Linux, like all tasks, the shutdown and restart operations can also be done from the command line.

2. "shutdown" command.

3. "reboot" command.

4. "halt" command.

5. "poweroff" command.

6. REISUB - R E I S U B key strokes.


Install Chrony on Linux Mint - Easy steps to do it ?

This article covers how to #install Chrony on Linux Mint 20. Once it will be installed on your system, its daemon will silently work in the background to synchronize your system's clock with the #NTP server. 

However, if you do not want Chrony to perform this job any longer, then you can simply uninstall it as well.

Chrony is a flexible implementation of the Network Time Protocol (NTP). 

It is used to synchronize the system clock from different NTP servers, reference clocks or via manual input.


Chrony comes with two programs:

1. chronyc – command line interface for chrony

2. chronyd – daemon that can be started at boot time


How to Install #Chrony in #Linux :

On some systems, chrony may be installed by default. Still if the package is missing, you can easily install it. 


You can install chrony Using your default package manager tool on your respective Linux distributions using following command:

# yum -y install chrony    [On CentOS/RHEL]

# apt install chrony       [On Debian/Ubuntu]

# dnf -y install chrony    [On Fedora 22+]


To check the status of chronyd use the following command:

# systemctl status chronyd      [On SystemD]

# /etc/init.d/chronyd status    [On Init]


If you want to enable chrony daemon upon boot, you can use the following command:

# systemctl enable chronyd       [On SystemD]

# chkconfig --add chronyd        [On Init]


How to Check Chrony Synchronization in Linux ?

To check if chrony is actually synchronized, we will use it's command line program chronyc, which has the tracking option which will provide relevant information:

# chronyc tracking


To check information about chrony’s sources, you can issue the following command:

# chronyc sources


Different Methods to Find Your Private IP Address in Linux Mint 20 ?

This article covers different methods to quickly find the IP address of your #Linux Mint system. 

The simplest way to check the ip address of linux Mint, when using the bash shell is typing the command ifconfig. 

On typing the ifconfig you will not only be provided with the ip address, but also the mac address, subnet mask and other information. 


The following commands will get you the private IP address of your interfaces:

1. ifconfig -a.

2. ip addr (ip a).

3. hostname -I | awk '{print $1}'.

4. ip route get 1.2.

5. nmcli -p device show.


What is the #ipconfig command for Linux?

ifconfig(interface configuration) command is used to configure the kernel-resident network interfaces. It is used at the boot time to set up the interfaces as necessary. 

After that, it is usually used when needed during debugging or when you need system tuning.