How-to articles, tricks, and solutions about Linux

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

Install ZSH on Ubuntu 22.04 (Jammy Jellyfish) - Step by step guide ?

This article covers the complete process of installing the Z shell on your Ubuntu Linux System. In fact, Zsh is a shell, or command-line interpreter, for Linux systems. 

How to use Ansible Loops ?

This article covers Ansible Loops and examples of using Loops in Ansible. In fact, to avoid repeating the task several times in your playbook file, it's better to use loops instead. A loop allows you to repeat instructions, typically until a certain condition is met. Ansible offers different looping methods, with the loop keyword being the most recommended option for longer term compatibility.

Ansible 'When' Conditionals - More about it ?

This article covers how to use the "when" clause in Ansible. In fact, In Ansible, you can define conditions that will be evaluated before a task is executed. When a condition is not met, the task is then skipped. This is done with the when keyword, which accepts expressions that are typically based on a variable or a fact.

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.