I’ve recently worked with several folks who live in a Windows world and are either moving to a Mac laptop or have to do work on a Linux server. In the DevOps world, developers are often pushed outside of their comfort zone. Having to work in a UNIX shell can be quite disconcerting.
While I can’t give you a 5-minute primer that takes all the pain away, I can point you in the right direction. I have created a Bash shell configuration that provides some sane and useful command line defaults, much better than what you get out of the box.
First thing first, make sure you are running in Bash! Run the command echo $0
to check. If the output is -bash
you are all set. If not, you’ll have to learn how to change your shell on whatever environment you are running (hint: often chsh
is the command to do this)
Now run this command to download and install the new configuration from GitHub:
curl https://raw2.github.com/agperson/basic-dotfiles/master/basic-bashrc/.bash_profile -o ~/.bash_profile
(To see exactly what is in the file before download it, here it is.)
Once you open a new shell, you will have a few nice changes:
- Color output for several commands
- Better history retention and display (see it by running the
history
command) - Spelling correction when navigating the filesystem
- A nicer command prompt
- Completion of many common commands if the bash_completion service is installed
- Some handy aliases, such as
ll
to list files in the expanded (list) view. Runaliases
to see all aliases that are set. - Aliases for common Windows mistakes (i.e.
del
maps torm
andmove
maps tomv
)
Now that you have this starting point, you can modify and customize the .bash_profile to add additional aliases or make other tweaks. Remember that by default all files that begin with a “.” are hidden by default, but they are there. There is a handy alias set — la
— that will list all files, including hidden ones.