Category Archives: Bash

Scripts, sources and howto’s

Conditions in BASH scripts Pt. 1

This is just a reminder for myself. Usually I have to look this up in Google whenever I want to use it Check if string A contains string B: if [[ $A == *"$B"* ]] then echo We have a … Continue reading

Posted in Bash, Beginner | Leave a comment

What process is using how much swap memory

I found this interesting script that prints out a list of processes that are using swap space. I changed the output to suppress the PIDs that aren’t using swap. #!/bin/bash # Get current swap usage for all running processes # … Continue reading

Posted in Bash, Hardware, Linux, Uncategorized | Leave a comment

Howto zero out a file

For me this is the easiest and most reliable way to empty a file:[noob@testserver ~]$ :>| theFile.txtI like it because the key combination is easy to remember.

Posted in Bash, Linux | Leave a comment

Howto get your own WAN IP address

I found this today in one of the forums. I thought that it is quite handy. If you want to know your public IP address you can use this command in bash or other shells. dig +short myip.opendns.com @resolver1.opendns.com Just … Continue reading

Posted in Bash, Linux | Leave a comment