Introduction to Linux/Unix Tutorial

This tutorial aims to give our user base a better understanding of how to get around in the so called Unix/Linux (and other similar UNIX based distros) command line interface also known as the terminal or shell. If you are new to this subject matter, here you will learn some basic commands look, and how they function in order to help you navigate around and manipulate the various directories and files.


Since the terminal is the primary way to interact with a web server it is quite nifty to know how to use the shell. At first it may seem like a difficult task, but after you familiarize yourself with the basics it should be a breeze for you to work with the command line interface.

 

Things you will need for the following tutorial:

 

A web server or a PC that you can use as a guinea pig for your experiments(do at your own risk as there you are the root user meaning that you have full access).

A terminal emulator (if you go with the option of performing your experiments on a web server). A terminal emulator is an application that allows you to emulate the server’s terminal through your current PC(this is of integral importance for you to be able to communicate with the server).

 

Here are the most popular terminal emulators for the according OS:

 

 

  • Mac OS X - Terminal, iTerm 2
  • Windows - PuTTY
  • Linux - Terminal, KDE Konsole, XTerm


Each of the mentioned above applications has some unique features to it but all will be sufficient for the job that we need them for.

 

The Shell

 

In the Unix based OS the shell is the command-line interface that interprets your commands and shell scripts(files with commands that are executed as one) and guides the server’s operating system with processing them. There is a plethora of different shells for the unix based OS. Ther’s the Bourne shell, the Bourne again shell (bash) the C shell (csh) and so on. Every shell has its own unique set of features and rules on how to handle and interpret the commands, but they all feature the input and output redirection, variables manipulation, and conditions testing.


For this tutorial we will be using the Bourne-Again shell (bash), which is the default shell for the majority of Linux distributions.


The Command Prompt


The first thint that you will see when you login to a server, is that you will normally be greeted by the server’s MOTD (message of the day), which is an utomatic informational message which consists of side information sucha as the version of the Linux distribution that the server is running. After that, you will be conversing with the commands prompt, or shell promt, which is the place where you give commands to the server.

 

Here’s an example what you will see in the shell prompt:
 

example@s1 [~]#


A dissection of the example above:


example – the current user
@s1 – the hostname of the server
~ - the current directory. In bash the ~ symbol means that you are located in the current user’s home directory. In the example case this is /home/example/
# - the # symbol signifies the end of the shell prompt, after which is the user’s keyboard input.

The root user – the root user also referred to as super user is a special user that can perform all the available administrator functions. There are no restrictions for the root user, every task can be executed from the root user. For short we will call the root user just root in this tutorial.