:::: MENU ::::

Posts Categorized / Linux

  • Jun 14 / 2017
  • 0
Linux

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

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

  • May 04 / 2017
  • 0
Linux

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):

We need to first unmount the partition:

If you can’t unmount it, double check what process is using it with the lsof command:

Then proceed with a check with e2fsck command and resize the partition with resize2fs by defining the new size (M for Megabytes, G for Gigabytes, and so on…)

Mount your partition back to your system:

And check again your partition sizes :

We can see that the partition /home has now a size of 100G as expected!

  • Apr 24 / 2017
  • 0
Linux

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:

If you’re getting such an error when you are using the command:

This means you just need to enable some modules before:

  • Apr 13 / 2017
  • 0
Linux

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:

So, if you want to quit, you just have to use the “escape character” as indicated. But this character is not designed to be typed with 2 characters like “^” and then “]” – you have to use a direct command that can be different depending on your OS:

  • Windows: Ctrl + $
  • Linux: Ctrl + Alt Gr + ]
  • Mac OS: Ctrl + $

And press Enter once you inserted this escape character so you can get the standard telnet prompt and be able to type quit to exit the prompt.

This will result in a command like:

And here you go – you’re out of telnet 🙂 !

Pages:1234567...13
Question ? Contact