Common Commands under Linux

Source: Internet
Author: User

1. Delete a folder

Delete a directory in Linux very simple, many people are still accustomed to use rmdir, but once the directory is not empty, it fell into deep distress, now use the RM-RF command can be resolved.
Direct RM is available, but add two parameters-rf that is: RM-RF directory Name
-R is recursive down, no matter how many levels of directory, delete
-F is directly forcibly deleted, without any hint of meaning

To delete a folder instance: rm-rf/var/log/httpd/access
The/var/log/httpd/access directory and all files and folders under it will be deleted

Need to be reminded: Use this RM-RF must be extra careful, Linux does not recycle Bin, once deleted is not recoverable.

Of course, RM has more parameters and usage, and man RM can view the

Delete File Usage instance: Rm-f/var/log/httpd/access.log
This file will be forcibly deleted/var/log/httpd/access.log
2. wget whole Station Download
Because the winter vacation back home no nets, Jekyll manual can not be used online, just want to save it, a page a page Ctrl s too slow, think of the wget command
I used the following code, the entire site to download all down, including CSS and JS
Wget-p-np-k-R http://jekyllcn.com/

The entire site is automatically saved as a jekyllcn.com folder

-P (--page-requisites)

Download all the resources needed to display the entire page, including the embedded image and CSS style files.

-NP (--no-parent)

Downloads only the files in the given directory, not the files in its parent directory, even if there are connections to files in the parent directory on some pages. This is more necessary, if not qualified, would have only wanted to download www.example.com/blog/in the blog post, it is likely that the entire www.example.com have been downloaded.

-K (--convert-links)

This option will fix the links between HTML, CSS, image and other resources after the entire site is downloaded, so that they all point to the downloaded local file, which is suitable for local browsing.

-R (--recursive recursion) specify recursive download. (Specify recursive download)

3. Compress and decompress zip files

Compression:

Zip [parameters] [file name after packaging] [packaged directory path]

linux zip command argument list:

< Span style= "LINE-HEIGHT:31.1111PX; font-size:13px; Font-family: Song body; Color: #000000; " >-a convert the file to ASCII mode
-h Display Help interface
-m after compressing the file, delete the source file
-n a specific string does not compress a file with a specific trailing string
-o set the latest change time for all files in the compressed file to the time of compression
-q Quiet mode, when compression does not show the execution of instructions
-r all subdirectories and files in the specified directory are processed together
-s contains system files and implied files (S is uppercase)
-t date sets the last modified date of the compressed file to the specified date, with a date format of mmddyyyy

Example:
package All files and folders under this directory as Html.zip in the current directory /home/blinux/html/

Zip–q–r   html.zip/home/blinux/html

The above command operation is to compress the absolute address files and folders. The following is a list of compression relative paths
For example, in Bliux this directory, do the following to achieve the same effect.

Zip–q–r Html.zip HTML

Or

Zip–q–r Html.zip *

Extract:

Unzip [parameters] Zip file

Parameter list:

-L List Contents of compressed file-V Show detailed execution process

4 moving files and folders
The command to move the file is MV. Administrator rights required to move files
mv./A./b

The above command assumes that the current path is the parent directory of a B. Move a file or folder under the current directory to the B folder in the current directory

Common Commands under Linux

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.