This course provides a friendly introduction to the commonly used Bourne Again Shell (Bash – Wikipedia, GNU Bash). Bash is the default shell in many popular Linux distributions like Ubuntu, Fedora, or OpenSUSE. You learn how to manage vast amounts of files and folders with ease and how to write small scripts for task automation. The topics, examples, and quizzes covered in this course are motivated by typical tasks encountered by engineers working in the field of computational fluid dynamics (CFD) and related domains.
What is the shell?
The shell in Linux-based operating systems is one of those things that everybody expects you to know to some extent but that nobody really teaches you. In a nutshell, the shell is a program that allows you to send commands to the kernel (the manager) of your operating system. The interaction is text-based: you type some command with your keyboard, press ↵[Enter], and wait for the response. Commonly used synonyms for the shell are terminal or console.
Why should you learn to use the command-line?
If you are used to clicking, dragging, and dropping items using the mouse cursor, getting started with the command-line may seem cumbersome and even annoying at times. It takes time and practice to becomes proficient with this keyboard-centric approach. So why should you bother? The short answer is that knowing the command-line certainly makes you a better, more capable, more efficient engineer/Linux user in the long run. Below I’ve listed my personal top four reasons to learn the command-line:
- Working remotely: sometimes, there is no graphical user interface (GUI) available, and the terminal is the only option to get work done. Examples are performing simulations on high-performance clusters (HPCs), administrating web servers hosting websites, or fetching data from your PC at work without actually going there.
- Task automation: Bash really shines when it comes to automating tasks with ease. Examples are installation scripts, regularly scheduled system backups, or, in general, scripts combing multiple isolated tasks into a workflow. Moreover, the shell is available on any Linux distribution. Creating workflows with Bash does not introduce new dependencies on libraries or programming languages.
- Disaster recovery: unfortunately, it sometimes happens that your GUI stops working and you’re left with the recovery mode, basically with the shell. Such a crash may happen if you have a relatively new graphics card model and you update the driver manually (not using the package manager). Knowing how to fetch the right data from the internet allows restoring a working configuration.
- It’s a kind of magic: often, the shell makes seemingly difficult tasks extremely simple. For example, you can select a subset of files or folders, archive everything, and copy the archive between workstations in a one-line command.
For whom is this course?
This course is most useful for students and professionals who want to learn or brush up their command-line skills. It is particularly tailored towards users who perform simulations on workstations or HPCs, but many of the covered topics are of general use for anybody working with the command-line.
How to take this course?
The course is divided into three parts:
- Part 1 helps you to set up your system and provides an overview of topics covered in the other two parts.
- Part 2 covers essential skills like the file system, navigation, working with files and folder, process management. These skills are a must for everybody working with the command-line.
- Part 3 goes into more advanced topics like regular expressions and shell scripting. Knowledge in these areas helps to get the most out of your Linux operating system, e.g., by automating workflows.
If you have little or no experience with the Linux command-line, I recommend going through the lessons and topics in sequential order. Later lessons in the course build on knowledge covered in preceding sections. If you already have some experience with the command-line, feel free to skip around and to check out topics appearing useful to you.