×


Category: Linux Tutorials


What is CHOWN Command in Linux ?

This article covers the basic usage of the CHOWN command in Linux.In fact, you can now change the ownership of a file in system at the user level as well as at the group level. Also, with the chmod command command , you can change file access permissions such as read, write, and access.


Check Ports in Use on Ubuntu 22.04 (Jammy Jellyfish)

This article covers the methods of finding out the ports that are in use in your Ubuntu Linux machine. In fact, if you are intending to close any unused port, you will easily be able to do that after knowing that it is still in the listening state.


How to check the listening ports and applications on Linux ?

1. Open a terminal application i.e. shell prompt. Run any one of the following command on Linux to see open ports:

$ sudo lsof -i -P -n | grep LISTEN
$ sudo netstat -tulpn | grep LISTEN
$ sudo ss -tulpn | grep LISTEN
$ sudo lsof -i:22 ## see a specific port such as 22 ##
$ sudo nmap -sTU -O IP-address-Here

2. For the latest version of Linux use the ss command. For example:

$ ss -tulw


AWK Features Explained with Examples

This article covers the usage of the AWK command in Linux.  In fact, AWK can use to manipulate text in documents or perform specific functions.


What Operations can AWK do ?

  • Scanning files line by line.
  • Splitting each input line into fields.
  • Comparing input lines and fields to patterns.
  • Performing specified actions on matching lines.


AWK Command Usefulness includes:

  • Changing data files.
  • Producing formatted reports.


What is AWK Syntax ?

It is given below:

$ awk options 'selection _criteria {action }' input-file > output-file


Bash "If String Equals" Comparison - Complete guide ?

This article covers the equality comparison operator for the strings in Bash. In fact, you will be able to realize that the strings can be compared in Bash very easily irrespective of their length.

Two strings are equal when they have the same length and contain the same sequence of characters.


6 Best Text Editors for Linux

This article covers the best text editor for Linux. In fact, some Linux editors add extra features or an easy-to-use interface.


The Types of Text Editor in Linux are:

  • Command-line text editors: A good example is Vim, which gives you the option of jumping into the editor from the command line. System admins will find this very useful when editing configuration files.
  • Graphical user interface (GUI) text editors: This type of text editor features a GUI but cannot be used from the command line.


DMIDECODE Command in Linux - How to use it ?

This article covers the usage of the DMIDECODE command in Linux. In fact, the "dmidecode" command in Linux is used for extracting all the hardware-related information of your system. 

Dmidecode stands for DMI (Desktop Management Interface) table decoder, as the name suggests it reads the data from DMI table and represents to us in human readable format. DMI table holds the system hardware details like BIOS, Serial Number, RAM(DIMMs) and CPU details etc, apart from this dmidecode can also retrieve details about the maximum system supported configuration (like DIMMs & Processors etc).


Compare Numbers in a Bash Script - How to do it ?

This article covers the methods of comparing two numbers in Bash. 


Comparison Operators for Numbers:

  • num1 -eq num2: check if 1st  number is equal to 2nd number.
  • num1 -ge num2: checks if 1st  number  is greater than or equal to 2nd number.
  • num1 -gt num2: checks if 1st  number is greater than 2nd number.
  • num1 -le num2: checks if 1st number is less than or equal to 2nd number.
  • num1 -lt num2: checks if 1st  number  is less than 2nd number.
  • num1 -ne num2: checks if 1st  number  is not equal to 2nd number.


Linux LSOF Command - Explained with Examples

This article covers the usage of the LSOF command in Linux. In fact, With lsof, you can find different processes locking up a file or directory, a process listening on a port, a user's process list, what all files a process is locking.


How to install lsof in Linux ?

lsof isn't available by default on most Linux distributions but can be easily installed. So Use the below command to install lsof:

1. For CentOS / RHEL / Fedora, run the below command:

$ sudo yum install lsof

2. For CentOS/RHEL 8, you can use the DNF command:

$ sudo dnf install lsof

3. For Ubuntu / Debian, run the below command:

$ sudo apt install lsof


How to get lsof supported options ? 

You can get a summarized list of lsof supported options using -? or -h flag:

$ lsof -?


LVEXTEND Command in Linux - Explained with Examples ?

This article covers how to extend LVM partition on the fly using lvextend command. In fact, LVM(Logical Volume Manager) provides the facility to increase and reduce the file system size. 


PASSWD Command in Linux - Explained with Examples

This article covers an overview of how to use the PASSWD command in Linux. In fact, The passwd command modifies passwords for user accounts and manages the password validity period.


What is the general command for passwd ?

passwd general command is:

$ passwd <options> <username>

The terminal prints out what user you are changing the password for. Type your current password, and then define and confirm your new password.


Rsync Command Options - Explained with Examples

This article covers a few options of the RSYNC command along with a few examples that elaborated on the usage of this command. In fact, with rsync, you will be able to use this tool very efficiently for transferring data from one location to another.


What is the Rsync Command Syntax ?

The syntax for the rsync command changes depending on the usage of the tool. We will cover all the scenarios in the following examples. Rsync syntax in its most basic form looks like this:

$ rsync options SOURCE DESTINATION


Remote data transfers require you to specify a host's address, but more on that later.


What are Rsync Command Options ?

The rsync tool comes with many options. You can enter rsync in your terminal and get all the details. We will list some of the most common rsync options:

  • -r Allows to sync data recursively but does not keep ownership for users and groups, permissions, timestamps, or symbolic links.
  • -a The archive mode behaves like the recursive mode but keeps all file permissions, symbolic links, file ownership, etc.
  • -z Used to compress data during transfers to save space.
  • -b Performs a backup during data synchronization.
  • -h Shows the numbers in the output in a human-readable format.
  • -n Does a dry run. Used for testing before the actual synchronization takes place.
  • -e Instructs the rsync to use the SSH protocol for remote transfers.
  • -progress Displays the transfer progress during synchronization.
  • -v Verbose output. Displays the details of the transfer.
  • -q Used to suppress the output for the rsync command and options.


Execute Remote Command with SSH

This article covers the process of running a remote command with SSH on a Linux system along with actually running a command remotely. In fact, you will be able to run any command on a remote system of your choice provided that you know the correct username of that system as well as its password with which you will be able to access it remotely.


Linux sed Command Options - Explained with examples ?

This article covers the concept of the SED command in Linux along with a few useful examples to elaborate on its usage. In fact, SED is a text stream editor used on Unix systems to edit files quickly and efficiently. The tool searches through, replaces, adds, and deletes lines in a text file without opening the file in a text editor.


What is the Linux sed Syntax ?

The main syntax for using the Linux sed command is:

$ sed OPTIONS... [SCRIPT] [INPUTFILE...]


What is sed Linux Options ?

You can execute sed with the following command-line options:

  • -b, --binary Open input files in binary mode to consider lines to end at a line feed.
  • --debug Switch to debug mode to print input in canonical form and annotate program execution.
  • --follow-symlinks Edit the ultimate destination if the specified file is a symbolic link. It only works when combined with the -i option.
  • --help Display the usage information.
  • --i, --in-place [=SUFFIX] Perform edits in-place by overwriting the original file.
  • --posix Disable all extensions to POSIX sed to simplify writing portable scripts.
  • --version Display the version of sed running on the system.
  • -E, -r, --regexp-extended Use extended regular expressions.
  • -e <em>script</em>, --expression=<em>script</em> Add a specified script to run with the commands.
  • -f <em>script-file</em> Add the contents of a specified script-file to run with the commands.
  • -l <em>N</em>, --line-length=<em>N</em> Define the desired line-wrap length for the l command (default value is 70).
  • -n, --quiet, --silent Disable output printing.
  • -s, --separate View specified files as separate, not as a single continuous long stream.
  • --sandbox Disable running external programs and operate only on input files on the command line.
  • -u, --unbuffered Minimalize input and output buffer.
  • -z, --null-data, --zero-terminated View input as a set of lines where each ends with a zero byte.


TAR Command Options in Linux - Explained with Examples

This article covers the usage of the TAR command in Linux. In fact, the GNU tar (short for Tape ARchiver) command is the most widely used archiving utility in Linux systems. Available directly in the terminal, the tar command helps create, extract, and list archive contents.


How to tar a file in Linux using command line ?

  • Open the terminal app in Linux.
  • Compress an entire directory by running tar -zcvf file.tar.gz /path/to/dir/ command in Linux.
  • To compress a single file by running tar -zcvf file.tar.gz /path/to/filename command on Linux.
  • Tar and compress multiple directories file by running tar -zcvf file.tar.gz dir1 dir2 dir3 command in Linux.


ulimit Linux Command - Explained with Examples

This article covers an overview of the ULIMIT command in Linux. In fact, ULIMIT command is used for viewing or limiting the resources available to the Linux users. 


Linux Whereis Command examples

This article covers the whereis command which is useful for Locating the binaries and manual pages for various commands. Sometimes, while working on the command line, we just need to quickly find out the location of the binary file for a command.  


Linux whereis command syntax

The whereis command lets users locate binary, source, and manual page files for a command. Following is its syntax:

$ whereis [options] [-BMS directory... -f] name...


Install s3cmd in Linux and Manage Amazon s3 Buckets

This article covers an overview of the s3cmd command-line tool and how you can use it to manage your Amazon S3 storage feature. S3cmd is an Open Source tool that is free for both commercial and private use, but you need to pay only for Amazon resources. so most of the users are using this tool for managing AWS S3 Buckets. S3cmd is a free command-line tool written in Python


How to use the s3cmd command line to manage the Amazon s3 bucket in Linux ?

To use s3cmd command to list s3 bucket, run the command:

# s3cmd ls

This command will list s3bucket from Amazon S3, If you are unable to get the list of the bucket then there will be the following reasons:

  • There is no bucket created in Amazon s3.
  • As you have used IAM user Access Key and Secret Key while configuring the s3cmd tool, please verify IAM user has required permission to access the s3 bucket.
  • If you are using an IAM role then check whether the s3 bucket policy is attached to the EC2 instance or not.


List Users in Linux - Best method

This article covers how to list users in Linux system and also differentiate difference between normal user and system user. Linux OS is unique because of its multi-user characteristic allowing multiple users on one system, at the same time. However, tracking all users is essential. The /etc/passwd file contains one line for each Linux user account, with seven fields delimited by colons. This is a text file. You can easily list users under Linux using the cat command or other commands such as grep command / egrep command and more. With this same approach, you can use the Linux commands to list all users on all Linux operating system, including Ubuntu, Debian, RHEL, Arch, Fedora, CentOS, and other distros.


To list all users on Linux, use the cat command as follows:

$ cat /etc/passwd


Most Useful Nginx Commands in Linux System

This article covers most used Nginx commands. You can learn more about Nginx command line at Nginx documentation.

Nginx is one of the most popular web servers in the world. So whether you're currently using it or not, chances are, if you're a web developer chances are you'll likely come in contact with it at some point. 

Also, Nginx is well known for its simple configuration, and low resource consumption due to its high performance, it is being used to power several high-traffic sites on the web, such as GitHub, SoundCloud, Dropbox, Netflix, WordPress and many others.


To start the Nginx service, run the following command. Note that this process may fail if the configuration syntax is not OK:

$ sudo systemctl start nginx #systemd

OR

$ sudo service nginx start   #sysvinit


To enable Nginx auto-start at boot time, run the following command:

$ sudo systemctl enable nginx #systemd

OR

$ sudo service nginx enable   #sysv init


How to Show Nginx Command Help ?

To get an easy reference guide of all Nginx commands and options, use following command.

$ systemctl -h nginx


Important Cat Command Examples in Linux

This article covers how to use the Linux cat command. Cat(concatenate) command is very frequently used in Linux. It reads data from the file and gives their content as output. It helps us to create, view, concatenate files.

If you want to add a bit of new text to an existing text file, you use the cat command to do it directly from the command line (instead of opening it in a text editor).

Type the cat command followed by the double output redirection symbol ( >> ) and the name of the file you want to add text to.


Use the Dig Command in Linux - Doing it right ?

This article covers how to query various DNS records. The dig command in Linux is used to gather DNS information. It stands for Domain Information Groper, and it collects data about Domain Name Servers. The dig command is helpful for diagnosing DNS problems, but is also used to display DNS information.

By default, dig sends the DNS query to name servers listed in the resolver(/etc/resolv.conf) unless it is asked to query a specific name server.


How to Install Dig on Linux ?

1. On Debian and Ubuntu, run:

$ apt-get install dnsutils

2. On CentOS 7, run the command:

$ yum install bind-utils

3. Once installed, check the version, to make sure the setup was completed successfully:

$ dig -v


Dig Syntax

In its simplest form, the syntax of the dig utility will look like this:

dig [server] [name] [type]


i. [server] – the IP address or hostname of the name server to query.

If the server argument is the hostname then dig will resolve the hostname before proceeding with querying the name server.

It is optional and if you don't provide a server argument then dig uses the name server listed in /etc/resolv.conf.

ii. [name] – the name of the resource record that is to be looked up.

iii. [type] – the type of query requested by dig. For example, it can be an A record, MX record, SOA record or any other types.

By default dig performs a lookup for an A record if no type argument is specified.


Steps to save a file in Linux command line

This article will guide you on how to use the #cat #command to display or create a new file on #Linux. To save a file, you must first be in Command mode. Press Esc to enter Command mode, and then type :wq to write and quit the file. The other, quicker option is to use the keyboard shortcut ZZ to write and quit.


Extend file system after resizing disk volume in Linux

This article will guide you on the different #command line options to extend #disk space storage in #Linux thereby allowing you to add #storage capacity to your #VM. If your filesystem has the resize capability, that capability is what you use. 1. Check if disk is available: #dmesg | grep sdb. 2. Check if disk is mounted: df -h | grep sdb. 3. Ensure there are no other partitions on disk: fdisk -l /dev/sdb. 4. Verify the #disk: fsck /dev/sdb. 5. Resize the #filesystem: resize2fs /dev/sdb.


Install and Configure VNC on Ubuntu 20.04 - Steps to do it.

This article will guide you on the steps to set up a secured VNC server up and running on your Ubuntu 20.04 server. This will help you to manage your files, software, and settings with a user-friendly graphical interface, and you will be able to run graphical software like web browsers remotely.


How to use and run bash aliases over ssh based session

This article will guide you on how to run commands and bash shell aliases on a remote machine using the ssh command.


Process to Find And Remove Files on Linux

This article will guide you on using find command to find and remove files on your Server.


Process to save terminal output to a file under Linux

This extract will guide you on how to save terminal output to a file when using Linux or Unix-like operating system with modern shell such as Bash or KSH including POSIX syntax.


How to delete files in Linux?

This article will guide you on how to delete files on Linux operating systems.


How to find Processes Listening to a port on Linux

This article will show you different Linux commands to find information about running process and their ports.


Different methods of creating a symbolic links on your Linux Server

In this article, you will learn how to create a symbolic link in Linux using the ln command by passing the -s option.


How to Check if your Linux Memory usage is running out

It is vital for you to check if your Linux memory is running low to help your server to stay optimized.

Search by typing a one letter Word Term Here