:::: MENU ::::

Posts Categorized / Linux

  • 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!

  • May 15 / 2017
  • 0

Remove list of mail addresses from postfix queue

There is no easy way to remove a list of mails in queue with a same sender or domain in Postfix. But you can use some standard commands to get this working.

First check the list of mails you want to remove with something like

You’re getting the list of mails that you will remove with the sender

And now you can remove those mails from the queue by using postsuper -d

You will see the mails being removed

Question ? Contact