Category: Bash

Bash tips and tricks

Bash, Linux

resolving addresses starting with /etc/hosts

Introduction: as most Linux administrators know if you type the command, for example: host You get the resolving of the address ONLY through DNS resolving and NOT using the local /etc/hosts file first. Of course if you use the command: ping You get to see the IP which with be tried to be …

Bash, Linux

Change the bash session timeout

Sometimes we need to have a longer bash session timeout value to be able to stay logged-in while nothing is happening on the terminal. Here is the setting you can include in your .bashrc or .profile files: export TMOUT=0 This will set the shell session to have no timeout duration. export TMOUT=345600 This will set …

Bash, MAC OS X

Replacing the missing ‘tac’ command in MAC OS X

After looking into Fink Command and Porticus I could not find the GNU command ‘tac’ for writing bash scripts. So I found these replacements which works well from the following link (Thanks guys :-)) Normal use of tac: …..| tac |……. Replacement Nr. 1 …..| awk ‘{print NR,$0}’ | sort -nr | sed ‘s/^[0-9]* …