Test if a port on a remote system is reachable

With telnet:

With bash:

Replace tcp with udp, depending on what you want.

With netcat:

If the port is open, you will get an output of 0. If it’s closed, it’s a 1.

Compare the output of two commands

..without creating a temporary file:

The -y is just to show a side-by-side comparison. Very handy! And the result?

Thanks to my colleague Ingvar for showing me this!

No Wi-Fi device found

I just reinstalled one of my machines with Fedora 21. The install went great, but when the machine was done rebooting, and I was trying to set up my access to a wireless network with nmcli (NetworkManager), I got the following error-message:


Spending a lot of time finding what the problem was, I finally found the solution.  It seems that Wi-Fi support in NetworkManager has been separated to a plugin. The package NetworkManager-wifi was missing. So install it, reboot your machine and give it a whirl again. It should (hopefully) be working.

Introduction to cron

cron is a time-based job scheduler. This piece of software utility is used when you need to have a program run repeatedly at set time.

The daemon that runs in the background is named crond, while the file that contains the jobs themselves is named crontab.

You have three main directories:

  • /etc/crontab is the main system crontab file.
  • /var/spool/cron/ a directory for storing crontabs defined by users.
  • /etc/cron.d/ a directory for storing system crontabs.


Creating a crontab-file for your user is easy. Usage depends on what you need to do.


This command will allow you to edit the current user’s crontab. If a crontab doesn’t already exist, it will create a new one once you have saved your changes.

Edit another user’s crontab

You can also edit another user’s crontab, but only if you have the correct permissions in place to do so.



..to list another user’s crontab.

These are the most common usages of the command crontab. For a couple of more options, see man crontab.


The syntax of a crontab-file looks like this:

Each asterisk represents a field. Starting from left to right, the fields are as follows:

  • Minute (0 – 59)
  • Hour (0 – 23)
  • Day of month (1 – 31)
  • Month (1 – 12)
  • Day of week (0 – 7, where 0 and 7 is Sunday)

On the fields Month and Day of the week, you can also use names instead of numeric values.


There are various operators that you can use with cron. Here’s the list:

Asterisk (*)

An asterisk (*) is used to indicate that every instance (i.e. every hour, every weekday, etc.) of the particular time period will be used. So if you use an asterisk in the field Hour, it means that it will run every hour.

Comma (,)

With this operator you can specify a list of values. If you use 1,5 in the field Day of week, this would mean Monday and Friday.

Dash (-)

While comma specifies a list of values, dash specifies a range. 1-5 in the field Day of week would mean Monday to Friday.

Forward slash (/)

Forward slash specifies a step value. If you’d like to execute a command every other hour, you could use 0-23/. You can also use steps after an asterisk, so if you want the command to run every two hours instead, use */2.



In this example the script backup.sh runs at 14:45, the first day of the month, every month.


This line runs the command list_files.sh at 04:30 on the 1st and 15th of each month, plus every Friday.


The line above runs the command wake_up.sh at 08:00, Monday to Friday.


..and this line would run the program annoy_wife.sh every five minutes, every day.

As always, if you want to know more about cron, check out the command man cron.

Have fun!

Split and merge PDFs – part 2

A while ago I wrote a post named Split and merge PDFs with pdftk. Unfortunately, pdftk seems no longer to be maintained for Fedora 21. So we have to use another alternative – poppler-utils:

Install the package with:

..and you can use them to both split and merge files. poppler-utils contains a list of tools that you can use to manipulate PDFs:

  • pdfdetach — lists or extracts embedded files (attachments)
  • pdffonts — font analyzer
  • pdfimages — image extractor
  • pdfinfo — document information
  • pdfseparate — page extraction tool
  • pdftocairo — pdf to png/jpeg/pdf/ps/eps/svg converter using cairo
  • pdftohtml — pdf to html converter
  • pdftoppm — pdf to ppm/png/jpeg image converter
  • pdftops — pdf to postscript (ps) converter
  • pdftotext — text extraction
  • pdfunite — document merging tool

So, we move on to merging and splitting:



Check out man pdfseparate for more information about the tool.