Category: Linux

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

  • Create multiple symlink by changing name with command find

    Let’s imagine that we have the following directory listing: $ ls -ls /data/db1/ total 4778688 1488 -rw-r–r– 1 dbmaster 760264 Feb 14 00:20 database_2016_file1 496 -rw-r–r– 1 dbmaster 251529 Dec 29 12:45 database_2016_file2 808960 -rw-r–r– 1 dbmaster 414187520 Jan 30 10:20 database_2016_file3 344 -rw-r–r– 1 dbmaster 172544 Mar 18 00:42 database_2016_file4 958528 -rw-r–r– 1 dbmaster…

  • Use wget/curl behind a proxy

    If your machine is behind a proxy, you probably configured your browser for going through the proxy to reach Internet. But what about command line with curl and wget? If you want to add the proxy temporarily for some few installations for example, just type (by replacing URL and port with yours): export http_proxy=http://MyProxyURL:3128 export…

  • Reset root password on Linux

    Who never forgot a root password on a running machine that you can’t reinstall totally? Most of the linux distributions do have a recovery partition that you can use for that on startup (I won’t detail this here). But if you don’t have this partition, you can still reset it using generic commands thanks to…

  • Some Apache servers do activate the DirectoryIndex so you can easily go through the directories listing over HTTP and download some files. It’ s often used for giving possibility to people to download multiple releases for a package/software. But in some cases, it can be useful to download the content of a full tree view.…

  • Nagios plugin – Error “No such file or directory”

    When trying to execute a nagios plugin, you’re getting this error: # /usr/lib/nagios/plugins/check_procs bash: /usr/lib/nagios/plugins/check_procs: No such file or directory But when checking further, the file does exist: # ls -l /usr/lib/nagios/plugins/check_procs -rwxr-xr-x 1 root root 124929 Jan 19 2016 /usr/lib/nagios/plugins/check_procs This can be due to some 32 bit libc libraries missing. To fix that,…