Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the ways to learn Linux commands by yourself?

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the methods of self-learning Linux commands, which have a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to know about it.

Daily hint

One gradual way to learn the Linux command is to have it display a "daily prompt" each time you open the terminal. This will introduce you to some useful commands and their advanced techniques. Add the following line to .bashrc (/ home/.bashrc):

Echo "Did you know that:"; whatis $(ls / bin | shuf-n 1)

All you have to do is 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, you need to add to .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 work successfully under all Linux distributions.

Use "whatis"

If you don't like learning random commands, maybe you like to learn its usage when using a certain command. At this point, you just need to add whatis in front of it. Whatis will explain the commands you enter one by one.

The whatis sudo yum install cheese example in the figure above clearly tells you:

Sudo gives you administrator privileges.

Yun is the package manager

Install asks YUM to install the software package

Cheese is the software you plan to install. This method does not work well in front of complex or unusual commands. But if you want to know the general purpose of a command, it's worth a try.

Browse all available options for the command

If you are using a new command, there are two ways to see its detailed usage. One way is "man", 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 to quickly look at the main usage of a command-"- help". For example, "cp-help" prints 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!

*, you can learn the syntax of the Linux command here! Understanding the basic syntax of Linux commands is good 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 analyze the above structure in segments:

1. If a command requires administrator privileges (root access) to run, you must precede it with "sudo". This allows the administrator's password to be entered at the point where the command is run.

2. "program" is the name of the application. It includes yum, apt-get, cheese, tar, cp, mv, firefox and so on. Without additional configuration, all commands that can be accessed through this method are placed in the / usr/bin directory. For many programs, you only need to enter their name in the terminal. For example, type "firefox" in the terminal, then press enter, and Firefox will run.

3. You can use different parameters and flags after the program name. Different programs vary greatly in this respect. For example, the command "cp file1 file2" makes a copy of file1 in the directory where it is located and saves it as file2. Here "file1" and "file2" are two arguments to 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 parameter of yum, "cheese" is the parameter of install, and "- y" is the flag of yum-when yum asks you if you want to continue, it always answers "yes" by default. It is important to note that some flags have their own parameters, while others do not. No specific examples will be given here. Each Linux name has its own set of logo settings, which take a long time to master.

Thank you for reading this article carefully. I hope the article "what are the methods of self-learning Linux commands" shared by the editor will be helpful to you. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report