8 tips make you a superb Linux end user

  
. Using a Linux terminal is more than just entering commands. After learning these basic techniques, you will gradually master the Bash shell, the terminal tool that is used by default on most Linux distributions. This article is written for inexperienced novices, and I believe that most advanced users already know all of these techniques. However, you can still look at it and maybe learn something you have always overlooked. Tab key auto-completion
Using Tab key auto-completion is the basic technique. It saves you a lot of time, and it's useful when you're not sure how a file name or command is spelled.
For example, if you have a file in the current directory, the file name is "really long file nam", you want to delete this file. You can enter the entire file name, but you have to be careful to enter the wrong space character (requires \\escape). If you type ”rm r” and press the Tab key, Bash will automatically complete the file name for you.
Of course, if you have a lot of files in the current directory that start with the letter r, Bash won't know which one you are referring to. For example, in the current directory, you have another text called “Really very long file name”. When you press the Tab key, Bash will be added to the “really\\” section because both files start with this. . Then, press the Tab key and you will see a list of all files that match the beginning, as shown below.


then enter the file name you want and press the Tab key. In this way, when we lose “l” then press the Tab key, Bash will automatically complete the file name we want.
This method is also applicable to input commands. When you are not sure what the command you want is, just remember to start with ”gnome”, enter “gnome” then press the Tab key and you will see all possible results.
Pipeline Commands
Pipeline commands allow you to transfer the output of one command to another. In the Unix design philosophy, each program has only a few features. For example, the “ls” command will display a list of all files in the current directory, and the ”grep” command will search for the input string in the place where it was created.
Pass the two through the pipeline command (with “| & Rdquo; notation) together, you can search for a file in the current directory, the following command to search & ldquo; really & rdquo;





wildcard asterisk ”*” is a wildcard that matches anything. For example, if we want & rdquo; really long file name & ldquo; and & rdquo; really very long file name & ldquo; are deleted from the current directory, we can use the following command:


this command to delete all Really starts with a file ending with name. If you use the ”rm *” command, all files in this directory will be deleted, all of which should be used with caution.

output redirection
& ldquo;> & rdquo; characters can output the results of a command is redirected to a file, without the need for additional use another command. For example, the code below uses the ”ls” command to list all files in the current directory and enter the output list into a file named ”file1“ instead of just outputting it on the terminal.




command line history
Bash history will remember you used commands. You can use the up and down keys to scroll through the commands you have used. Using the ”history” command will print out the history commands, so you can use the pipeline command to search for the commands you have recently used. .


~, & ..
tilde & rdquo; ~ & rdquo; represents the current user's home directory. So, you can use ”cd ~” to switch to your home directory without typing ”cd /home/name”. This is also used for relative paths, such as “cd ~/Desktop” will switch to the current user's desktop directory.
Similarly, ”.” represents the current directory, ”..” represents the parent directory. All, & rdquo;cd ..” will jump to the parent directory. This is also valid for relative paths. For example, if you are in the Desktop directory and you want to switch to the Document directory at the same level as the Desktop directory, you can use the ”cd ../Documents” command.


running in the background command
case, Bash will run your command in the current terminal by default. Normally there is no problem, but what if you want to run an application at the same time and continue to use the terminal? For example, if you type "Firefox" command to run Firefox, Firefox will occupy your terminal and display some Output error messages etc. until you close it. But add a & rdquo; & & rdquo; symbol in command behind Bash will run the program in the background:




conditional execution
You can also run with two Bash Commands, one after the other. The second command will only run after the first command has successfully run. To do this, separate the two commands in the same line with ”&&”.
For example, the ”sleep” command accepts a parameter in seconds, then counts down, allowing the end. This command has no use when used alone, but you can use it as a delay before running the next program. The following command will stop for 5 seconds and then run the gnome screenshot tool:


Copyright © Windows knowledge All Rights Reserved