Bash Shell Programming HowTos

Tutorials, howtos and programming tips about GNU Bourne-Again SHell (BASH) for Apple OS X, Linux, *BSD and Unix like operating systems. ( rss feed )

How do I create and setup an OpenSSH config file to create shortcuts for servers I frequently access under Linux or Unix desktop operating systems?


I need to add dev tools (such as JDK and friends) to my PATH. How do I change $PATH variable in OS X 10.8.x? Where does $PATH get set in OS X 10.8 Mountain Lion?


I download lots of files in ~/Downloads/ folder in Ubuntu Linux and OS X desktop. How do I show last downloaded file first using the ls command?

{ 1 comment }

I need to find out in which directory my bash script resides so that I can read config file called .backup .ignore .target. For example, if my script resides in >/home/foo/, I need to read /home/foo/.{backup,ignore,target} files. How do I find out the current directory location and shell script directory location in Bash running on Linux or Unix like operating systems?


How can I fetch HTML web page content from bash and display on screen using shell utilities?


I am using awk to grep ‘foo’ from a text file and cacluate sum of field # 7. But, result is rounded to an integer. I need exact result such as 385858.66 and not 385858 using the following command:

grep ‘foo’ 2012-2013.txt | awk ‘BEGIN{ sum=0.0}{ sub(“,”,””,$7); sum +=$7}END{ print “$” sum}’

I want $682444.57 as output. How can I force “awk” to do floating point math?

{ 1 comment }

I am a desktop support professional with experience working in a corporate call center environment. Recently, I started to admin RHEL based IBM Linux server. How do I determine how much disk space left in my Linux server? How do I find out how much disk space I have in Linux for each partition?