Watch, Read, Listen
-
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…
-
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: [ req ] default_bits = 2048 encrypt_key = yes distinguished_name = req_dn x509_extensions = cert_type prompt = no [ req_dn ] # country (2 letter code) C=FR # State…
-
Check SSL certificate of an URL with openssl
You can get standard information about the certificate directly by opening a connection to a website: openssl s_client -showcerts -connect python.org:443 </dev/null Answer will be like: CONNECTED(00000003) depth=3 C = SE, O = AddTrust AB, OU = AddTrust External TTP Network, CN = AddTrust External CA Root verify return:1 depth=2 C = US, ST =…
-
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: 8 lrwxr-xr-x 1 user1 group1 4 Jun 13 23:46 link -> test 8 -rw-r–r– 1 user1 group1 6 Jun 13 23:54 test…
-
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 www.python.org www.pyython.org 208.67.220.220 www.bing.com Let’s…
-
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 postqueue -p |grep -e ‘[email protected]|[email protected]|[email protected]’ -B2 |grep “^[A-Z0-9]” You’re getting…
-
Reduce partition size on EXT filesystems on Linux
It is possible to modify a partition size on EXT filesystem thanks to some few commands. We will take here a simple example: We have a /dev/sda5 partition mounted on /home Its size is currently 150G and we want to reduce it to 100G Let’s check the current config (mounting point and size): Filesystem Size Used Avail Use% Mounted on /dev/sda1…
-
Find ILO IP on a HP server with Linux
If you forgot what iLO IP has been defined on your linux server and you are working remotely on it, don’t worry, you can still retrieve it with a common tool called ipmitool – available on most of the distros with standard packages: [admin@myserver /]# ipmitool lan print Set in Progress : Set Complete Auth Type…
-
Quit telnet – Escape character
Stuck with a telnet session that refuses to give you hand back on console? No worries… You just have to know the correct command to sort this out! When you are opening a telnet connection, you probably got something like: user@server# telnet 127.0.0.1 80 Trying 127.0.0.1… Connected to 127.0.0.1. Escape character is ‘^]’. So, if…
-
Display time with history command
When you are using the history command on a UNIX system, by default, you’re only getting an action list with numbers but no date and/or time to complete this history. For that, you have to define an environment variable HISTTIMEFORMAT that will describe how you want to display the timestamp for each command. To display the timestamp temporarily (during…