Introduction: The Linux Terminal

Although Linux operating systems are not the most popular in the world, it is very popular in use of running networks for small or large companies so knowing how to use it is very important for anyone in the IT field. Using the Linux terminal is much quicker and gives more freedom than the GUI so learning how to use it is very useful.

Step 1: Basic Commands

To use the terminal there are some very basic commands that need to be learned.

cd - Changes the current directory. cd .. brings you to the home directory, and for any other directory just type either the full path to the directory or just type the name of the directory you want to enter if it is in the current directory.

touch - Creates a file with the specified name in the current directory.

mv - Takes a specified file and moves it to a new specified position and can be given a new name. This command is used to rename files.

clear - Clears all text out of the terminal.

ls - Lists all the files in the current directory.

mkdir - Creates a new directory in the current directory with the specified name.

rm - Deletes a specified file or directory.

Step 2: User Permissions and Chmod

When using user permissions there are 2 important things to know. The first is the different types of accounts that are given permissions. They are split into three main categories: User, Group, and Other users be represented by U, G, and O respectively. The other important thing to know is what permissions each type of account can be given. They are Read, Write, and Execute and can be represented by either R, W, and X or 4, 2, and 1 respectively. Knowing this there are two ways to use the chmod command. The first was is by adding or taking away a permission from only one account type at a time. It looks like this:

chmod u+r File Name

The command is followed by the account type and then a + or - depending on if the permissions are being added or removed, the permission being changed, and then finally what file it is happening to.

The other way the command is used is when changing the permissions of all of the different account types at one time. It looks like this:

chmod 764 FileName

The command is followed by three numbers, each representing what permissions the specific account type has, and all followed by the file name. Each of the numbers is equal to the sum of the values of the permissions it has. So if it has read and write, it would have 6, only execute, it would have 1, and with no permissions it would have 0.

Step 3: Scripts

Scripts are incredibly useful when working with Linux command prompt. They can be used to automate many tasks and prevent user error. Scripts are created by creating a file with the .sh extension. Then you type the commands you want to run into the file, and you have created a script. To run a script, type into command prompt: bash FileName. This will run the script. Some basic commands used in scripts are:

echo - Prints out the following text

if/else - Basic logic commands.

read - This allows user input. The user can type in something and this command will read and save what is typed in.

Also all commands that are used in the terminal normally can still be used in a script such as clear, ls, and cd.

Step 4: Encryption

File security is something that is very important with all the security problems in the current day. Luckily enough Linux has a built in command that can encrypt files for you. This is the gpg command and can be used to encrypt any files. It does not delete the original file though so make sure to delete that after. Because all this can be tedious, a script can be written that does all this for you so all that needs to be done by the user is run the script and type in the file name. This is an example of this type of script:

echo "Welcome, I am ready to encrypt a file/folder for you"

echo "Enter the Exact File Name with extension"

read file;

gpg -c $file echo "I have encrypted the file successfully..."

echo "Now I will be removing the original file"

rm -rf $file