Fixing Mount Point Does Not Exist Error in Linux

Fixing Mount Point Does Not Exist Error in Linux

While trying to mount your device, you may encounter an error saying “mount point does not exist”:

Fixing Mount Point Does Not Exist Error in Linux

And if you’re curious about the reason why it happened, it is all because of the mount point whether you want to mount the drive does not exist!

So the solution is to create a mounting point and mount the drive again.

And that’s what I’m going to walk you through in this tutorial.

How to solve Mount point does not exist error in Linux

The first step is to verify whether the mounting point exists or not.

To do so, you can use the mount command combined with the grep command to filter the mounting point from the huge list:

mount | grep -w 'Name-of-mounting-point'

As I’m looking for a mounting point named drive, I will be using the following:

mount | grep -w 'drive'
Fixing Mount Point Does Not Exist Error in Linux

And if you get empty output, the mounting point does not exist on your system which means you will have to make one manually!

So let’s create a mounting point.

To create a mounting point, all you have to do is execute the following command syntax:

sudo mkdir /mnt/mount_point 

Make sure to change the name of your desired mounting point with mount_point in the above command.

As I wanted to create a mounting point named drive, I will be using the following:

sudo mkdir /mnt/drive

Once you are done creating the mounting point, now, you can mount the drive without any issues:

Fixing Mount Point Does Not Exist Error in Linux

And if you want to verify whether the drive was mounted successfully or not by listing the mounted drives in Linux.

But here, I will be using the grep command to have appropriate output only:

mount -l | grep '/path/to/drive'
Fixing Mount Point Does Not Exist Error in Linux

And as you can see, the drive is mounted as expected!

But there is a better way to find mounted drives!

While most Linux users won’t require to check mounted drives frequently, if you are dealing with numerous amount of drives at once, there is a better alternative to check mounted drives.

You can use the findmnt utility which displays output way better than the usual mount command but also has tonnes of other features.

And the good news is we have a detailed guide for that purpose:

Findmnt – Better Way of Finding Mounted Filesystems on Linux
Learn to use findmnt instead of mount for a more robust and customizable listing of mounted file systems.
Fixing Mount Point Does Not Exist Error in Linux

I hope using this guide, you won’t face the same error anymore.

And if you have any queries or suggestions, feel free to ask me in the comments.

Fixing ‘Umount Target is Busy’ Error in Linux

Fixing 'Umount Target is Busy' Error in Linux

Unmounting disks in the Linux command line is not complicated. All you have to do is to use the umount command:

umount target

But once in a while, you’ll come across an error that says ‘umount: target is busy’:

Fixing 'Umount Target is Busy' Error in Linux

So how are you supposed to solve this issue?

Well, before solving this issue, let me share the reason behind this problem first.

The reason behind Umount target is busy

The reason is quite simple! The target device is still in use.

With enough permissions, any process might be utilizing that drive that you want to unmount, and to prevent data loss, the kernel won’t allow you to unmount.

How to solve Umount target is busy in Linux

⚠️
If an ongoing data transfer occurs in the background, you may lose your data by forcefully unmounting your drive.

There are times when you want to unmount the drive at any cost. Perhaps the drive isn’t responding for some reason and you want to unmount it.

In this tutorial, I will share three ways to unmount the target:

  • By killing the process itself
  • Using force unmount
  • Using the lazy unmount

Let’s start with the first method.

This is the best way of unmounting the target in my opinion as you are eventually killing the process itself.

The first step is to find the PID of the process that causes the problems.

To do so, I will be using the lsof command in the following manner:

sudo lsof /Path/to/target
Fixing 'Umount Target is Busy' Error in Linux

Once you get the PID, it’s quite simple to force kill the process:

sudo kill -9 [PID]

And now, you should be able to unmount the drive easily:

Fixing 'Umount Target is Busy' Error in Linux

Pretty neat way. Isn’t it?

Method 2: Using force unmount (for Network File Systems)

The force unmount option is mainly preferred by those who are dealing with network file systems.

So it may NOT give you the expected results with your local file system.

To use the force unmount, you will have to use the same old umount command but with the -f flag:

sudo umount -f /Path/to/target
Fixing 'Umount Target is Busy' Error in Linux

Method 3: Using the lazy unmount (Schrödinger’s unmount)

📄
This option does not actually unmount your target but just removes the target from the namespace. And will unmount the target when the drive is not being utilized anymore!

It is more of a Schrödinger’s mount when you can never be sure of whether the filesystem is unmounted or not!

So why am I even adding this to the solution’s list? Well, this is the least harmful way of unmounting your stubborn drive.

To use the lazy unmount, you will have to use the -l flag with the umount command as shown:

sudo umount -l /Path/to/target
Fixing 'Umount Target is Busy' Error in Linux

And here you have it!

Which one should you choose?

In times like you have to have your drive unmounted, I would prefer going with the 1st method which involves killing the process itself.

And there is a strong reason why. It gets my job done without any hiccups.

Sure, you may want to go with either of the last two options based on your use case.

How To Set up And Use ChatGPT In Linux Terminal

Last Updated on March 22, 2023 by itsubuntu

How To Set up And Use ChatGPT In Linux Terminal

ChatGPT is creating a storm on the Internet. Almost everyone is talking about it and also using it. Everyone wants to eat the pie of its popularity by using it or integrating it. Meanwhile, in this article, we will discuss the method of using ChatGPT in Linux and that one in Linux terminal.

How To Set up And Use ChatGPT In Linux Terminal

We will take the help of ShellGPT in Linux to use ChatGPT. ShellGPT is developed by Farkhod Sadykov, Eric, and Loïc Coyle. Before installing ShellGPT in Linux, you need to have python installed. Python comes preinstalled on most latest Linux distros. So run the following command to the python version installed on your Linux.

python3 --version

If you see any errors, then the python is not installed or the deprecated python2.7 is installed on your system. If an older version of Python is installed, run the below command to update Python to the latest version.

sudo apt --only-upgrade install python3

If there is no python installed in your system, then run the following command to install Python:

For Ubuntu:

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

Install Pip Package Manager:

It generally comes preinstalled with Python in most Linux distributions, but if it is not installed, you can install it with this command:

sudo apt-get -y install python3-pip

Now, let’s begin the process of installing ShellGPT on Linux.

Run the following command to create a directory.

mkdir <new_directory_name>

Switch over to the new directory you just created with the following command:

cd <new_directory_name>

Now, run the following command to create a new virtual environment. First, install the venv model.

sudo apt install python3-venv
 python3 -m venv  

The virtual environment you just created will be deactivated by default. Run the following command to activate the environment:

source /bin/activate

Get Your OpenAI API Key

We need to have OpenAI API key to use ChatGPT’s services in Linux. For this:

1. Navigate to OpenAI’s website and create a new OpenAI account. If you already have an account, simply log in and move to the next step.

2. Next, click on your profile image at the top right corner and select “View API keys” from the drop-down menu.  Here, you will see all the previously generated API Keys if any.

3. To generate a new API key, click the “Create new secret key” button. 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>

Verify the environment variable by listing it with the env command:

env

To store the API key permanently, open the .bashrc file in the text editor and add the variable at the end of the file.

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

Save the file and exit the text editor after you have added the OpenAI API key.

Install ShellGPT to Use ChatGPT on Linux

Now run the following  command to install ShellGPT on your PC:

pip3 install shell-gpt --user

How to Use ChatGPT in Linux with Examples

Run the following command to get the result.

For example, if you need to know the goal record of the messi, use this command:

sgpt " goal record of the messi"

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

Last Updated on March 22, 2023 by itsubuntu

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

In this tutorial, we will show you the easy way to clear Apt Cache in Ubuntu, Debian, and Linux Mint. apt (Advanced Package Tool) is a command-line package manager used in Debian-based Linux distributions?  It is used to manage software packages on a Linux operating system. apt is used to install, update, upgrade, and remove packages from the system with a simple command-line interface.

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 usage as the other software might need to use it.

But as the system gets older, a lot of packages get stored in the Cache occupying the space. So, it’s better to practice clearing Apt Cache and clearing the storage.

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

There are multiple ways to clear Apt Cache in Ubuntu, Debian, and Linux Mint-based operating systems.

Apt Autoclean Command

Run the following command to remove the packages from Cache.

sudo apt autoclean

Apt Clean Command

Run the following command to delete the apt-cache.

sudo apt clean

 

If you run ‘apt clean‘ with a parameter called ‘–dry-run‘, then it will show you the directories from which packages will be deleted, and will not actually delete the packages.

 sudo apt clean --dry-run

5 Ways To Count The Number Of Lines In A File In Linux

Last Updated on March 20, 2023 by itsubuntu

How To Count The Number Of Lines In A File In Linux

There are several ways to count the number of lines in a file in Linux based operating system. There are several commands in Linux for different tasks. Every command is assigned a specific function in Linux.

5 Ways To Count The Number Of Lines In A File In Linux

1. Count the Number Of Lines Using Awk Command

You can also count the number of lines in a file using the awk command. Run the following awk command to count the number of lines in a file in Linux based operating system.

awk 'END{print NR}' filename

In the above command, NR is an awk built-in variable that represents the total number of input records (lines) processed so far.

2. Count the Number Of Lines Using Grep Command In Linux

grep is a command-line utility in Linux used to search for patterns in file. You can get the total number of lines in a file using '-e' or '--regexp' and '-c' or '--count' options.

Run the following command to count the number of lines in the file “sample.txt” using the grep command:

grep -c '^' samplefile.txt

3. Count Number Of Lines Using wc Command

wc is a command-line utility in Linux that is used to count the number of words, lines, and bytes in a file. Run the following command to count the number of lines using wc command in Linux.

wc -l filename

You can also count the number of lines in more than one file using a single command.

wc --lines filename.txt filename1.txt filename2.txt

4. Count Number Of Lines Using Sed Command In Linux

Despite being text editor, it can also be used to count the number of lines in a file. Run the following command to count the number of lines in a file using the sed command in Linux.

sed -n '$=' filename

 

5. Count the Number Of Lines Using nl and cat Commands

Run the following command to print the file content and get the total number of lines at the last line number.

nl filename.txt

Run the following cat command with '-n' to print file content with line numbers.

$ cat -n filename.txt | tail -n1

Fix “Updating from such a repository can’t be done securely” Error In Linux

Last Updated on March 18, 2023 by itsubuntu

How to fix the “Updating from such a repository can’t be done securely” error in Linux

You might have encountered this error while trying to run the apt update or the apt upgrade command.

N: Updating from such a repository can't be done securely, and is therefore disabled by default.

Along with the above error message, you will also come across the following error:

W: Failed to fetch http://in.archive.ubuntu.com/ubuntu/dists/precise/Release.gpg

How To Fix “Updating from such a repository can’t be done securely” Error In Linux

Method 1:

Adding an unsigned repository with a flag in Linuz

If you are using an unsigned repository, you might be getting this error as Linux flags unsigned repositories as insecure. Go through the following steps to add an option to it in your sources.list file.

Open the sources.list file using a text editor:

sudo vi/etc/apt/sources.list

Add the following option to the source you are using:
[trusted=yes]

Save and exit using the ESC key then :wq!

Run a sudo apt-get update command and see if the problem is resolved.

Method 1:

Bypass the safeguard in Linux

You can bypass the authentication safety measures and allow the package to be installed without getting any errors.

--allow-unauthenticated

Method 3:

Disable the repositories that are causing trouble in Linu

Go through the following steps:

Open the software updater

Under the Other Software tab, find the concerned repositories and uncheck them

Close the software updater and run the following command:
sudo apt update

3 Ways To Fix “No Space Left on Device” Error In Linux

Last Updated on March 18, 2023 by itsubuntu

Fix “No Space Left on Device” Error In Linux

Are you going through an error like “No Space Left On Device” in Linux and getting frustrated with this then this blog post has a solution for you.

How To Fix “No Space Left on Device” Error In Linux

Make sure that your Linux has enough space in your Linux operating system. There are two Linux commands for getting information about disk space. You can do it with the du and df commands. .

Why Does Linux Show “No Space Left on Device” Despite Of Having Enough Space In Linux?

If you are seeing the “No Space Left on Device” error message despite having sufficient free space on your disk, there must something wrong with your Linux file system.

Fix 2:

Check Inodes On Linux

One of the common issues might be not having enough inodes. In Linux, inodes aren’t unlimited, and running out of inodes before the storage space can give you the “No space left on device” error.

You can easily check the availability of inodes by using the -i flag with the df command.

sudo df -i

This will clearly tell the total number of inodes present in the filesystem, along with the amount currently in use. If there are no free inodes left on your system, this is the source of the “No space left on device” error. Sadly, there is no way to generate or create more inodes. All you can do is delete the unnecessary files to free up inodes.

Fix 2:

Restart Processes Using Deleted Files

The most common reason for seeing this error is a recently deleted file. Even if a file is deleted, the respective process keeps using it, keeping the space reserved even though the file is already deleted. You just need to restart the process to free up the reserved storage.

Run the lsof and grep commands to find the problematic process and restart the affected process with the sudo systemctl restart service_name command or you can just reset them all with the sudo systemctl daemon-reload command.

Fix 3:

Manage Bad Blocks In Linux

Sometimes bad sectors can be the reason for space-related errors. There is no real way to fix this issue, The only thing you can do is mark the bad sectors so that they are no longer used by the file system. You need to configure the file system. Run the following command by booting through a Live CD. This will automatically detect all bad blocks on the drive and mark them as unusable.

sudo fsck -vcck /dev/sda

This replaces the /dev/sda with the path of the drive you want to repair.

Using XXD Command in Linux

Using XXD Command in Linux

Want a Hexadecimal dump (a hexadecimal view) of your data? The xxd command can do that for you.

Like any other normal command, it takes data from the standard input or file and gives hexadecimal output. It can also do the opposite and convert hex to normal characters.

And in this tutorial, I will walk you through different examples of how to use the xxd command in Linux.

Install XXD on your Linux system

The xxd utility is not pre-installed in most Linux distributions but can easily be installed with the default package manager.

For Ubuntu/Debian base:

sudo apt install xxd

For Fedora/RHEL base:

sudo dnf install vim-common

For Arch-based distros:

sudo pacman -S xxd

How to use the XXD command in Linux

Once you are done with the installation, you have to follow the given command syntax to use the xxd command:

xxd [options] [file]

To make things easy to understand, I will be using the file named Sample.txt throughout the tutorial, which contains the following:

Which Linux distro is your daily driver?
1. Ubuntu
2. Debian
3. RHEL
4. Fedora
5. Arch
6. Gentoo
7. LFS (The GOAT)

To create a hex dump of the Sample.txt file, I will be using the following command:

xxd Sample.txt
Using XXD Command in Linux

Sure, you can use different options to tweak the default behavior of the xdd command. Let me show you how.

Trim lines in xxd output

The xxd command allows you to trim down lines from your output.

To do so, you will have to use the -s flag and append how many initial lines you want to skip:

xxd -s [lines_to_skip] Filename

So let’s say you want to start the hex dumping from the 5th line, which means you need to trim down the first 4 lines:

xxd -s 0x40 Sample.txt
Using XXD Command in Linux

And as you can see, it trimmed the first 4 lines and gave me the hex dump starting from the 5th line.

But if you want to get the hex dump of the last few lines, you can do that too!

To get the hex dump of the last n number of the lines, you will have to execute the xxd command in the following manner:

xxd -s -[Last_n_lines] Filename

So let’s say I want to get the hex dump of the last 3 lines, then, I will be using the following:

xxd -s -0x30 Sample.txt
Using XXD Command in Linux

Specify the column length

You may want to specify how many columns should be shown instead of what xxd gets you by default (10).

To do so, you will need to use the -c flag and append how many columns should be displayed on the output:

xxd -c [No_of_columns] Filename

Let’s say I want the output in 4 columns, then I will be using the following:

xxd -c 4 Sample.txt
Using XXD Command in Linux

Specify the output length

It is similar to what I explained in how you can trim the output but here, you can specify how many lines of the output you want from the first line.

To specify the output length, all you have to do is use the -l flag and specify how many lines of output you want:

xxd -l [Output_length_in_lines] Filename

So let’s say I only want the first 5 lines of the hex dump, then I will be using the following:

xxd -l 0x50 Sample.txt
Using XXD Command in Linux

Get binary output instead of hexadecimal

The xxd command also allows you to get output in binary instead of hexadecimal!

It is quite simple and the binary output can be achieved using the -b flag:

xxd -b Filename

Here, I converted my text file Sample.txt to binary:

xxd -b Sample.txt
Using XXD Command in Linux

Get hex output in capital letters

You may find situations where you want the output in capital letters.

And you can easily get the hex output in capital letters using the -u flag as shown:

xxd -u Filename
Using XXD Command in Linux

Convert hex to the normal text again

So if you redirected the output of the hex to a file, there is a way to get back to normal quite easily.

For your reference, I’m redoing the whole process of how you can redirect the output of the hex dump to the text file first:

Using XXD Command in Linux

So I saved the hex dump output to the Hex.txt.

Now, if I want to read the content of the Hex.txt, I will have to perform the conversion. Otherwise, it is just a pain in the head.

To reverse this effect, you will have to use the -r flag in shown manner:

xxd -r Filename
Using XXD Command in Linux

Want to convert Hexadecimal to ASCII? Here you go!

If you want to convert hex string to ASCII, we have a detailed guide for that purpose:

Convert Hex to ASCII Characters in Linux Bash Shell
Here are various ways for converting Hex to ASCII characters in the Linux command line and bash scripts.
Using XXD Command in Linux

I hope you will find this guide helpful.

And if you have any queries, let me know in the comments.

15+ Best Web Browsers For Linux In 2023

Last Updated on March 17, 2023 by itsubuntu

15+ Best Web Browsers For Linux in 2023

Looking for suggestions for web browsers or internet browsers for Linux then this blog post is definitely for you. There are many more internet browsers available these days for Linux-based operating systems.  Out of many we have collected a few of and best Internet browsers for Linux users.

15+ Best Web Browsers For Linux In 2023

1. Firefox Browser

Firefox is an open-source and popular internet browser for Linux-based operating systems. It is available for major operating systems including Windows, OS X, Solaris, Android, etc.

Install Firefox Browser On Linux Based Operating System

Install Firefox Browser On Ubuntu, Mint, and Debian Based Linux Operating Systems.

sudo apt install firefox

Install Firefox Browser On RedHat, CentOS, Fedora, AlmaLinux, And Rocky Linux.

sudo yum install firefox

Install Firefox Browser On Gentoo Linux Operating System.

sudo yum install firefox

Install Firefox Browser On OpenSuse

sudo zypper install firefox

Install Firefox Browser On Arch Linux

sudo pacman -S firefox

Install Firefox Browser On Alpine Linux Operating System.

sudo apk add firefox 

2. Google Chrome

Google Chrome is another popular internet browser that is available for Linux-based operating systems.

Install Google Chrome on Linux

Run the following commands to install Chrome browser on Debian, Ubuntu & Mint Linux operating system

wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb

Run the following commands to install Chrome browser on Fedora, RHEL, Rocky, and AlmaLinux

wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
sudo rpm -i google-chrome-stable_current_x86_64.rpm

3. Vivaldi Browser

Vivaldi is a feature-rich web browser with an Opera-like interface. It is based on Chromium open-source platform.

Install Vivaldi on Debian, Ubuntu & Linux Mint

wget -qO- https://repo.vivaldi.com/archive/linux_signing_key.pub | sudo apt-key add -
sudo add-apt-repository 'deb https://repo.vivaldi.com/archive/deb/ stable main'
sudo apt update && sudo apt install vivaldi-stable

Install Vivaldi on Fedora, CentOS, RHEL, Rocky & AlmaLinux

sudo dnf config-manager --add-repo https://repo.vivaldi.com/archive/vivaldi-fedora.repo
sudo dnf install vivaldi-stable

4. Opera Browser

Opera is another popular web browser that is also available for Linux-based operating systems.
Run the following command to install Opera Browser on Debian, Ubuntu & Mint

sudo add-apt-repository 'deb https://deb.opera.com/opera-stable/ stable non-free'
wget -qO - https://deb.opera.com/archive.key | sudo apt-key add -
sudo apt update
sudo apt install opera-stable

Run the following command to install Opera Browser on Fedora, RHEL, Rocky, and AlmaLinux —————–

sudo rpm --import https://rpm.opera.com/rpmrepo.key
sudo tee /etc/yum.repos.d/opera.repo <<RPMREPO
[opera]
name=Opera packages
type=rpm-md
baseurl=https://rpm.opera.com/rpm
gpgcheck=1
gpgkey=https://rpm.opera.com/rpmrepo.key
enabled=1
RPMREPO
sudo yum -y install opera-stable

 

5. Chromium

Install Chromium on Debian, Ubuntu & Linux Mint

sudo apt-get install chromium-browser

Install Chromium on Fedora

sudo dnf install chromium

Install Chromium on Other Linux

sudo emerge -a www-client/chromium [Gentoo Linux]
sudo zypper install chromium       [OpenSUSE] 
sudo pacman -S chromium            [Arch Linux]
sudo apk add chromium              [Alpine Linux] 

6. Konqueror

Run the following command to install Konqueror on Linux based operating system.

[For Debian, Ubuntu and Mint]

sudo apt install konqueror

[For OpenSUSE]
sudo zypper install konqueror

[For RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux]
sudo yum install konqueror

[For Arch Linux]
sudo pacman -S konqueror

[For Alpine Linux]
sudo apk add konqueror

[For Gentoo Linux]
sudo emerge -a www-client/konqueror

7. Midori Browser

Run the following command to install Midori on Linux.

[For Debian, Ubuntu and Mint]
sudo apt install midori 

[For OpenSUSE]
sudo zypper install midori 

[For RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux]
sudo yum install midori 

[For Alpine Linux]
sudo apk add midori 

[For Gentoo Linux]
sudo emerge -a www-client/midori 

[For Arch Linux]
sudo pacman -S midori

Bonus list:

  • GNOME Web originally named Epiphany
  • Brave Browser
  • Pale Moon Browser
  • Slimjet Browser
  • Min – A Fast, Minimal Browser
  • Waterfox Browser
  • Tor Browser
  • SeaMonkey

Ping Sweep Using nmap on Linux

Ping Sweep Using nmap on Linux

Ping sweep is the ability to ping multiple devices at once. This can be a lifesaver when looking at which devices are up from the stack of machines while troubleshooting.

Sure, you can do the ping sweep with various tools but using the nmap command to perform ping sweep is one of the most flexible and widely used methods.

So in this tutorial, I will share some practical examples of performing ping sweep using the nmap command.

Prerequisite: Install nmap first

Usually, nmap does not come pre-installed. You can check whether you have it installed by checking the installed version:

nmap -v 
Ping Sweep Using nmap on Linux

If it throws an error saying Command ‘nmap’ not found, it can easily be installed with the following command:

For Ubuntu/Debian-based distros:

sudo apt install nmap 

For Fedora/RHEL base:

sudo dnf install nmap

For Arch-based distros:

sudo pacman -S nmap

How to use ping sweep with the nmap command

Once you have it installed, all you have to do is use the nmap command with the -sn flag:

nmap -sn target_IP/s

The simplest way to ping sweep multiple hosts is to append them one by one as shown:

nmap -sn [IP_1] [IP_2] [IP_n] 

Let’s say I want to ping three IPs 192.168.1.1, 192.168.1.7 and 192.168.1.8 so I will be using the following:

nmap -sn 192.168.1.1 192.168.1.7 192.168.1.8
Ping Sweep Using nmap on Linux

And as you can see, all of the tree hosts are up!

But there are more (and better) ways to ping sweep hosts. Especially, when you are dealing with a stack of machines.

Ping sweep the entire subnet with the nmap command

To ping sweep the entire subnet, you can use the wildcard * replacing the last octet (the last part of your IP after the . ):

nmap -sn 192.168.1.*
Ping Sweep Using nmap on Linux

Ping sweep multiple hosts by specifying the IP range

So if you want to check whether the IPs in a specific range are up or not, you can benefit from this method.

So let’s say I want to check IPs from 192.168.1.1 to 192.168.1.10 then I will be using the following:

nmap -sn 192.168.1.1-10
Ping Sweep Using nmap on Linux

Ping sweep multiple hosts using the ending octet

This is similar to the above method but you get to choose which host to ping by just appending the ending octet.

So let’s say I want to ping 192.168.1.1, 192.168.1.7 and 192.168.1.8 which can easily be done using their ending octet:

nmap -sn 192.168.1.1,7,8 
Ping Sweep Using nmap on Linux

Exclude IP address while ping sweeping using the nmap command

💡
You can exclude multiple addresses using every syntax that I’ve shown above to ping multiple IPs.

You can exclude the IP address while pinging a bunch of hosts using the --exclude flag.

So let’s say I want to exclude 192.168.1.7while scanning the whole subnet so I will be using the following:

nmap -sn 192.168.1.* --exclude 192.168.1.7
Ping Sweep Using nmap on Linux

Similarly, you can also use the range of IPs to exclude them from the ping.

Let’s say I want to exclude IP from 192.168.1.1 to 192.168.1.5 while scanning the entire subnet, so I will be using the following:

nmap -sn 192.168.1.* --exclude 192.168.1.1-5
Ping Sweep Using nmap on Linux

Pretty easy. Isn’t it?

But nmap can do a lot more than just ping

If you are getting started or curious to learn more about networks, the nmap command is one of the most basic networking commands you should start with.

And nmap can do a lot more than what you just saw in this guide.

We have a detailed guide on how you can use the nmap command:

nmap Command Examples in Linux
The nmap command can be used for finding devices on your network, open ports and more. Here are some common uses of nmap.
Ping Sweep Using nmap on Linux

I hope you will find this guide helpful.

And if you have any queries, let me know in the comments.