The coolest single-line command in Centos

Source: Internet
Author: User
1. switch back to the previous Directory. the cd-horizontal bar represents the path of the previous Directory. the built-in variable $ owd2 is used to replace the original style of the command ^ foo ^ bar ^ in the previous command. it should be !! : Gs/foo/bar /!! Indicates to execute the previous command again and use: gs/foo/bar to replace it. 3. quickly back up a file

1. switch back to the previous directory.

cd -

The horizontal bar indicates the path of the previous directory.

-It is actually a built-in variable $ owd.

2. replace a phrase in the previous command

^foo^bar^

The original style of this command should be

!!:gs/foo/bar/

!! Indicates to execute the previous command again and use: gs/foo/bar to replace it.

3. quickly back up a file

cp filename{,.bak}

Braces are an arrangement. you can try the following example:

echo {a,b,c}{a,b,c}{a,b,c}

Lists all the three output sets.

aaa aab aac aba abb abc aca acb accbaa bab bac bba bbb bbc bca bcb bcccaa cab cac cba cbb cbc cca ccb ccc

4. clear or create a file

:>file.txt

: It is an empty function that exists by shell by default.

5. reset
If you accidentally cat a binary file, it is very likely that the entire terminal will be dumb, it may not wrap the line, it will not be able to display it back, and there will be a lot of garbled code, etc, you can run the reset command to restore the system to normal regardless of whether the command is displayed or not.

6. more friendly display of the currently mounted file system

mount |column -t

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.