Four methods to learn Linux Commands

Source: Internet
Author: User
If you want to become a Linux expert, it is essential to master some Linux commands. The following are four methods to learn Linux commands. A progressive method to learn Linux commands is to display daily prompts every time you open the terminal. This will introduce you to some useful Linux Commands

If you want to become a Linux expert, it is essential to master some Linux commands. The following are four methods to learn Linux commands.

Daily prompt

A progressive method to learn Linux commands is to display a "daily prompt" every time you open the terminal ". This will introduce you to some useful commands and their advanced usage skills.
In. BashrcMedium (/Home/. bashrc) Add the following line:

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 in Ubuntu/Debian:

sudo apt-get install cowsay

Install cowsay under Fedora:

yum install cowsay

In addition to installing cowsay, you also need to add the following 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 does not run successfully in all Linux distributions.

Use "whatis"

If you do not like to learn random commands, you may like to learn their usage when using a command. In this case, you only need to add whatis in front of it. Whatis will explain the commands you entered one by one.

OfWhatis sudo yum install cheeseThe example clearly tells you: 1) sudo gives you administrator privileges; 2) yun is the software package manager; 3) install is to allow YUM to install the software package; 4) cheese is the software you plan to install. This method does not work well before complicated or uncommon commands. However, if you want to know the general purpose of a command, this method is worth a try.

Browse all available options of commands

If you are using a new command, you can view its usage in two ways. One way is toMan <程序>", Where <程序> 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 is to view the main usage of a command faster-"-help ". For example,Cp-help"Will directly print out a large number of usage of the cp command 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 Linux commands is very helpful 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 segments:

  1. If a command can run only with the administrator permission (root access permission), you must add "sudo" before it ". This allows you to enter the administrator password when running the command.
  2. "Program" is the name of the application. It includes yum, apt-get, cheese, tar, cp, mv, and firefox. Without additional configuration, all commands that can be accessed using this method are stored in the/usr/bin directory: by default, programs in other directories can run like this, for example, commands in/bin ). For many programs, you only need to enter their names in the terminal. For example, Enter "firefox" in the terminal and press Enter to run Firefox.
  3. After the program name, you can use different parameters and flag. Different programs vary greatly in this regard. For example, the command"Cp file1 file2In the directory where file1 is located, copy it and save it as file2. Here, "file1" and "file2" are two parameters of the "cp" command. Some commands also use different labels to change their behavior. For example, the command"Sudo yum install cheese-y"" Install "is the yum parameter," cheese "is the install parameter, and"-y "is the yum flag-When yum asks if you want to continue, "yes" is answered by default ". Note that some flags have their own parameters, while others do not. Here we will not give a specific example. Each Linux name has its own set of logos. it takes a long time to master these settings.
Summary

Learning Linux commands is really not difficult-once you have made up your mind and mastered the basic structure of Linux commands. However, learning for a few hours usually does not play a significant effect. please do not give up. Repetition is the best way to learn. What you need to do is to strengthen your memory through continuous practices. There are many resources to learn Linux commands, such as the quick query of Linux commands, 40 important Linux commands, and a quick start to Linux commands.

Translated by Danny Stieben

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.