Linux Commands – AtoZ Linux https://atozlinux.com Linux News, Tutorials, Freebies & Many More Tue, 04 Nov 2025 05:40:26 +0000 en-US hourly 1 https://wordpress.org/?v=6.9 Best Server Monitoring Tools For Linux System Administrator https://atozlinux.com/best-server-monitoring-tools-for-linux-system-administrator/ https://atozlinux.com/best-server-monitoring-tools-for-linux-system-administrator/#respond Sun, 28 Sep 2025 05:50:57 +0000 https://atozlinux.com/?p=81 Some of the best and useful server monitoring tools for the system administrators.

Best Server Monitoring Tools For Linux System Administrator

  1. Nagios Core: Nagios Core, is an open-source system tool to monitor servers, switches, services, and applications. You can monitor basic services such as HTTP, FTP, SSH, SMTP, etc., and attributes such as CPU load, logged-in users, memory, disk usage, running processes, etc.
  2. Cacti:  It is an open-source web-based network monitoring tool and system monitoring graphing solution in almost real-time. Cacti uses RRDtool.
  3. GoAccess: GoAccess is an open-source real-time web log analyzer and interactive viewer that runs through your browser or in a terminal in *nix systems.
  4. Zabbix: Zabbix is an enterprise-class open-source monitoring software tool. Zabbix can collect data from Network devices, Cloud services, containers, virtual machines, Databases, IoT sensors, and more.
  5. Shinken: Shinkein is a python based  Nagios compatible monitoring tool.
  6. SmokePing: SmokePing is a deluxe latency measurement tool that uses RRDtool to measure, store and display latency, latency distribution, and packet loss.
  7. Justniffer is a network protocol analyzer that captures network traffic and produces logs.
  8. CPUlimit: Developed by Angelo Marletta, It is a small tool that monitors and then limits the CPU usage of a process. . It is useful to control batch jobs when you don’t want them to eat too many CPU cycles.  cpulimit can be used to prevent a process from running for more than a specified time ratio.

Command-based tools for system administrators:

1. ps: Using ps command will help you to get a snapshot of the current processes. ps similar to the top command it provides you the more information.

sudo ps

top:  top is a processing activity monitoring command for Linux. It gives you a real-time view of a running system.

Run the following command in Linux to execute the top command:

sudo top

vmstat: The vmstat command lets you know about processes, memory, traps, paging, block IO, and CPU activity.

sudo vmstat

pmap: The pmap command in Linux displays the memory usage map of a process or multiple processes. Monitors the process memory usage on Linux. We need process id which we can get from ps or top command:

sudo pmap PID

netstat: netstat is a Linux network and statistics monitoring tool. It is a built-in tool that is used to list out the TCP network connections, routing tables and a number of network interfaces in the system.

sudo netstat

iptraf: iptraf command can be used to gather the real-time network statistics on the Linux system. You can easily figure out the TCP connection packet and byte count, TCP/UDP traffic breakdowns, interface statistics and activity indicators, and station packet and byte count with this command.

sudo iptraf

iostat: This command is used for monitoring system input and system output. It helps to monitor Linux’s average CPU load and disk activity.

sudo iostat

sar: SAR or System Activity Report is a Unix System V-derived system monitor command which is used to check CPU activity, memory/paging, network, interrupts, device load and swap space utilization.

mpstat: It is used to Monitor multiprocessor usage on Linux.

sudo mpstat

tcpdump: tcpdump is a common packet analyzer. tcpdump allows the user to display TCP/IP and other packets that are being transmitted or received over a network.

iotop: iotop is a Linux I/O monitoring tool. iotop tool is based on Python.

sudo iotop

htop: htop is similar to the top command. It is used to view the interactive process. It is a third-party application.

sudo htop

atop: atop is an interactive monitor tool to view the load on your Linux system, i.e. CPU, memory, disk, and network.

iftop: iftop is a real-time network monitoring tool. It can be used to monitor network bandwidth.

sudo iftop

nmon: nmon is short for Nigel’s performance Monitor for Linux on POWER. It displays and records local system information.

glances: glances is an open-source cross-platform monitoring tool for Linux based operating systems. It is written in python. glances can be used to monitor CPU, Network Interfaces, Load Average, Memory, Disk I/O, Processes and many more.

Nload : Nload is a command-line tool that is mainly used to monitors the network throughput.  The output of this tool can be seen in using two graphs, one for incoming and one for the outgoing network.

yum install nload

or

sudo apt-get install nload

Collectd: collectd is a daemon which collects system and application performance metrics periodically. This tool gathers metrics from various sources which can be used to monitor systems and find the possible bottlenecks.

]]>
https://atozlinux.com/best-server-monitoring-tools-for-linux-system-administrator/feed/ 0
How to Print Environment Variables in Linux https://atozlinux.com/how-to-print-environment-variables-in-linux/ https://atozlinux.com/how-to-print-environment-variables-in-linux/#respond Sun, 06 Jul 2025 08:53:57 +0000 https://atozlinux.com/?p=126539 How to Print Environment Variables in Linux

Think of environment variables in Linux like little notes or settings that the system and programs use to know how to behave. They’re like behind-the-scenes instructions.  For example: Wanna know where your home folder is? There’s a variable for that. Want to tell the system where to look for programs when you type commands? Yep, there’s a variable for that too. They’re kind of like settings in a video game — stuff you don’t always see, but it controls how things work.
Let’s say you type a command like python in your terminal. How does Linux know where to find Python?

It looks at the PATH environment variable — a list of folders where your system checks for programs to run. If Python isn’t in one of those folders, it’ll just say “command not found.”\
Open your terminal and type:

echo $HOME

That’ll show your home directory — that’s an environment variable called HOME. Try:

echo $USER

That’ll show your username. These variables start with a $ when you want to use them.
You can also create your own. Like this:

export MYNAME=”Musk”
echo $MYNAME

Now you’ve created your own environment variable! But it’ll only last while your terminal is open. Close it, and it’s gone. Want it to stick around every time you open a terminal? You can add that line to your ~/.bashrc or ~/.zshrc file.

How to Print Environment Variables in Linux

Before jumping into the main section, let’s have a look into the common environment variables in Linux.

Common environment variables in Linux

Environment Variable Description
HOME Shows home directory for the current user
HOSTNAME Contains Hostname of  system
UID Stores unique ID of the users
SHELL Shows the path to the shell that is being used currently
BASH_VERSION Contains version currently used bash instance in system
HISTFILE Path of the file where the history of commands is saved in your system
TERM Shows the type of log-in terminal you’re using in your current system
PATH Shows path of commands and directories are separated by columns

 

There are various ways through which you can print environment variables in Linux. Let’s break it down in a simple way! If you want to see the environment variables in Linux, there are a few different ways you can do it.

1. Using printenv Command

The printenv command is probably the easiest way to see environment variables. The printenv utility is used to print environment variables for the current shell.

To see all variables:

printenv

To see a specific variable:

printenv HOME

It will just print the value of that environment variable. So, if you run printenv HOME, it’ll show your home directory.

2. Using echo Command

You can use echo to print the value of any specific environment variable. You need to use the $ symbol before the variable name

Example:

echo $HOME

This will print your home directory. If you want to see other variables, like the current user:

echo $USER

3. Using env Command

The env command lists all the environment variables currently set in your session, similar to printenv.

To see all variables:

env

It’s just another way to check the environment variables that are available to your session in your Linux.

4. Using set Command

If you’re in a shell (like bash or zsh), the set command shows all the variables and functions that are available to the shell. This includes environment variables, but also local variables.

To see all variables (including environment and shell-specific ones):

set

This command gives you a lot of information, not just environment variables. It’s a bit more comprehensive but can get messy if you just want the environment variables.

5. Using declare Command

The declare command is used to declare and print the value of variables in the shell.

You can use declare without any argument and will bring the list of available variables.

declare
]]>
https://atozlinux.com/how-to-print-environment-variables-in-linux/feed/ 0
How To Clear Apt Cache In Ubuntu 24.04 LTS, Debian, And Linux Mint In 2025 https://atozlinux.com/how-to-clear-apt-cache/ https://atozlinux.com/how-to-clear-apt-cache/#respond Mon, 10 Mar 2025 00:24:11 +0000 https://itsubuntu.com/?p=124768 How To Clear Apt Cache In Ubuntu 24.04 LTS, Debian, And Linux Mint In 2025

We’ll walk you through the simple process of clearing the Apt Cache in Ubuntu, Debian, and Linux Mint in this guide. Which Linux distributions based on Debian employ the command-line package manager apt (Advanced Package Tool)?

It is used for Linux operating system software package management. Using a command-line interface, apt is used to install, update, upgrade, and delete programs from the system.

Generally, packages are stored in the Cache folder being installed on the system. Most of the packages are stored in the Cache directory which is located at ‘/var/cache/apt/archives’. Apt stored packages in the cache for future purpose as the some of the other apps or software might need to use it.

Many packets accumulate in the Cache as the system ages, taking up space. It is therefore preferable to practice emptying the store and Apt Cache.

How To Clear Apt Cache In Ubuntu 24.04 LTS, Debian, And Linux Mint

Ubuntu, Debian, and Linux Mint have several methods for clearing the Apt Cache.

1. Using Apt Autoclean Command

Run the following command to remove the packages from Cache.

sudo apt autoclean

2. Using Apt Clean Command

Run the following command to delete the apt-cache.

sudo apt clean

Pro Tips: If you run ‘apt clean‘ with a parameter called ‘–dry-run‘, then it will show you the directories from which packages will be deleted that will easy and convenient for you to monitor the process.

 sudo apt clean --dry-run
]]>
https://atozlinux.com/how-to-clear-apt-cache/feed/ 0
Essential DNF Commands for Linux With Examples https://atozlinux.com/essential-dnf-commands-for-linux-with-examples/ https://atozlinux.com/essential-dnf-commands-for-linux-with-examples/#respond Thu, 05 Dec 2024 02:05:27 +0000 https://itsubuntu.com/?p=123835 Essential DNF Commands for Linux With Examples

Linux operating systems like RedHat Linux use DNF or Dandified Yum as a package manager. It is used in RPM-based Linux systems and it is a successor of the Yum package manager. Today, we will show you some of the useful and essential DNF commands with examples.

Essential DNF Commands for Linux With Examples

Linux DNF commands with examples:

1. How to Install packages using DNF in Linux

Run the following command to install packages in RPM-based Linux using the DNF command:

dnf <install package_name>

Run the following command to install multiple packages from the repositories

dnf install  package_name 1 package_name_2

Run the following command to install a package for a specific architecture, such as i686 or x86_64

dnf install <package_name>.<architecture> 

Run the following command to install a package if you only know the path to the file it provides

dnf install <path_to_file>

Run the following command to install a local RPM file

dnf install <path_to_RPM_file>

2. How to Check updates using the DNF command

Run the following command to check for updates for all installed packages in your system.

dnf check-update

3. How to list out all updates using the DNF command

To list out all the updates in your Linux system, run the following DNF command.

dnf list updates

4. How to install updates using the DNF command

Run the following command to install updates for your RPM-based Linux system.

dnf update

5. How to check the DNF versions of your Linux

The following command shows the DNF version included in your Linux.

dnf --version

6. How to list out the installed packages in Linux

The following DNF command gives you the list of installed and available packages.

dnf list

7. How to list out the available packages in Linux

dnf list available

6. How to list out the installed packages in Linux

Run the following command to show the list of installed packages in Linux.

dnf list installed

7. How to see the repository list using the DNF command.

dnf repolist

8. How to display the specific information using the DNF command.

Run the following command to display specific information about a package using the DNF command.

dnf info package_name

9. How to search for any package using the DNF command

Run the following command to search for any package using the DNF command.

dnf search package_name

10. How to Install a downloaded package that you downloaded manually

dnf localinstall yourpackagename.rpm

11. How to downgrade a package using the DNF command

Run the following command to downgrade a package using the DNF command.

dnf downgrade packagename

12. How to uninstall any application or package using DNF

Run the following command to remove or uninstall any application.

dnf remove applicationname

13. How To Clean up  Linux using DNF

Run the following command to remove  all the temporary files for enabled repos in your system.

dnf clean all
Removes all the repo metadata.
dnf clean metadata

Run the following command to remove any cached packages.

dnf clean packages

Run the following command to remove cache files for repo metadata.

dnf clean dbcache

Run the following command to remove the local cookie files containing the packages’ download time signature.

dnf clean expire-cache
]]>
https://atozlinux.com/essential-dnf-commands-for-linux-with-examples/feed/ 0
How To Use ChatGPT In Linux From Terminal https://atozlinux.com/how-to-use-chatgpt-in-linux/ https://atozlinux.com/how-to-use-chatgpt-in-linux/#respond Tue, 03 Oct 2023 08:08:54 +0000 https://atozlinux.com/?p=125850 How To Use ChatGPT In Linux Terminal

ChatGPT is everywhere these days. Thanks to some of the amazing technology out there for creating AI tool like ChatGPT that has made our life somehow easy. If you are a Linux users and wants to use ChatGPT from your Linux terminal than you are at the right blog post.

In this blog post, we will help you to set up and use ChatGPT in Linux based operating systems.

How To Use ChatGPT In Linux From Terminal

In order to use ChatGPT in Linux, we need to install a tool called ShellGPT in Linux to. As there is not any official ChatGPT tool for Linux,  ShellGPT will be handy.

Before installing ShellGPT in Linux, you need to have python installed in your Linux. Python comes preinstalled on most latest Linux based operating system.

Run the following command to know whether Python is installed or not.

python3 --version

If you see any errors, then the python is not installed or there is the old version of Python. Run the following command to install Python:

For Ubuntu:

sudo apt update && sudo apt upgrade -y
sudo apt install python3

If an older version of Python is installed, run the following command to update Python to the latest version.

sudo apt --only-upgrade install python3

How to Install Pip Package Manager in Linux

It generally comes preinstalled with Python in most Linux distributions. Just in case if there is not Pip installed then run the following command.

sudo apt-get -y install python3-pip

How to Install ShellGPT on Linux

At first, you need to create a directory.

mkdir <newdirectoryname>

After creating a directory, switch over to the new directory

cd <newdirectoryname>

Now, Create a new virtual environment. First, install the venv model.

sudo apt install python3-venv
python3 -m venv  

Run the following command to activate the virtual environment that you have created above:

source /bin/activate

Get Your OpenAI API Key

  • Browse OpenAI’s website and create a new OpenAI account or If you already have an account, simply log in.
  • Click on your profile image at the top right corner and select “View API keys” from the drop-down menu.
  • Click the “Create new secret key” button to generate a new API key. Do not share this API key with anyone or share it publicly.

Now, create an environment variable for this API key with the command below.

export OPENAI_API_KEY=<your_OpenAI_API_key_here_API key you generated to use ChatGPT>

Now, run the following env command to verify the environment variable:

env

Open the .bashrc file in the text editor and add the variable at the end of the file to store the API key permanently.

export OPENAI_API_KEY=<your_OpenAI_API_key_here_API key you generated to use ChatGPT>

Save the file and exit the text editor.

Now run the following  command to install ShellGPT:

pip3 install shell-gpt --user

How to Use ChatGPT in Linux with Examples

Run the following command to get the information using ChatGPT in Linux.  For example, if you need to know the run scored by sachin, use this command:

sgpt " run scored by sachin"
]]>
https://atozlinux.com/how-to-use-chatgpt-in-linux/feed/ 0