Learn about Linux commands-general Linux technology-Linux technology and application information. For more information, see the following section. 1. How do I delete non-empty directories?
Is rmdir used? No,
# Rm [your directory]-rf
It means to force Delete the Directory and all files in the directory. Try it and it will definitely work.
But do not use it as needed. It will be deleted without any prompt.
While rmdir can only delete empty directories.
In addition, only
# Rm [your directory]-r
2. Compression-decompression command Overview
Tar.gz, which is common
Decompress: tar zxvf FileName.tar.gz
Compression: tar zcvf FileName.tar.gz DirName
Are you still worried about the unzipping of a large number of compressed files?
3. How can I create and delete a file whose name starts with "-" using the command line?
Let's create a file named "-test"
# Touch-test
Touch: The Date Format "est" is invalid.
# Touch ---test
# Rm-test
Rm: Invalid option -- t
Please try "rm -- help" to get more help
# Rm -- test
Haha, did you find that you can operate normally only when you add "--"?
4. What should I do if I only want to display part of the file information after typing the ls command?
Maybe you will check the help ls -- help
However, so many combinations are really annoying.
But don't worry.
Because we have gawk
Look at this: ls-l | gawk '{printf $9 }'
Let's see what the output is.
Is it true that only file names are pulled?
If I want something else, add a $ x (x is a character between 1 and 9) after printf)
Actually, gawk is a scripting language. It has very powerful functions. You are interested in reading relevant reference books.
5. You can perform related operations on the linux service.
Chkconf
6. Run the rpm command to install and uninstall the software.
There are 10 basic RPM models: installation, query, verification, and deletion.
Installation mode: rpm? I [installation options] <软件包>
Query mode: rpm? Q [query options]
Verification Mode: rpm? V or? Verify [verification options]
Delete mode: rpm? E <软件包>
7. tee command
This command is powerful in that it reads data from the standard input device, outputs its content to the standard output device, and saves it as a file.
For example, if we want to output the inputfile content of a file to the terminal and save it as outputfile1 and outputfile2, we can do this:
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