LPI 1 Article #3- Introduction to LPIC-1 and Linux


Hey there wonderful people. In this sequel of sweet learning Linux and getting nuggets to help you in your LPI Exam, we are going to explore a couple of things by building on the concept learned in the previous post. Herein, we are going to look at more tricks that can be performed at the shell prompt. These are simple ways of performing the common tasks in the shell such as command completion that was described earlier. Let us plunge into some of them in this segment:
History-typing history on the command prompt will list all of the commands you have ever typed in the shell. In case you have just typed a very long command and you intend to use the same command or one similar to it again, then the command can be found in the history command. The command can also be retrieved by just hitting the up arrow key which brings up the commands typed previously. To execute the exact command in the history list, look at its number for example 20 in the history list and type !20 to execute the command in number 20. Also, if you want to execute the last command, you can just type two exclamation marks at the prompt that is

# !!

Searching the reverse history: type Ctrl+R and type the characters that the command possesses. It is convenient because the characters you type can appear anywhere in the command and not necessarily the one beginning it
Searching the forward history: type Ctrl+S and begin typing the characters in the command in question.
Press Ctrl+G to terminate the search
Line movements in the shell: To move the cursor to the start, press Ctrl+A and to move to the end of the line, press Ctrl+E. A combination of Ctrl and the Left arrow key or Right arrow key moves the cursor left and right respectively one word at a time.
Text deletion: to delete the letter or character to the right of the cursor, press Ctrl+D or the Delete key. To delete the character to the right of the cursor, press the spacebar. Pressing Ctrl+K deletes all text beginning from the position of the cursor to the end of the whole line. Pressing Ctrl+U deletes everything from the position of the cursor to the beginning of the line.
Transposing text: if you want to exchange two characters in a word, navigate the cursor to the middle of the two characters and press Ctrl+T and the character to the left and right of the cursor switches places. For example to change word to wrod, the cursor is placed in between r and o and then Ctrl+T is pressed.

Let us get to know just a few basic commands as we build up the momentum of our learning process:
Creating a directory:

# mkdir nameofdirectory

Changing into a directory:
cd pathtodirectory e.g

# cd /home/penchant

Creating a file:

# touch file.txt

More about the touch command will be developed in our later articles.
Listing contents of a directory:

# ls

I hope you have grasped something in this article, thank you for reading and thank you for loving Linux