bash devops linux shell scriptAll modern linux distributions are shipped with a built-in desktop environment that allows the user to feel ‘at home’ even when trying linux for the first time. Despite this fact, if you want to start going deep in learning how *nix systems work, sooner or later you will meet the linux shell  (and never leave it anymore, probably), that, in fact, is the place where the magic really happens.

Similarly to windows command line, linux shell allows you to interact with the system by inputting commands in a manual way ~ yes, only with keyboard! ~ and send input to it.

You can think of the linux shell as a tool that allows you to execute commands, whatever they are, run other programs, define variables etc.

Why do I need this linux shell sorcery?

Well, first of all because desktop environments don’t usually let the user go so deep into configurations and system settings.  Even if they did, there are some tasks that forcibly require a ‘low level’ access, because you just can’t handle them by clicking histerically on your mouse.

In addition to this, the flexibility of commands is too strong to just ignore it, you can create monster commands to process logs, files, processes and so on.

On top of everything there’s an added value: scripting

By combining multiple commands, using logical constructs, cycles and conditional statements, you can create little ‘programs’ that do whatever you want to do in an automated way.

So, to answer the initial question: because with linux shell you can:

  • Automate repetitive tasks
  • Access settings that are not easily accessable via GUI
  • It’s super. Period.

How many shells are out there?

Well, there are many, and every single of them has particulare implementations, but being honest, in a way or another they are very similiar to each other.

Most used linux shell are:

  • BASH
  • ZSH

Let’s give a brief look to them and their capabilities.

Bash – Bourne again shell

Bash is the most widespread and used linux shell. It is the one that you can find in almost all base distro installations and it is the official shell of the GNU project.

Some of the features that are included in bash are:

  • You can use aliases, for shortening command names
  • Key bindings to setup custom key sequences
  • You can run commands in background or foreground (job control)
bash linux script shell devops

Csh/Tcsh – C like shell (and its improved version)

Csh is very similar to bash, but in addition to the already mentioned features, it offers:

  • Spelling correction
  • You can program completion of file names and strings you type
  • C-like shell programming syntax
shell linux devops docker

Zsh – An hybrid that take the best of previous shell

Zsh takes the best of bash and tcsh and puts it into a single shell with the plus that it is extensible thanks to the framework “Oh my zsh!” (website) that allows you to customize almost every aspect of the shell.

The core features are:

  • History sharing between sessions
  • Theming and customization
  • Spelling correction
  • Folder shorcuts are namable
zsh linux shell devops

So…which one should I choose?

Well you don’t have to choose one in particular, you could try every shell you want and then decide which one best fits your needs. Or you could just have all of them installed on your system and just switch between them, bash when outside is cold, zsh when it rains and csh when you feel lazy, why not?

Hope you enjoyed this post, let me know what is your preference!