What to do when ctrl+c not killing your telnet command

To check if ports are open or not, we usually do the following:

telnet IP PORT

For example:

telnet 192.168.100.5 25

Sometimes after seeing your result, you keep pressing ctrl+c, ctrl+x or ctrl+\ to force quit it, but it just doesn’t! It seems silly I know and I feel a bit stupid for writing this, but it was driving me crazy at some point!

Anyway, just press ctrl+5 or ctrl+] and then type quit, that’s it!! This works the same way on Linux, MAC and Windows.

user@server:~$ telnet xxx.xx.xxx.xxx 25
Trying xxx.xx.xxx.xxx…
Connected to xxx.xx.xxx.xxx.
Escape character is '^]'.
220 *
^C^C^C^C^C^C^C^C^C^C^C^C^C
^C^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z
^\^\^\^\^\^\^\^\^\^\^\^\^\
^]
telnet> quit
Connection closed.

Sources:

https://superuser.com/questions/486496/how-do-i-exit-telnet

Posted in Linux | Tagged , | Leave a comment

How to reset display settings for KDE Plasma

In case your display arrangement or settings, e.g. when you have 3 screens and you are for some reason unable to reorganize them or change their settings, just reset your display settings:

rm -rf .local/share/kscreen

Then just log out and back in.

That’s it! Enjoy!

Sources:

Posted in Linux | Tagged , , , | Leave a comment

How to force resync between PBIS and AD on Linux

In case you made a change on your AD, such as modifying groups or changing attributes of a user, it sometimes take a little while to reflect that on the Linux server that authenticates against AD via PBIS.

The best solution in that case is to clear the pbis cache and force pbis to sync immediately via this command:

sudo /opt/pbis/bin/ad-cache --delete-all

Enjoy!

Posted in Linux | Tagged , , , , | Leave a comment

How to change max open files for nginx server on Ubuntu

The following error occurred a lot in /var/log/nginx/error.log:

Too many open files

This means that the nginx master process reached the maximum number of open files which was set to the default of 4096. (To check it, simply cat /proc/pid/limits, where pid is the process id)

To resolve, this, edit /lib/systemd/system/nginx.service and add the following line:

LimitNOFILE=30000 #change it according to your needs

Then reload the systemctl daemon:

sudo systemctl daemon-reload

and finally restart the nginx service:

sudo service nginx restart

That’s it, the error is gone!

Tested on Ubuntu 16.04 with nginx 1.17, should work with any other OS using systemd.

Enjoy!

Sources:

Posted in Linux, Ubuntu | Tagged , , , , , | Leave a comment

Add a new HDD to a VM without rebooting on Ubuntu server

Firstly, install scsitools package:

sudo apt install scsitools

Then run the command rescan-scsi-bus:

sudo rescan-scsi-bus

That’s it, your new virtual HDD has now been detected.

Another way would be to do it with a loop and without the need for that package:

for host in ls /sys/class/scsi_host/; do
echo "- - -" > /sys/class/scsi_host/${host}/scan;
done

Enjoy!

Sources:

Posted in Linux | Tagged , , , | Leave a comment

A cute little screenshot and annotation tool on Linux

A very handy screenshot tool that works very well on my KDE plasma desktop on Ubuntu 19.10 is ksnip, which you can get from here: https://github.com/damirporobic/ksnip

Just download and install the deb file and that’s it!

Enjoy!

Posted in Linux | Tagged , , , | Leave a comment

Restart network manager indicator in KDE Plasma Desktop

sudo service NetworkManager restart

Note: This is specifically for the network icon in the system tray and is different from the network-manager service which controls the whole Linux network manager:

Tested on Ubuntu 19.10 with KDE Plasma 5.16.5

Source: https://bbs.archlinux.org/viewtopic.php?id=200935

Posted in Linux | Tagged , , | Leave a comment