Introduction to Linux terminal

What is the terminal?

The terminal(which is also known as the shell) is basically a program that takes the commands that you type on your keyboard and and passes them through to the operating system to complete them. Back in the old days this was the only way to interact with computer, there was no way to graphically interact with computers.
Now days though there are GUIs(Graphical User Interfaces) that allow point and click integration with your computer but there is still the CLI(Command Line Interface) and with Linux a lot more can be done using the CLI, which is the terminal.
Linux is heavily reliant on the terminal, most versions of Linux that get released as a server version do not have a graphical interface at all, when you boot into the OS you will go straight into the terminal.

Remember in Linux that everything is case sensitive, this includes directories, files and commands.

Getting help for Linux commands

There are a couple of ways to get help on how to use Linux commands in the terminal.

The MAN pages

The Linux “man pages” are short for manual pages, these pages are the documentation for each command in Linux. They can contain procedural help for the commands and also sometimes tell you why the command was created.
You can access the man pages by typing man then typing the command that you want more information on.

Asking for help

This may sound funny but you can actually ask the terminal for help. To do this you can just type in –help at the end of the command. This will give you information about the syntax and options that can be used with the command.

The internet

The Internet is a great resource(just look you are reading this on the Internet) and there is a wealth of information about Linux on the Internet. There are also heaps of forums and communities that you can join to get free support and also join in on discussions about Linux. Most distros will have a forums section on their website.

Navigation in the Linux terminal

In a graphical environment you will usually have some sort of file manager to view the directories and files but in the terminal you do not, when using the Linux terminal you will need to rely on commands to navigate the file structure.

cd

the command cd stands for change directory. Using the cd command will allow you to change directory. An example of this is “cd /” which will take you to the root directory of Linux.

pwd

The command pwd stands for print working directory which as it sounds shows you what directory you are currently working in.
When you first log into Linux you will start in the “home” directory, by default the home directory is located at /home/, this can be changed though.

ls

The ls command lists all of the files and folders that are in your current working directory. You can also use the ls command to look in a different directory by adding the path to the directory after the ls command.

When you want to change the working directory you can use the cd command. All you need to do is type cd followed by the path of the directory that you want to go to. There are two different ways to do this, the first is by typing the relative path, which is the path from your current directory or you can use a absolute path which begins at the root directory.
When using a absolute path with the cd command you will need to put in a backslash before the path, remember that an absolute path means you are starting at the root directory. When you want to use the cd command with a relative path you can just type in the next folder without the backslash.

cd

the command cd stands for change directory. Using the cd command will allow you to change directory. An example of this is “cd /” which will take you to the root directory of Linux.

Editing, copying, moving and creating

mkdir

The command mkdir is used for making directories, to do this you just need to run the command mkdir then and the folder path to the end.

cp

The cp command is for copying directories or files.

mv

The mv command is for moving directories or files, this will completely remove the file or directly and place it to where you want it.

rm

The rm command is to remove directories or files. This will completely delete them from your hard drive.

Packages in Linux

Software in Linux works different than software in Windows, many of the programs you want to install on Linux you will need to download from “repositories” and use a package manager to install them. While you can compile software from source in Linux, the package managers can handle this for you. There are a number of package managers for the Linux terminal. The two popular ones are apt-get and yum. Both of these will allow you to download and install software from repositories to your Linux system.