About Me

header ads

Linux: 8 Golden tips to better use the terminal


Does not exist Linux distribution that does not require, at least a little, use the terminal. Having good practice and familiarity with the Linux shell is important and the purpose of this article, aimed at novice users maybe, is to provide some suggestions for learning how to better the Linux terminal.

Tab Completion

This is a fundamental trick: it is a great saving of time and is useful if, for example, you are not sure of the exact name of a file or a command. Suppose you have a file with a "very long" and we want to discard it: it may happen that we forget to write as well (such as the lack of \ that is used before each space character). Typing rm and by pressing the button Tab, The shell will automatically complete the filename and if we write the initial of the name of the file to be deleted is if we type anything (in this case we will provide the entire list of files in the folder where we are).

Pipes

The pipes (the character |) Are used to send the output of one command to another command. In the "philosophy" of UNIX, each program runs a small real function. For example, the command ls lists files in current directory and the command grep used to extract something. Combining the two commands, you can find for example the word: ls | grep word

Wild Cards

The asterisk (*) Is a wildcard character with which you can find everything: for example, with the command rm name1 * name2 we can delete all files that start with name1 and end with name2 (Careful not to put an asterisk after rm, which would result in deleting all the files in the folder)

Redirecting output

The character ">" redirects the output of a command to a file instead of another command, for example writing ls > testfile lists the items in that folder in the Print to File.

Command History

We are permitted to have access to the history of the commands used: you can use either the command historyor the arrow keys on the keyboard Highand Low.

 Symbols ~  .  ..

The character ~(Known as tilde) Is the directory homecurrent user: Instead of typing cd/home/username to go into the folder Home, You can type cd ~ (You can also add other links as soon as a /Desktop).

The character . represents the current directory.

The character .. represents the parent directory above the current directory. Also here you can add more links after the dots as /Desktop).

Run a program/command in the background

How to use the terminal while you are performing an operation that blocks its operations Input/Output? For example, if you type firefox to launch the browser Mozilla Firefox, Firefox  gets hold of your terminal until it is closed and will keep him busy. Writing near the Firefox symbol & you can run the command in the background and not lose control of the terminal.

Running conditions

In bash we decide to run two commands one after the other with the condition that the second run only after the first has been completed successfully for this is to write the two commands on same line separated by the symbols &&.

Were you already aware of all these suggestions?

Post a Comment

0 Comments