Linux Shell: DF and DU report different values

Sometime it happen that the command df and the command du report different results such as: df -h /tmp Filesystem Size Used Avail Use% Mounted on /dev/vzfs 16G 12G 4G 75% /tmp While a du command show somethign different such as: du -hs /tmp/ 10G /tmp/ There are usually different reason when this happen.

Linux Shell:Timeout

Sometimes it’s useful to write a bash script that do something like “Do this job, if it’s still running after XX second kill it”, how to implement this in a normal bash environment ? Nothing simpler: Use the timeout shell command to achieve this. From its info page: timeout runs the given COMMAND and kills [...]

Linux shell:lsblk

While installing a new computer (soon a post on my new arch-linux laptop) I’ve re-discovered a command that I don’t use frequently, but that can be really useful : lsblk lsblk lists information about all or the specified block devices. The lsblk command reads the sysfs filesystem to gather information. The command prints all block [...]

Linux shell: Introduction to Flock

Recently a colleague of mine should run multiple parallel jobs on a server (around 20 in our specific case), every job does “an elaboration” and this can take a time longer or shorter in respect of the others, once a job finishes its task it must read from a text file the first line that [...]

How to reset your forgotten password on Gnu/Linux

This is an easy and simple solution based on the article by Umair, first posted on it’s common that, if not you, one of your familiar or friends forget his login password, and if this is the only account available on the system this means that he’s usually locked out from his computer, luckily [...]