www.thorko.de Thorsten Kohlhepp - Systems administrator | Thorko.de

 

Latest SysadminDB entries


Zabbix Calculated Items

If you have an calculated item which the divisor can get 0, create it like this.

last("X") /( last("Y") + count("Y",#1,0) )

This changes the divisor to 1 if it is 0, but doesn't change anything if it is not 0.

 




Sudo tips and tricks

forget to run the last command with sudo

~$ sudo !!

forget to open a file in vim with sudo

:w !sudo tee %



Set resource limit on a running process

Use this little c program to set resource limits on a running process

~$ prlimit <pid> <resource> [<new-soft-limit> <new-hard-limit>]
~$ prlimit 1452 nproc 4096 65536
~$ prlimit 1452 nofile 1024 2048



Some useful apt commands

install a package using wildcards

~$ sudo apt-get install '*name*'

install a specific version

~$ sudo apt-get install vsftpd=2.3.5-3ubuntu1

completely remove package including config files

~$ sudo apt-get purge vsftpd

show changelog of package

~$ sudo apt-get changelog vsftpd

search for files in packages

~$ sudo apt-file search somefile.lo



Change time format on Linux

If you want to change the time format in Linux to a 24h format you need to do the following

~$ apt-get install language-pack-de-base language-pack-de
~$ echo "LC_TIME=de_DE.UTF-8" >> /etc/environment