Basic Functions - LINUX: The Ultimate Beginner’s Guide! (2015)

LINUX: The Ultimate Beginner’s Guide! (2015)

Chapter 2: Basic Functions

To help you get the most out of Linux systems, let’s discuss the basic things that you can do with them.

How to Log In, Activate the Interface, and Log out

You need to provide login credentials (i.e. username and password) before you can use Linux directly. This OS requires you to verify your identity and access rights every time you start it. At this point, you’ll learn about the two basic modes of running a Linux system.

Graphical Mode

This is considered as the default mode for desktop computers. You’ll know that you are using the graphical mode if the computer screen is asking you to enter your username and password.

To sign in, just enter your login credentials in the appropriate boxes. Then, press “Enter” or hit “OK”.

After entering your login information, it might take a few minutes before the system gets started, depending on your computer’s processing power. Once the computer is done loading, you will have to open an xterm (i.e. x is the name of your supporting software) or terminal window. You’ll find this tool by clicking on “Applications” and choosing “Utilities”. Some Linux distributions have a shortcut icon to access the xterm window.

Here’s an example of a terminal window:

This window serves as your control panel for the operating system. Almost all of the procedures are done using this powerful tool. In general, terminal windows must display a command prompt as soon as you open them. The terminal window given above has a typical prompt, which shows the person’s username and some data about the performed updates.

To log out using this mode, you should close all of the open programs and terminal windows. Afterward, click on the logout icon or search for the “Log Out” option in the main menu. Closing all the windows and applications isn’t really required, and the computer can do that on your behalf. However, session management may retrieve all the open programs and windows once you log in again: this process takes longer and produces undesired effects.

Once the screen asks you for your login credentials, you’ll know that you have logged out successfully.

Text Mode

You’ll know that you are using the text mode if the entire screen is black, with some characters on it. This mode’s login screen usually displays some data about the computer you are using, the name of the computer, and a prompt that you can use to sign in:

This is different from the graphical mode, in that you need to press the “Enter” key after typing in your username (there is no clickable link or button on the screen). Then, type your password and hit “Enter” again. Basically, you won’t see any sign that you are typing something, not even a dot. This feature is typical on Linux systems and is implemented for security purposes.

Once the system accepts you as a legitimate user, you will get more data, known as “message of the day.” Some distributions even have a “fortune cookie” feature that provides wise/unwise (it depends on you) thoughts. Then, the system will give you a shell, explained with the same details that you will get in the graphical mode.

To log out from the system, you can just type “logout” and press “Enter.” You’ll know that you have logged successfully if the screen asks for your login information.

Now that you know how to log in and log out from the operating system, you are ready for the basic commands.

The Basics

The Basic Commands

In this section, you’ll learn about the quickstart commands (also known as quickies). You need these commands to use Linux.

· “Is” – Shows a set of files in the directory you are currently using. This is similar to the “dir” command in DOS systems.

· “passwd” – This command changes the password of the current user.

· “pwd” – This shows the current working directory.

· “cd directory” – This changes the directories.

· “man command” – This reads man pages on “command.”

· “logout or exit” – This allows you to leave the current session.

· “info command” – This reads Info pages on “command.”

· “file filename” – This shows the file type of the file named “filename.”

· “apropos string” – This searches for strings using the what is database.

General Remarks

You will type the following commands after the initial prompt, in the text mode, or in an xterm window. Press “Enter” on your keyboard after typing these commands.

In general, you can issue commands by themselves (e.g. the “Is” command). A command will behave differently if you will specify an option, which is often introduced by a dash (e.g. “Is –a.” The option character can have different meanings for other commands. GNU programs accept long options, introduced by two dashes (e.g. “Is –all”). Certain commands don’t have options.

An argument to a command is a specification for the object on which you want to apply the command. Let’s use this example: “Is /etc.” For this situation, the /etc directory is the argument for the “Is” command. This argument shows that you like to view the contents of that particular directory, rather than the default, which will be the contents of the active directory, gathered by typing “Is” and hitting “Enter.” Certain commands need arguments.

If you want to know whether a command accepts options and/or arguments, you may check the operating system’s online help file. This will be discussed later.

Similar to Unix systems, Linux uses forward slashes to separate directories. This method is also used for URLs.

How to Use the Bash Features

Bash, the default GNU shell for most Linux systems, allows you to use certain key combinations to perform tasks quickly and easily. Here are the commonly used features of the Bash shell. If you want to maximize the benefits of using Linux, you should learn how to use these key combinations.

· Tab – This completes the command or filename. If there are multiple options, the system will inform you using an audio or visual notification. If there are too many possibilities, on the other hand, the system will ask you if you want to check all of them.

· Tab Tab – It shows the completion possibilities for commands or filenames.

· Ctrl + A – This moves the cursor to the start of the current command line.

· Ctrl + C – This ends an active computer program and shows the prompt.

· Ctrl + D – This will log you out of the current session. This key combination is similar to typing logout or exit.

· Ctrl + E – It moves the cursor to the end of the current command line.

· Ctrl + H – This is similar to pressing the backspace key on your keyboard.

· Ctrl + L – This clears the current terminal.

· Ctrl + R – This searches the command history.

· Ctrl + Z – This allows you to suspend computer programs.

· Arrow Right/Arrow Left – These keys allow you to move the cursor along the current command line. You can use these keys to add characters at other parts of the line.

· Arrow Up/Arrow Down – These keys allow you to browse the system’s history. Access the lines you need to repeat, change data if needed, and press the “Enter” key to execute commands quickly.

· Shift + Page Up/Shift + Page Down – These key combinations allow you to check the terminal buffer.

How to Get Help

This section of the book will teach you how to get the information you need. You should check the tips and instructions included here before asking other people. As a Linux user, you should be self-reliant.

The Manual Pages

Many beginners fear the manual (also called “man”) pages, since they contain an overwhelming amount of information. However, they are completely structured, which means you will be able to use them quite easily.

Reading the manual pages is often done using an xterm window (if you are using the graphical mode), or in the simpler text mode. Type the following command at the prompt, then hit “Enter.”

yourname@yourcomp `> man man

The documentation for the manual will be shown on your screen once you press the “Enter” key.

Use the spacebar to view the next page. If you want to see the previous page, you can use the b-key. Once you reach the final page, the manual will often quit and you will get the prompt again. If you want to leave the manual pages before reaching the last page, or if the program doesn’t close automatically, you can type “q” and hit “Enter.”

More Information

The Information Pages

Aside from the manual, you can also use the Info pages to learn more about the system. Use the info command to access the Info pages of your OS. These pages hold updated information and are simpler to use. The manual pages for certain commands point to the Info pages.

To get started, open a terminal window and type info info:

You should use the arrow keys to browse through the page and control the cursor along a line that starts with an asterisk. If it contains the keyword you want to learn about, hit the “Enter” key. You may use the “N” and “P” keys to go to the next or previous subject. The spacebar will show the next page, regardless of whether it opens a new subject or an information page. To close the info page, you can just type “q.”