Writing Single-line, Inline, and Multi-line Comments in Linux Shell Script

Like other programming languages, bash provides you with the option to ignore a single line, inline, or a block of lines from execution. The comments always received the least attention due to their simplicity but played a very important role while being used in a

What is Exit Status Code ($?) of Last Command in Linux

The “$?” is a built-in variable that your shell uses to store the exit status code of the last executed command in integer format and remains unchanged unless the next command is executed. Using this exit status code, you can debug the problem that occurred

Beginners Guide for Unset Command in Linux

The unset command is a built-in Linux command used for flushing the value of variables or functions during program execution. Tutorial Details Description Unset Difficulty Level Low Root or Sudo Privileges No Host System and Architecture Ubuntu 22.10 (x64) OS Compatibility Ubuntu, Manjaro, Fedora, etc.

Beginners Guide for Set Command in Linux

The set command is a built-in Linux command that can display or modify the value of shell attributes and positional parameters inside the current shell environment. This modification can help to debug your script by finding undefined variables, errors, job control, printing commands as they

Beginners Guide for Export Command in Linux

Whenever you start a new shell session (by opening a terminal), a set of environment variables is loaded from the shell configuration file into your current shell session. These environment variables determine different customizations in your shell, like the default editor using “$EDITOR“, or setting

Beginners Guide for PS Command in Linux

The PS, a.k.a. “process status”, is a native command-line utility for UNIX-based systems to monitor the currently running processes in your system. It reads the information from the virtual files in the /proc filesystem and gives the running processes information like memory consumption, CPU usage,

How to Run a (.sh) Shell Script in Linux [for Beginners]

There are three ways to run a shell script on a Linux system: I am going to use the following “script.sh” file to show you the examples. Method 1: Specifying the Script Filename as an Argument to the Bash Command 😮 Shell is just a

Beginners Guide for Bash Command in Linux

The bash (Bourne-Again SHell) is a sh-compatible command-line interpreter that reads from standard input or from a file and gives you the resulting output. We have already written an article about bash and its differences from the standard POSIX shell. Today, you will learn how

What is Bash Shell in Linux?

Before understanding what is Bash shell, you must be familiar with the concepts of a command-line interpreter and Linux Shell (or sh). What is a Command-Line Interpreter? The term “command-line interpreter” refers to a program or text-based interface that sits between the user and the

Absolute vs Relative Path in UNIX/Linux

In Linux, you might already be navigating through different directories without knowing whether an absolute or relative path is being used. It becomes important for you to understand them when you are working with scripts, navigating through different user or root directories, or creating symbolic

How to Count String Occurrences in a Text File

The GUI text editor gives you a separate panel in the footer to inform you of the number of words, lines, and characters in your text file. Even though you can easily find the number of strings that occurred in your text file using this

Beginners Guide for WC Command in Linux

The WC command is used to count various parameters from the specified file, like the number of lines, word counts, byte counts, character counts, and many more. Tutorial Details Description WC (Word Count) Difficulty Level Low Root or Sudo Privileges No Host System and Architecture