:::: MENU ::::

Posts Categorized / Linux

  • Aug 02 / 2017
  • 0

Connect to serial/console terminal with MacOS using screen

It’s possible to connect to serial console with MacOS without using a specific app but only screen.

First, you need to find the correct device you will use to connect to the serial console. Depending on your installation and your adapter, you’ll can find it under different names with one these commands:

Here, we can see that our device is available on /dev/tty.usbserial

If you have any doubt with the screen command, you can check the documentation, with the specific part regarding the console connection:

For example, if you want to connect to serial port with those parameters:

  • 9600 bps
  • 8 data bits
  • flow control

You can just use this command:

Hint: Note that if you’re using a specific adapter (like an adapter DB9/RS232 to USB), you will probably need to install the driver first to get the device available.

  • Jul 22 / 2017
  • 0

Get CPU/RAM usage per process on Linux

When you’re facing performance issues, it’s always useful to check CPU/MEM usage per process to see if you have an issue with a specific process. For that, you can use ps and some sorting commands.

Tip: You can shrink the results to the first lines by using head

Memory analysis

We’re using the –sort -rss attributes to get the results sorted by RSS in the desc order (use –sort rss for the asc order)

CPU analysis

We’re using the –sort -%cpu attributes to get the results sorted by CPU in the desc order (use –sort %cpu for the asc order)


Once you got the results, it’s time for you to investigate further and analyze what’s happening with those processes! Good luck!

  • Jul 05 / 2017
  • 0

Generate self-generated SSL certificate (cert/key pair)

Here is a simple script with configuration file to generate a self-generated SSL certificate (cert/key pair).

First define a config file openssl.cnf containing the certificate informations:

Then, create the bash script makessl.sh and configure your own parameters (directories, cert filename and validity duration):

Now, execute the bash script:

Let’s check your freshly created certificate and double check the information:

  • Jun 25 / 2017
  • 0

Check SSL certificate of an URL with openssl

You can get standard information about the certificate directly by opening a connection to a website:

Answer will be like:

But this is not giving you some interesting information like the expiration date for example! To work around that, you can simply redirect the output (certificate) to openssl and ask for some specific information:

This time, output will be:

  • Jun 14 / 2017
  • 0

Change ownership (chown) on a symbolic link

You already probably noticed that if you want to update the ownership of a symbolic link on any UNIX system, a simple chown won’t do the job.

Indeed, let’s suppose you have this:

If you’re doing a simple chown:

You can see that it changes the ownership on the target file and not on the symbolic link:

If you want to update the symbolic link, you need to use the -h or –no-dereference option to apply the changes on the symbolic link and not on the target:

Then, you can see that it’s now updated:

  • May 30 / 2017
  • 0
Linux, Python

DNS queries from a file/list to CSV

It’s not easy to perform bulk DNS resolution when you have many DNS/IPs to control. Here is a simple script allowing you to perform DNS resolution over a list of DNS entries or IPs.

Here is a list of DNS (names and IPs) that we put in a file called listDNS.txt

Let’s copy that script that will do the job in a file called resolverDNS.sh

And now, execute it by passing file path as an arg, and see the output:

Resolution are done for every line, depending on if it’s an IP or a name (and remain empty if it can’t resolve).
Feel free to adjust the script according to your needs!

Question ? Contact