‘bash’ A.K.A. The Solution for Everything – A few of the *Special Files*!

In bash, the shell reads one or more startup files. Here’s the details about what’s what and which is run when.

  1. /etc/profile is executed automatically at login.
  2. The file from the list of ~/.bash_profile, ~/.bash_login, or ~/.profile are then executed at login.
  3. ~/.bashrc is executed by every non-login shell, but if sh is used to invoke bash it reads the $ENV for POSIX compatability.

For reference, the ~ symbol is used in place of the user directory. One way to check this out yourself is to change directory to ~ with a cd ~ in the shell, then type pwd which will give the current directory. You’ll find that it is something like /Users/adron where instead of my name it’d be your user name.

When invoking the shell, you can also skip the ~/.bashrc or otherwise change the way bash starts up with the following options.

  • bash --init-file theFileToUseInstead or --rcfile instead of ~/.bashrc.
  • bash --norc which is similar to invoking with sh, which will use $ENV.
  • bash --noprofile will prevent /etc/profile or any other personal startup files. This will provide a pretty baseline bash shell for use.

Until next time, happy bash code thrashing!

‘bash’ A.K.A. The Solution for Everything – Bourne Shell as per v7 Unix to Today’s

In 1979 Unix v7 started being distributed with the original Bourne Shell. Simply, it’s a program that sits at /bin/sh and runs in the terminal. You may ask, “what’s the difference between a shell and the terminal?” Let’s cover that right now, because it’s something that routinely isn’t common knowledge, but it really ought to be as it sets the basis for understanding a lot of what is going on in Unix based systems (that includes almost every practical system on a PC, Server, in the cloud, on your phones, and more. Probably easiest to explain it simply as everything that isn’t the Microsoft Windows OS)

A Shell and the Terminal

Terminal – A terminal is the text input and output environment on the system.

Shell – This is the command line interpreter that is run at the terminal.

Another point of context, is that a terminal, shell, and the word console are all used in various ways and sometimes interchangeably. However, these words do not mean the same thing at all. They are distinct individual parts of the system. For example, console, which is used in a strangely disingenuous way all over Microsoft phrasing, is the physical terminal of the system, which is where the system terminal, i.e. the thing I’ve described above, actually runs in so that we can type and interface with it as humans.

Albeit, as English does, these definitions aren’t always taken as the exact, appropriate, and pedantically correct definitions today. For example, many at Microsoft argue that the console is just the terminal, that the terminal is the console. Sure, ok, that’s fine I can still follow along in the conversation, and this adds context, for when someone steps out of line and uses the more historically specific definition in context of a conversation.

Alright, that’s all groovy, so now we can get back to just talking about the shell, all the power it gives the Unix/Linux/POSIX System user, and touch on the terminal or console as we need to with full context of what these things actually are!

Gnu-bash-logo.svgIntroducing Bash!

Alright, with that little bit of context around Bourne Shell, let’s talk about what we’ve actually got today running as our shell in our terminal on our console on the computers we work with! The Bourne Shell, years later had a replacement written for it by Brian Fox. He released it in 1989 and over the years it became a kind of defacto replacement of Bourne Shell. The term ‘BASH’ stands for Bourne Again SHell.

440px-Bash_screenshotThe Bash command syntax is a superset of the Bourne Shell syntax. It provides a wide range of commands that includes ideas drawn from the Korn shell (ksh) and the C shell (csh) such as command line editing, command history, the directory stack, the $RANDOM and $PPID variables, and POSIX command substitution syntax. If many of those things make you think, “WTF are these variables and such?” have no worries, I’ll get to em’ soon enough in this series!

But with that, this is the beginning of many short entries on tips, tricks, tutorials, syntax, history, and context of bash so until next time, cheers!

References & Collected Materials

Gaining a Systemic View of Immutable Infrastructure Tooling

I put together a few starter notes on things you should delve into and understand before working with infrastructure related tooling, like Ansible, Terraform, or similar tools. If you think I’ve missed any do ping me @Adron and let me know your thoughts on other additions. The first starter items I’d list as the following. Continue reading “Gaining a Systemic View of Immutable Infrastructure Tooling”

Update 1 – I’ll be teaching the Code Fellows Bootcamp and Unix & Git for Everyone

In the coming month there are three courses I’ll be teaching here in the grand city of Portland, Oregon. Two of the courses are one day Unix & Git for Everyone (Jan 31 and Feb 28)  courses and the big course is the Computer Science & Web Development Bootcamp (Feb 2 – Feb 27). So if you’re interested in ramping up and becoming a software developer sooner than later, check out the courses and more on the Code Fellows Site, follow the PDX Code Fellows Twitter or Code Fellows Twitter, and like the Facebook Page.

I’ll have more information about teach, training, mentoring and other projects I have on the cooker over the course of today.

Mac Battles, The Personal Day to Day of Software Development and Morale

I’ve been using a Mac for a couple of months now. My employer purchased a few for us coders to try out, and I’ve become spoiled. I rarely want to use my other machines now, as they seem cumbersome and inefficient. Mainly from a hardware perspective, as the OS itself seems to have plusses and minuses versus Windows 7. But slowly I’m becoming easily as productive, and more, on OS-X as I was on Windows 7. The biggest thing is, OS-X seems to just work the vast majority of the time. In addition, I can dig into parts of it that seem impossible on Windows. In addition, I have almost the entire Unix Ecosystem to play with, which dwarfs the Microsoft Windows Ecosystem by greater proportions than I ever realized. The biggest thing I like about the Mac however boils down to two things:

  1. The Hardware – Simply, the hardware is superb. There is nothing else like it on the market. The single molded body, the touchpad, the keys, everything works better than any laptop I’ve ever used. I’m not saying that as someone that’s used one or two laptops either, I’ve literally used dozens upon dozens of laptops over the years. I regularly try out new ones, and nothing comes close.
  2. The platform OS-X/Linux – Sometimes it may seem like they’re underpowered, this is often a complaint I’ve heard. But considering the efficiencies that OS-X/Unix/FreeBSD/Linux provides, a 4 GB Machine with a simple spindle drive compared to an 8 GB Machine with an SSD running Windows 7 will often perform much better. I have as well as others have benchmarked the Mac Book Pro against multiple Dell Machines, and I’ve seen it done with others, and simply – the operating system gives the Mac an advantage. My suggestion to Microsoft – drop windows and just start building a nice UI on top of a Unix variant like FreeBSD or Linux. It’ll serve Microsoft AND the community better.

I’ll admit, I have installed (not that I currently have it installed) Ubuntu and Windows 7 on the Mac Book Pro (MBP) and windows runs ok, albeit it kills some battery life. Ubuntu runs great, it appears as well as OS-X itself. But even with the others, I’ve primarily just stayed put with OS-X at this juncture. It serves its purpose. In the future, when I purchase a MBP of my own, or even a Mac Air, I will likely run Ubuntu and OS-X on the machine. Setup for Ruby on Rails and lots of JavaScript development.

I know after using this machine, that by the end of the year I will be primarily using Ubuntu and OS-X for almost everything I’m doing – including most likely .NET Development. I however still get the strong feeling that I’ll have a Win7 Machine Floating about and readily available.

As for my morale, it is super high these days building software! A passion indeed. In the future, I’m suspecting about 6-8 months, I’ll have a few announcements regarding improving morale. Until then, cheers!  🙂