New to Linux and the open source world? We have compiled a huge list of resources to help you go through Linux and its distributions. Visit the full Linux guide page right now.


The novel Coronavirus (Covid-19) has been spreading over most countries in the world and forcing people to remain inside. But a Linux user is not a real Linux user if he/she doesn’t use the situation to learn new things about the Linux command line while being quarantined in home.

Today, we are taking you in a little funny post on small tips & commands that you can use to fight Covid-19, had it been a file in the Linux world on your machine.

Tip 1: (Joke) Self-Quarantine Yourself At ~

This is the most basic and essential tip to keep in mind. In times where viruses like Covid-19 can easily spread from one person to another, you should always stay at home and try to isolate yourself from other users.

To do that, simply run a cd:

cd ~

And to make sure that you are really, really at home:


The output should be the full path to your home directory.

Tip 2: Search For Files Named With “Covid-19” & Remove Them

Now, up for a more defensive action, you should check whether there are any file names that contain the term “covid-19” in your system. To do that, we’re gonna use the following command:

sudo find ~/ -iname "*covid-19*"

Here’s the explanation of each part:

  • sudo: Give you administrative permissions so that you can access files outside your ordinary permissions.
  • find: The famous find command.
  • ~/: Search in the contents of your home folder only. If you want, you can change it to / to search all the system.
  • -iname: An option for the find command to search filenames. The i at the beginning of the option is to differentiate it from -name, because we want to make our search case insensitive (Unlike -name, which would’ve been case sensitive).
  • "*covid-19*": Any file name that contains covid-19, no matter its location in the filename.

For other variations of Covid-19, like Covid19 or Coronavirus or others, simply run the command multiple times with changing the search string.

Now, that you have the list of files you need to remove, if you are certain that you want to remove them, simply run the same command above but with adding -delete to the end of it:

!! -delete

Which will now delete all files that have “covid-19” in their names. (!! Takes the last command you executed and runs it again, -delete will be appended to the last command you ran).

Tip 3: Search For “Covid-19” inside the contents of all files & Remove Them

Now, we want to search inside the contents of all files for “Covid-19” instead of just their names. To do that, we are gonna use the following grep command:

sudo grep -iRl --exclude-dir={.steam,snap,.cache} "covid-19" ~ 2>/dev/null

Let’s explain it:

  • grep: A command that allows us to search for texts inside files (or patterns inside given texts in a pipe).
  • -iRl: The i is to make our search case insensitive, the R is to make it recursive (Traversing all sub-folders) and the l is to make it give us the name of the file that contains the string we are looking for instead of giving us the plain text portion of the file.
  • --exclude-dir={.steam,snap,.cache}: Those are some folder names that we do not wish to look inside. Of course, in a case of an actual virus/something you are looking for then you wouldn’t want to exclude anything, but this is for demonstrating the grep command’s ability to do that.
  • "covid-19": The term we are looking for.
  • ~: Where we want to search. Here we chose to search in our home folder, alternatively you can set it to / to search all your filesystem (But it’s gonna take a long time).
  • 2>/dev/null: A small trick to remove warning messages from the output of grep and send it to our Linux black hole. You may want to emit this portion of the code in a real-world scenario.

Once you have found any occurances, you can remove the ones you don’t like with the rm command:

sudo rm /path/to/file

Tip 4: Check Whether a Package is Responsible For a Covid-19 File

Let’s say that you have found a file with the path of /etc/covid-19, and you wondered whether this file came by itself there or from a package you installed? To check that, you should run the following command on Debian-based distributions:

dpkg -S /etc/covid-19

Or the following on Fedora:

dnf provides /etc/covid-19

Or the following on Red Hat/CentOS:

yum provides /etc/covid-19

If no output is given to you from the command, then this means that there is no registered package responsible for that file. Of course, this doesn’t eliminate the possibility that this file came here by one of the (possibly malicious) packages you installed, as packages can run external shell scripts in their post-install scripts if they wish (E.g Adobe Flash package on Ubuntu actually downloads Flash from Adobe’s website and installs it on your machine, so you wouldn’t be able to detect its files using this method).

If, however, you find a package responsible for that file, then you now know who you should blame!

Tip 5: Send a notification If a Covid-19 File is Detected

We can monitor a specific folder and send an alarm whenever a file with the name “covid-19” appears in it. To do that, we are gonna need the inotifywait program installed (Most distributions ship it as inotify-tools):

sudo apt install inotify-tools # For Ubuntu
sudo dnf install inotify-tools # For Fedora

Now, our command will be the following:

inotifywait -m ~ -e create -e moved_to |
     while read dir action file; do
         if [[ $file == *"covid-19"* ]]; then
           notify-send --urgency=critical -t 5000 "Covid-19 Alarm!" "A Covid-19 file was detected at $dir$file"

Let’s explain it in details:

  • -m ~: Here you can specify the folder you want to monitor. We chose to monitor our own home folder this time (~ stands for /home/myusername), but you can change it to any other path or sub-folder you want. (Notice that this isn’t recursive, sub-folders won’t be monitored).
  • -e create -e moved_to: Those are the events that will fire our alarm; Whenever a new file is created or moved to our folder. You can check more events at the man page of inotifywait.
  • Everything after the | should’ve been actually just one command, but we extended it with Bash syntax to do multiple things. Here we run a while loop to monitor the path, and run code after it on each file that is detected.
  • if [[ $file == *"covid-19"* ]]; then Run the proceeding command if any file name contains “covid-19”.
  • notify-send --urgency=critical -t 5000 "Covid-19 Alarm!" "A Covid-19 file was detected at $dir$file" Send a notification with the critical urgency and make it appears for 5 seconds.
  • Then we close our loops.

Now, after you run the command above, go ahead and create a file with the name “covid-19” in your home directory, and you’ll notice that a notification will be sent immediately for you:

5 March 25, 2020

So this is the end of our entertaining post. We hope you’ve learned something useful in the Linux command line and also had fun in fighting Covid-19 in your machine. Realistically, you would’ve taken totally different actions if Covid-19 was an actual Linux virus on your machine, but this is a good approach to teach you something new.

If you have any comments or feedback, we would be happy to have them in the comments below.



  1. OtmanGX

    March 30, 2020 at 12:43 am

    that’s really useful until we get an antidote (security update) from linux community


  2. Tony Rawlings

    May 24, 2020 at 1:32 pm

    re-install the world.


Leave a Reply