Linux Basics Terminal Commands

October 23, 2018 | Views: 14174

Begin Learning Cyber Security for FREE Now!

FREE REGISTRATIONAlready a Member Login Here

Terminal commands: Command Line Interface

What is a command? A command is a software program that when executed on the CLI (command line interface) in the terminal, performs an action on the computer. When you type in a command, a process is run by the operating system that can read input, manipulate data and produce output. A command runs a process on the operating system, which then causes the computer to perform a job.

NB: Commands are CASE sensitive

For example, the ls command displays a listing of information about files.

CLI_ls

Arguments

command [options…] [arguments…]

An argument can be used to specify something for the command to act upon. The ls command can be given the name of a directory as an argument, and it will list the contents of that directory. In the next example, the Documents directory will be used as an argument:

ls_doc

Options can be used to alter the behavior of a command. On the previous page, the ls command was used to list the contents of a directory. In the following example, the -l option is provided to the ls command, which results in a “long display” output, meaning the output gives more information about each of the files listed

ls_l.PNG

Like choosing the letter for long or for reverse. By default the ls command prints the results in alphabetical order, so adding the -r option will print the results in reverse alphabetical order.

ls_I_r

Multiple options can be used at once, either given as separate options like -l -r or combined like -lr. The output of all of these examples would be the same:

ls_l_r_lr.PNG

Printing Working Directory

In order to discover where you are currently located within the filesystem, the pwd command can be used. The pwd command prints the working directory, your current location within the filesystem:

pwd.PNG

This helps you locate which folder you are currently situated in. As seen below you have a view of the file system structure.

linux-filesystem.png

To navigate the filesystem structure, use the cd (change directory) command to change directories.

cd_doc.PNG

Directories are equivalent to folders on Windows and Mac OS. Like these more popular operating systems, a Linux directory structure has a top level. It is not called “My Computer”, but rather the root directory and it is represented by the / character. To move to the root directory, use the / character as the argument to the cd command.

And the ~ character is the home directory for current user as seen below.

cd root.PNG

The .. Characters

Regardless of which directory you are in, .. always represents one directory higher relative to the current directory, sometimes referred to as the parent directory.

The . Character

Regardless of which directory you are in, the . character always represents your current directory. For the cd this shortcut is not very useful, but it will come in handy for commands covered in subsequent sections.

The ~ Character

The home directory of the current user is represented by the ~ character. As stated above, you always begin as the sysadmin user, whose home is located at /home/sysadmin.

Please note this tutorial is incomplete, I hope to squeeze in more time. Hope this helps some guys 😉 
masjter_ZA aka JD out

Resources:
Linux Cheat Sheet Article
Linux Articles by the Cybrary Community

Share with Friends
FacebookTwitterGoogle+LinkedInEmail
Use Cybytes and
Tip the Author!
Join
Share with Friends
FacebookTwitterGoogle+LinkedInEmail
Ready to share your knowledge and expertise?
2 Comments
  1. looking forward to the rest

Comment on This

You must be logged in to post a comment.

Our Revolution

We believe Cyber Security training should be free, for everyone, FOREVER. Everyone, everywhere, deserves the OPPORTUNITY to learn, begin and grow a career in this fascinating field. Therefore, Cybrary is a free community where people, companies and training come together to give everyone the ability to collaborate in an open source way that is revolutionizing the cyber security educational experience.

Cybrary On The Go

Get the Cybrary app for Android for online and offline viewing of our lessons.

Get it on Google Play
 

Support Cybrary

Donate Here to Get This Month's Donor Badge

 
Skip to toolbar

We recommend always using caution when following any link

Are you sure you want to continue?

Continue
Cancel