The command line interface will either be from a terminal or a SSH window like putty. Here is an example of the Gnome terminal (Applications/Accessories/Terminal from the menu). You can see that it is only text but it does have a menu system for modifying the color of the screen and text or allowing you to open multiple terminals at one time.
If you login from a putty session from a Windows machine or if you are logged into a TTY session on the Linux box you will not have the option of a terminal and so you will be using text only as there will be no menus or graphics of any kind. Text is exactly the same as you can see in the next example. The biggest difference is that it will typically be a black screen with white text.
As you change users the prompt will show the change in user as you can see from these examples:
As you change to different servers the hostname will change. The hostname is a name that is applied to a server so that users and applications may refer to the server with a name and not an IP Address. An example would be of a hostname of ub instead of the IP Address 192.168.5.43. As you connect to different servers or workstations, this name will change. These names can be anything the system administrator would like to assign.
As you change locations in the file system the location will change. The ~ symbol indicates that a user is located in their home directory. The home directory in Linux is located in a directory, Windows calls them folders, labeled /home. So if fred is in his home directory he is really located in /home/fred. Each user has a home directory named for the user. If fred changes location in the directory system to /var, his prompt will reflect that change.
If mary changes to the /usr/share directory it will reflect that change.
If tom changes to the /usr/bin directory it will reflect that change.
And finally if jane moves to the / directory it will reflect that change.
Changes in location in the file system will list the location in the prompt. It is important that you use this as a clue to location especially when you begin to issue commands.
What is a shell?
A shell is a program that acts as an intermediary between the user and the Linux kernel. The shell receives commands from the user through typed words and passes them into the kernel for processing. The kernel has the ability to communicate with hardware and gather resources like files and memory. The most common shell is bash.
History of Shells
The first shell was created by Steven Bourne in 1979 and was a part of UNIX version 7. C shell was developed as an alternative by Bill Joy of the University of California at Berkley. This shell was part of the Berkley Software Foundation Distribution (BSD), which is still popular today. The C shell functions much like C programming so users who have a background in C tend to gravitate in this direction. The Korn shell is based on a combination of the Bourne and C shells. Each of these shells have advantages and are popular in use.
The GNU project created a completely free shell called the Bash shell. It received the name from Bourne Again shell since it was based on the Bourne shell. The bash shell was written originally by Brian Fox in 1988. Bash has become the standard shell for Linux and is the default of most Linux distributions.
You can access the shell from a terminal. Open a terminal and type:
This should show you which shell you are using, like so.
The procedure for interacting with bash is:
Here is an example of listing the contents of a home directory:
The command is ls and that command acts upon the directory
Here is another example:
In this example the command touch, which creates an empty file, interacts with the system by creating the file text.
In addition to commands and arguments there are also options that are available to commands. Here is an example of the ls command with the -a option which lists all files even the hidden ones.
ls -a /home/mike
Options usually require the – before the option and the option is typically one letter.
Users may use multiple options in the same command. Here is an example using ls and two options -a for all files and -l for long listing of the output.
ls -la /home/mike
You do not need to add a – for each option, one for the entire list of options is OK.