How beginners learn Linux system command operations

  

For beginners, the learning of Linux commands is not so simple. Many beginners rarely use commands or do not know how to use commands. In fact, Linux commands are very important. I will give you a detailed introduction to how beginners learn Linux system command operations.

Beginners to learn Linux system command operation skills

First, daily tips

A progressive method of learning Linux commands is: open the terminal each time When, let it display “Daily Tips”. This will introduce you to some useful commands and their advanced use techniques.

Add the following line to .bashrc (/home/.bashrc):

echo “Did you know that:”; whatis $(ls /bin |  Shuf -n 1)

You only need to add this line! If you want to make it more entertaining, you can install cowsay. Install cowsay under Ubuntu/Debian:

sudo apt-get install cowsay

Install cowsay under Fedora:

yum install cowsay

In addition to installing cowsay, Need to be added in .bashrc:

cowsay -f $(ls /usr/share/cowsay/cows |  Shuf -n 1 |  Cut -d. -f1) $(whatis $(ls /bin) 2》/dev/null |  Shuf -n 1)

However, the above method of using cowsay is not successful under all Linux distributions.

Second, use “whatis”

If you don't like to learn random commands, you may like to learn how to use it when using certain commands. At this time you only need to add whatis in front of it. Whatis will explain the commands you entered one by one.

The above example of whatis sudo yum install cheese clearly tells you: 1) sudo is for you to have administrator privileges; 2) yun is package manager; 3) install is for YUM installation Package; 4) cheese is the software you plan to install. This method does not perform well before complex or unusual commands. But if you want to know the approximate purpose of a command, this method is worth a try.

Third, all available options for browsing commands

If you are using a new command, there are two ways to see its detailed usage. One way is "man "Program"", where "Program" is the name of the program you want to run. For example, “man cp” will tell you the detailed usage of cp in the man file browser.

Another way to get a quicker view of the main usage of a command is ——“ -help”. For example, “cp -help” will print out a lot of usage of the cp command directly in the terminal. In other words, the -help option has the same meaning in all Linux commands.

Four, crash course & mdash; — yes, now!

Finally, you can learn the syntax of Linux commands here! Understanding the basic syntax of Linux commands is good for understanding commands. It is worth learning.

All Linux commands have the same structure: [sudo] program [parameter] [parameter] … [parameter] [-flag] [parameter] [-flag] [parameter] … [flag] [parameter]

Let me analyze the above structure in sections:

1. If a command requires administrator privileges (root access) to run, then it must be preceded by "ld" ;sudo”. This makes the password of the administrator entered in the run command.

2.“program” is the name of the application. It includes yum, apt-get, cheese, tar, cp, mv and firefox. If there is no additional configuration, all commands that can be accessed by this method are placed in the /usr/bin directory (Translator's Note: By default, programs in other directories can also be run like this, such as the command under /bin ). For many programs, you only need to enter their name in the terminal. For example, type ”firefox” in the terminal and press Enter, Firefox will run.

3. After the program name, you can use different parameters and flags. Different programs vary greatly in this regard. For example, the command “cp file1 file2” copies it in the directory where file1 is located and saves 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 command "sudo yum install cheese -y" is the parameter of yum, <;cheese” is the parameter of install, “-y” is the yum flag —— when yum asks if you When you continue, you will always answer “yes”. It should be noted that some flags have their own parameters, while others do not. No specific examples are given here. Each Linux name has its own set of logo settings, and mastering these takes a long time to accumulate.

Copyright © Windows knowledge All Rights Reserved