|
If you want to become a Linux expert, then master some Linux commands are essential. The following are four methods of self-learning Linux commands.
Daily Tip
A progressive way to learn Linux commands is to display the Daily Tip every time you open a terminal. This will introduce you to some useful commands and their advanced usage tips.
In. Bashrc (/home/.bashrc) Add the following line:
Echo "Did you know that:"; whatis $ (ls / bin | shuf -n 1)
You just need to add this line is enough! If you want to make it more entertaining, you can install cowsay. Installing cowsay on Ubuntu / Debian:
Sudo apt - get install cowsay
Install cowsay under Fedora:
Yum install cowsay
In addition to installing cowsay, also need to. Bashrc added:
Shuf -n 1 | cut -d.-f1) $ (whatis $ (ls / bin) 2> / dev / null | shuf -n 1)
However, the above method of using cowsay does not work well for all Linux distributions.
Using "whatis"
If you do not like learning random commands, perhaps you like to use a command to learn when its usage. Then you just need to add whatis in front of it. Whatis interprets the commands you enter, piece by piece.
Whatis sudo yum install cheese example clearly tells you:
1) sudo is to allow you to have administrator privileges;
2) yun is the package manager;
3) install is to let YUM install the package;
4) cheese is the software you intend to install.
This approach does not perform well before complex or infrequent commands. But if you want to know the approximate purpose of a command, this method is worth a try.
Browse all available options for the command
If you are using a new command, there are two ways to view its detailed usage. One way is "man < program>", where < program> is the name of the program you want to run. For example, "man cp" in the man file browser to tell you the detailed use of cp.
Another way to see the main use of a command faster - "-help". For example, "cp -help" prints a large number of cp commands in the terminal. In other words, the -help option has the same meaning in all Linux commands.
Crash course - yes, now!
Finally, you can learn the syntax of Linux commands here! Understanding the basic syntax of the Linux command is useful for understanding the command, it is worth learning.
All Linux commands have the same structure:
[Parameter] [parameter] [- flag] [parameter] [- flag] [parameter] ... [flag] [parameter]
Let me break down the above structure:
If a command requires administrator privileges (root access) to run, it must be preceded by "sudo". This allows the administrator to enter the password for the run command.
"Program" is the name of the application. It includes yum, apt-get, cheese, tar, cp, mv and firefox and so on. All commands that can be accessed in this way are placed in the / usr / bin directory if not configured additionally. (Note: By default, programs in other directories can also be run like / bin ). For many programs, you only need to enter their name in the terminal. For example, in the terminal, type "firefox", and then press the Enter key, Firefox will run up.
Behind the program name, you can use different parameters and flags. Different procedures in this regard vary widely. For example, the command "cp file1 file2" in the directory where file1 copy and save it as file2. Here, "file1" and "file2" are two parameters of the command "cp". Some commands also change their behavior by using different flags. For example, the "install" in the command "sudo yum install cheese -y" is the yum parameter, "cheese" is the install parameter, and "- y" is the yum flag - when yum asks you whether to continue, Answer "yes". Note that some flags have their own parameters, while others do not. Here is not given a specific example. Each Linux name has its own set of flag settings, master these needs a long time accumulation.
to sum up
Learning Linux commands is not difficult - once you are determined and mastered the basic structure of Linux commands. But generally learn a few hours will not play a significant effect, then please do not give up. Repetition is the best way to learn. All you have to do is to reinforce your memory with constant practice. |
|
|
|