Four ways to teach yourself Linux commands

Source: Internet
Author: User
Tags root access

If you want to be a Linux player, mastering some Linux commands is essential. Here are four ways to teach yourself Linux commands.

Daily Tips

One progressive way to learn a Linux command is to have it display the daily tip every time you open the terminal. This will introduce you to some useful commands and their advanced usage techniques. In. BASHRC (/HOME/.BASHRC), add the following line:

echo "Did you know that:"; Whatis $ (Ls/bin | Shuf-n 1)

All you have to do is increase the 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, you need to add 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 approach to using Cowsay is not successful under all Linux distributions.

Use "Whatis"

If you don't like to learn random commands, you might like to learn how to use them when using some kind of command. You just need to add whatis in front of it. Whatis will explain the commands you have entered.

The Whatis sudo yum install cheese example clearly tells you:

    • sudo is for you to have administrator privileges;

    • Yun is the Package manager;

    • Install is to have the Yum installation package;

    • Cheese is the software you plan to install. This is not a good way to perform before complex or uncommon commands. But if you want to understand the general purpose of a command, this method is worth a try.

Browse all available options for a command

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 quickly see the main usage of a command-"-help". For example, "Cp-help" will print out a large number of uses of the CP command directly 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 a Linux command is useful for understanding commands and is worth learning.

All Linux commands have the same structure: [sudo] program [parameter] [parameter] ... [Parameter] [-flag] [Parameter] [-flag] [Parameter] ... [Flag] [Parameter] Let me dissect the above structure in sections:

1, if a command requires Administrator privileges (root access) to run, then you must precede it with "sudo". This allows the administrator's password to be entered in the Run command.

2, "program" is the name of the application. It includes yum, apt-get, cheese, tar, CP, MV and Firefox, among others. If there is no additional configuration, all commands that can be accessed by this method are placed in the/usr/bin directory (translator Note: By default, programs in some other directories can run as well, such as commands under/bin). For many programs, you only need to enter their name in the terminal. For example, if you enter "Firefox" in the terminal, and then press ENTER, Firefox is up and running.

3, after the program name, you can use different parameters and flags. Different procedures vary widely in this regard. For example, the command "CP file1 file2" copies a copy and saves it as file2 in the directory where File1 is located. The "File1" and "file2" Here are the two parameters of the command "CP". Some commands also change their behavior by using different flags. For example, "Install" in the command "sudo yum install cheese-y" is the yum parameter, "cheese" is the install parameter, "-Y" is the Yum flag-when Yum asks if you want to continue, it will answer "yes" by default. It is important to note that some flags have their own parameters, while others do not. No concrete examples are given here. Each Linux name has its own set of flags, which takes a long time to accumulate.

Summarize

Learning Linux commands is really not difficult-once you've made up your mind and mastered the basic structure of Linux commands. However, the general study for several hours does 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 strengthen your memory through constant practice. There are many resources to learn about Linux commands, such as the Linux command Quick Check table, the 40 important Linux commands, and the Linux command QuickStart.

Original link: Danny stieben translation: Geek Van-the trail is empty

Link: http://www.geekfan.net/6603/


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.