Want to check the amount of used, free and total memory and swap from the command line? This script displays memory and swap information. Fully posix compliant and should work with all 2.[2-6].* kernels .

If you spend a lot of time creating new shell scripts then it can be very useful to make them executable by default. To do this in Vim add the following lines to the end of your ~/.vimrc file - creating it if necessary:

We can use vim to make changes to a file all in one command, for example

vim -c "5,10s/a/b/g | wq" filename

This will open the file 'filename' and replace all occurances of 'a' with 'b' on lines 5-10. The file will then be written and closed. To edit the file after the change, just remove the ' | wq' from the end of the command.

A remote Windows PC can easily be shutdown, assuming you have Samba installed on your Linux box, and you have a user account on the Windows PC that has the necessary rights.

Just enter the following command, where 'thehostname' is the hostname of the remote PC, and 'theusername' is a valid user account on the remote PC:

net rpc shutdown -S thehostname -U theusername

If the hostname is not known, or cannot be resolved, then use the following instead, replacing '111.111.111.111' with the IP address of the remote PC:

net rpc shutdown -I 111.111.111.111 -U theusername

Additionally, the parameters that can be used with Windows' own shutdown command such as '-f' to force or '-t' to set a timeout, can also be applied to the net rpc shutdown command as well. For example the following will wait 60 seconds, and then force all running programs to terminate before shutting down:

Last time, I had to install a package with a configure Script. There are a lot of parameters to adjust the installation. Unfortunately the configure doesn't end with success. A dubios error message appears and I don't find out what's wrong.
Also the modern oracle 'google' doesen't give a hint. But after hours I find a quick and easy solution:

sh -x ./configure ... configure_options ...

First there is a long rolling of letters, but afterwards, when the error appears, you can easy find out what the mistake is, because the debug modus tells you.