Basic shell guide, for linux newbies
[ shell , guide ]

Table of Contents

  1. Welcome to my attempt into making a good CLI guide…

Welcome to my attempt into making a good CLI guide…

When I started into the Linux world, especially talking about the command line, I’ve found pretty hard to find a good guide to all the basics that I needed to know. So, I’m here to do ( or at least try to) make a simple guide with some stuff about the command line, giving you a good startpoint into it.

First of all, some terminology that you’ll need to know

Here is what you’ll see when you fire up a terminal and consequently, a shell:

# this is a comment, that I'll be using to guide you along this guide.
[user@hostname $] <-- The prompt, where you enter commands
# On this guide, I'll short the prompt to:
[$] (because is a lot easier to type)

And finnaly, the The Most Important Thing That You’ll Read On This Guide1 you have to always be willing to read documentation and official manuals when encontering a problem or struggling to learn something. Don’t go around annoying others for help. Some common things when having issues include:

Following this simple steps, and principally, effectively learning while you search for solutions, you’re going to improve and learn better and faster than any other way, like seeing an 2 hour tutorial on youtube.

Now, without futher ado, let’s get closer to your shell

How do a shell work?

Basically, your shell allows you to run commands on terminal, and even arrange them using operators for scripting purposes. However, your shell has access only to binaries that are located in your $PATH. To discover which folders are part of your $PATH you can run the following command:

[$] echo $PATH

Shell configuration

Bash configuration can be easily done by just modifying a file called .bashrc, that can be found on your $HOME directory (which is /home/{your-username}, but you can check that using echo $HOME ). In this file, you can change a lot of stuff on your shell, from changing his appearance to creating aliases and changing environment variables. On zsh, the configuration file can be found on the same place than .bashrc, while on fish is located at $HOME/.config/fish/config.fish

Most shells has a system-wide config, located at /etc, but It’s completely not recommended to change that file instead your local one.

Autocomplete

All shells has built-in autocomplete, so, instead typing a long folder/program name, you can just type a few words and press tab key, then you shell is going to auto-complete the rest of the name for you. If there is more than one possibility, your shell is going to show you all of them, so you can choose which one do you want.

Some global simple aliases

.. is an alias for the parent folder of the directory you’re currently working on, while . is a alias for the folder that you’re currently occuppying. You can use these aliases to save some time typying the entire path to a folder. ~ is a alias to your $HOME directory2, so, instead of typing /home/{your-username}/path/to/a/file, you can simply type ~/path/to/a/file

Footnotes

1 Always rembember: RTFM = Read The Fuc**** Manual!

2 As explained Here.