Category: Linux
-
How to capture results of a watch in a file
For debugging purposes, it can sometimes be useful to write the results of a command executed at a given time lapse. You can easily monitor a command by using the watch command. By default a watch command is only displaying result, and you have to be in front of to see the results. If you…
-
Find which process is using a specific port
If you need to know/find which process is using a specific port on your system, you can use some default tools for troubleshooting: netstat lsof WARNING: For the use of these tools, you will need root rights (or sudo rights will be efficient) First, with netstat you can use options tnlpu to display much informations on connections: $…
-
Add a function in shell on Linux (make dmesg timestamps human readable)
You want to add a specific function on your shell which is not available in standard functions and you would like to be able to call it anywhere you want without the need to specify the script location? That’s quite easy to do, with some simple tricks 😉 ! We will here work with a…
-
Create an interactive command-line menu using Python
It can be necessary to create a simple interactive menu on CLI (Command-Line Interface) using Python to allow users to make some choices while executing a script/program. As there is no standard library for this in Python, you will have to adapt it by yourself. Here is a very simple example of how to do…
-
Testing SMTP server using telnet (whether with authentication or not)
You can need to perform testing with your SMTP server and see if you are able to send mail with it. You have your domain name, and you want to check if mail server is answering properly? 1. Check the mail server with DNS entries We first need to find the right DNS entry for MX…
-
Testing an ISO or an USB bootable drive with QEMU
If you want to test an ISO image or a bootable USB drive you just prepared, you can do it very easily thanks to QEMU with a simple command-line. Obviously, you will need to install the QEMU package first so you can use it. For example on a Debian-based distribution: sudo apt-get install qemu qemu-system…
-
NMap main command-lines
Nmap (“Network Mapper”) is a free and open source (license) utility for network discovery and security auditing. Many systems and network administrators also find it useful for tasks such as network inventory, managing service upgrade schedules, and monitoring host or service uptime. Nmap uses raw IP packets in novel ways to determine what hosts are…
-
Find main DNS servers for a given domain name
It can be useful to find the main DNS servers for a domain name and see if you can query it directly to ensure the value you got from your DNS server is the most recent. For this, you can simply use nslookup tools, which is available by default on either most Unix distributions and also…
-
Encrypt Hard Drive Disk under Linux – LUKS and cryptsetup
You want to add a new hard drive disk (or a new partition) to your Linux system but this disk will contain some private data then you want it to be encrypted so you can restrict its access to whom will have the key. Be careful, there are some parameters you have to take in…
-
Testing website using telnet (SSL/HTTPS)
When developping a website, you could need to send custom requests to your server so you can analyze its behavior and its responses. If you’re not using secured protocol, that’s easy, you just need to connect to port 80 (usually) on your server and send your request as: telnet www.python.org 80 GET /index.html HTTP/1.1 Host:…