Tuesday, 13 May 2014

Don't Fear the Dark


Terminal


If your heart races and feel an overwhelming urge to run screaming in the opposite direction should you see the above image on your computer, you might be suffering from terminal illness.  Ba dump bump. (A little 'nux geek humor for you.) Terminal being the correct word to describe the little black box that enables a Linux user to issue commands to the computer and otherwise interface directly with the operating system (OS).  

Although terminal is a fundamental facet of using a Linux box, you can probably get away with not having to use it, but quite frankly, I don't know why you would want to because for (1) If you are that squeamish, then you should return to Windows, and, (2) terminal is the best part of using the OS. To use a motor vehicle analogy, terminal is the difference between driving stick versus automatic. The former enabling the user to fully maximize the experience versus passively chugging along content to let the motor make all of the decisions.

That being said, let's get comfortable and try out terminal with some basic commands.

Start An App

Whereas in Windows, launching a program is performed by either finding it in the Start menu or double-clicking on the shortcut on the desktop (assuming there is one), however, in Linux, you can start an app such as Firefox, which comes pre-installed in most Linux distros.

Open a terminal window by pressing CTRL + ALT + T. 

Type in terminal:

firefox

Then hit enter.

After a brief pause,the browser will open. Contrary to the herd of Linux users, Firefox is not my preferred browser.  Google Chrome and/or the free open source version Chromium is, but installing either is another lesson.

Now that Firefox has been launched, close it out and let's try to not only open the browser but also include a web page while we're at it.

Type in terminal:

firefox greensleevesbikinit.blogspot.com

[Note:  There is a space between the x and g.] Then hit enter.

Don't be alarmed if Firefox takes its sweet time to open.  (This is yet another reason why I won't use it.)

Telling Linux What To Do

Although I've said that you could probably get away with not using terminal, the fact is, it is a very big part of operations are performed there, so get used to it.

Let's take a look at how the file system works, shall we?

In terminal, type in pwd, which stands for print working directory.  (BTW, we're not actually printing anything.)

When you do, you will see something similar to the following:

/home/name of your login

This is the directory where terminal is currently located.  To see what directories are there, type in the letters 

ls

Then hit enter.

This will list everything in your home directory usually containing: 

Desktop
Documents
Downloads
Music
Pictures 
Videos

We need to grasp the concept of flags before we continue. Flags are options that are attached to a command to extend it to accomplish another task at the same time.  For example, when you typed ls, you could have also included the flag -a to include all.

ls -a

Hit enter.  

When you do this, you will see the same folders you did above, but now included will also be folders that begin with a dot.

A single dot denotes a hidden file.  These are not displayed by default for the same reason Windows does not display hidden files in Windows Explorer.  (You wouldn't want to give a live grenade to a chimp, would you?)  Actually, I'm kidding.  In Linux, you run as a superuser rather than root (Administrator) by default to protect you from yourself. 

Changing Directories

If you type cd in terminal, nothing will happen.  The cursor will bounce to another line and blink at you waiting for a flag so type the following:

cd /usr/bin

Then hit enter.  [Note: there is a space between the d and forward slash /].

Now we're in /usr/bin.  To see which folders are located there type in:

ls

Make sure you exit this terminal and open another before attempting the next section.

Updating Linux

This is an action that you should always perform before installing any programs just to make sure you have the latest & greatest drivers.

In terminal, type in:

sudo apt-get update

Then hit enter.  Make sure you have a space between the o and a.  

Type in your password.  Linux won't let you proceed until you do.

Incidentally, if you're wondering what sudo means, it stands for superuser do.

Let terminal do its thing.  When it finishes updating quit terminal by typing in the word exit and hitting enter.

Now that you have a basic understanding of terminal, study this tutorial of commands and keyboard shortcuts to help familiarize you with your system.

Remember: Linux is supposed to be fun so don't stress if you can't remember everything.  The more time you spend with the OS, the more you will retain. Learn a few basics and bookmark the tutorial for future reference.

©2014 Greensleeves and GreensleevesBikinIt.  Unauthorized use and/or duplication of this material without express and written permission from this blog's author and/or owner is strictly prohibited.  Excerpts and links may be used, provided that full and clear credit is giving to Greensleevs and GreensleevesBikinIt with appropriate and specific direction to the original content.

No comments:

Post a Comment

Comments that do not comport with standard etiquette will be held indefinitely in the queue.

Note: only a member of this blog may post a comment.