Menu Close

Ubuntu Linux Basic Shell Operations

This article talks about the basic operations that can be used in the Ubuntu Shell, which provides a basis for all future commands.

For more on this subject, please refer to the SOC Table of Contents.

 

*In order to follow along to this tutorial, you will be required to have Ubuntu 16.04.01 already installed on your Virtual Machine using Oracle’s VirtualBox. Because this tutorial is geared towards Ubuntu 16.04.01, using other versions may have differences between the execution of commands.

 

Basic Shell Operations

Shell is a command line terminal application that takes in user commands and executes them. It is essentially the terminal command line.

All Shell commands have the following format:

command -options [argument]

Where command is the name of the Shell command, options is one of the options of the command, and argument concerns the parameters of the command.

Note that Shell commands can be run with or without arguments.

We will now use the command ls as an example, and run the following three commands:

ls
ls -l
ls /usr

We can see that the command ls lists all folders and files under a certain directory, while ls -l did the same, but also listed the details, which included information such as size, author, and date. For ls /usr, it did the same as ls, but it listed all of the folders and files under the /usr directory.

Due to the sheer number of Shell commands, Shell has an autofill function. This can be achieved by simply pressing the [Tab] key on your keyboard.

When you use [Tab] to autofill, there will be one of three situations that happen.

  1. You typed in enough characters such that there can only be one possibility, so it automatically fills in the command upon pressing tab.
  2. You typed in some characters so that there are a few possibilities. The system would issue a warning beep upon the first tab press, and would display the possible commands after tab is pressed a second time.
  3. You typed in insufficient characters so that there are too many possibilities. The system would issue a warning beep upon the first tab press, and would tell you how many possible commands there are upon the second tab press. It will then ask you if you would like to continue for it to display the possible commands or not. If you choose yes, all of the possible commands will be displayed. If you choose no, you will return to typing in the command.

Here, after typing in ifc, because there is only one command that starts with ifc, pressing tab would auto-fill the command.

If we only typed in if before hitting tab, however, it would issue a warning sound, and would display the following if tab is pressed again before returning what you previously typed.

If we only typed in i before hitting tab, it would issue a warning sound and display the following if tab is pressed again.

Upon pressing y, it would display a list with the –More– option if there are more options to choose from. You may press [Enter] to display more.

 

Posted in Textbook and Training Project

Related Articles

Leave a Reply

Your email address will not be published.

Leave the field below empty!