Q. I'd like to bash under FreeBSD for bash programming. How do I install bash shell under FreeBSD UNIX operating system?
A. Bash is an sh-compatible command language interpreter that executes commands read from the standard input or from a file. csh / tcsh (C shell with file name completion and command line editing) is the default shell under FreeBSD. However, you can easily install and use bash as shell.
Install bash under FreeBSD
Login as root and type the following command:
# portsnap update extract
# cd /usr/ports/shells/bash
# make install clean
To use bash shell, enter:
# bash
OR
# /usr/local/bin/bash
To set bash as default, shell enter:
# chsh -s /usr/local/bin/bash {username}
# chsh -s /usr/local/bin/bash vivek
Featured Articles:
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- My 10 UNIX Command Line Mistakes
- Linux: 20 Iptables Examples For New SysAdmins

- 25 PHP Security Best Practices For Sys Admins
- The Novice Guide To Buying A Linux Laptop
- 10 Greatest Open Source Software Of 2009
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- Top 20 OpenSSH Server Best Security Practices
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Linux Video Editor Software
Facebook it - Tweet it - Print it -


{ 7 comments… read them below or add one }
This was very usefull for me, thank you.
Thanks,
Just trying out freebsd, and the first thing I noticed was there was no bash!
Thanks a lot! Very clearly written and useful!
Very usefull,10x alot!!!
Thanks a lot! Exactly what I needed!
I think the portsnap part (updating the system port tree) needs clarification.
From the FreeBSD Handbook:
First run:
# portsnap fetch
to download a new port tree from the Internet.
If you haven’t run portsnap before (first time updating after new installation):
# portsnap extract
Then always run:
# portsnap update
FreeBSD complained about running update before extract when I tried doing what the guide on this web page said to do. Let me know if I’m misinterpreting something.
Thank you!!!:)