Beginners Guide To The Bash Terminal
What if I told you that if you give me on an hour of your time I can empower you with all the basic commands you’ll need to start using BASH-like a boss? Would you bother to take the time or would you be too afraid to try? The BASH terminal can be quite intimidating for someone who is just starting out. There you are with a blank window, a prompt and a blinking cursor, just waiting for you to type something… What should you type? Where do you begin and how can you actually get useful work done with nothing more than a keyboard and plain text? Only computer whiz kids and rocket scientists can use this archaic technology, right? You’ll never be able to learn this! Wrong. You don’t have to be a genius to use the terminal. All you need to do is to master a few basic commands.
LEARN BASH IN ONE NIGHT!
I set about to create a video where I would give new users a “crash course” in the Linux command line. Pretty much every Linux distribution comes with BASH as the default shell so that’s what I talked about. BASH is a shell. A shell is a program that wraps around the heart of any operating system which is called the kernel. It interprets humanly reachable text into more cryptic kernel level systems calls that tell the hardware what to do. BASH is also a very powerful programming language. There are lots of great tutorial videos on YouTube about BASH already but they tend to be broken down into several parts and watching an entire series is not something one can do in one evening.
I will give folks the basics and show them where they could find help within BASH to learn how to do more complex things without having to open a web browser or crack open a book. The video is about an hour and fifteen minutes long. It doesn’t cover every option or detail but anyone who pays attention and takes a few notes should be well on their way to becoming confident enough with the command line to move on to more complex tasks.
WHY BOTHER WITH BASH?
Those who don’t understand the awesome power of BASH tend to wonder why anyone would type when they could just point and click. They may even go so far as to say that terminal users are just plain crazy. If you’re not writing code or working with servers then why bother learning the terminal? Modern noob-friendly Linux distributions come with full featured desktop environments that provide tools to do most anything you can think of with a computer by pointing and clicking. Isn’t typing in command a huge step back? No! It’s actually the gateway to innovation and opens up a whole new world of possibilities. You see, GUI interfaces tend to make easy tasks easier while a command line makes difficult tasks possible.
Linux doesn’t hide anything from you. You have access to every part of the system and you can modify it to do whatever you need it to. There are thousands of configuration options. Most of the configurations are stored in text files that are surprisingly easy to read and understand once you get the hang of working with them. There’s no way all of the options could ever be programmed in GUI applications.
BASH also offers the ability to write scripts. A script can be anything from just a few commands to a very complex program. Basically, anything you can type at a command line can be put into a script and run as a program. This is very useful when you find yourself typing in a series of commands to get something done over and over again. Just throw it into script and then it happens with just one command. Now, are you begging to see just how powerful the terminal can be?
Another intriguing aspect of BASH is the fact that it has become a universal way to interact with a computer. It doesn’t matter what OS it’s running, either. A BASH Terminal is now available in Windows 10, it has always been available in Mac X OS and it goes without saying that BASH is native to any Unix or Linux machine out there. This means that someone who has a good understanding of BASH basics can interact with just about any computer they sit down in front of and be right at home.
THE COMMANDS COVERED IN THE VIDEO
The biggest challenge for me in creating this “crash course” was to figure out the bare minimum of commands one would need to actually get useful work done. I’m sure that some who are long-time BASH users would most likely come up with a few more or may think some of them weren’t necessary but that would be an endless debate as everyone uses this technology in their own unique way. That is one of the most wonderful things about it too. It’s flexible and there’s seldom only one way to to get something done. Whatever works for you is perfectly OK. Here’s the list of what I came up with:
ls - list directory contents pwd - print name of current/working directory cd - change working directory pushd/popd - put the working directory on a stack file - determine the file type locate - find files by name updatedb - update database for locate which - locate a command history - display bash command history
whatis - display the on-line manual descriptions apropos - search the manual page names and descriptions man - an interface to the on-line reference manuals
WORKING WITH FILES
mkdir - create a directory/make directories touch - change file timestamps/create empty files cp - copy files and directories mv - move (rename) files rm - remove files or directories rmdir - remove empty directories
cat - concatenate files and print on the standard output more/less - file perusal filter for CRT viewing nano - command line text editor
sudo - execute a command as the superuser su - change user ID or become another user users - print the usernames of users currently logged in id - print real and effective user and group IDs
CHANGING FILE PERMISSIONS
chmod - change permissions of a file
KILLING PROGRAMS AND LOGGING OUT
Ctrl+C - kill a running command killall - kill processes by name exit - log out of bash
Ctrl+D - signal bash that there is no more input Ctrl+L - redraw the screen Ctrl++ - make text bigger in terminal emulator Ctrl+- - make text smaller in terminal emulator