What you need to know to use a Linux system

Source: Internet
Author: User

Using Linux terminals is more than just typing commands. By learning these basic techniques, you'll get a grip on the bash shell, the terminal tool that is used by default on most Linux distributions.

This article is written for inexperienced beginners, and I believe most advanced users already know all of these techniques. But you can still look at it and maybe learn something you've been ignoring for a long time.

TAB key Auto-complement

Using the TAB key for automatic completion is the basic technique. It can save you a lot of time, and it's also useful when you're not sure how to spell a filename or command.

For example, in the current directory you have a file, the filename is "really long file Nam", and you want to delete this file. You can enter the entire filename, but you have to be careful with the wrong spaces (you need to escape). If you type "RM r" and then press TAB, Bash will automatically complete the file name for you.

Of course, if you have a lot of files in the current directory that start with the letter R, Bash will not know which one you are referring to. For example, the current directory, you have another name called "really very long file name", and when you press the TAB key, bash will fill the "really" section, because all two files start with this. Then, press the TAB key and you'll see a list of all the files that match the start.

Then type in the file name you want and press the TAB key. This way, when we lose "L" and press the TAB key, Bash automatically complements the file name we want.

This method is also true for input commands. When you're not sure what the command you want, just remember to start with "gnome" and then press the TAB key, and you'll see all the possible results.

The pipe command allows you to transfer the output of a command to another command. In the design philosophy of UNIX, each program is only a few fewer features. For example, the "LS" command displays a list of all the files in the current directory, and the "grep" command searches for the input string where it is made.

Put the two through the pipe command (with "|") Symbol), you can search for a file in the current directory, and the following command is used to search for "really":

ls | grep really

Wildcard characters

The asterisk "*" is a wildcard character that can match anything. For example, if we want to delete "really long file name" and "really very long file name" from the current directory, we can use the following command:

RM Really*name

This command deletes all files that start with really and end with name. If you use the "rm *" command, all files in the directory will be deleted, all of which need to be used with caution.

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.