Record the useful terminal tools under Linux

Source: Internet
Author: User
Tags imagemagick

1, using wget crawl site

For example, I want to crawl all the contents of www.isi.edu/nsnam/ns/tutorial, then enter

Wget-r-p-np-k-E http://www.isi.edu/nsnam/ns/tutorial

Then wget will crawl all the content in the www.isi.edu/nsnam/ns/tutorial and store it in the current path according to the site's storage structure.

2, using rename batch modification file suffix name (extension)

The theme Pack (themepack format) downloaded from the Microsoft Web site cannot be processed by the Archive Manager by default (but I can open and decompress using 7zip under Windows), but changing the extension to zip will open and decompress. Use the following command to modify the extension name of all. Themepack compressed files in this directory to. zip:

Rename ' s/.themepack/.zip/'./*

3. Use eNCA to convert all SRT subtitle files under the folder to UTF-8 code:

Enca-l zh_cn-x UTF-8 *.srt

In addition several usages of the eNCA are supplemented:

Enca-l ZH_CN filename Check the encoding of the file

Enca-l zh_cn-x UTF-8 filename Converts the file encoding to "UTF-8" encoding

Enca-l zh_cn-x UTF-8 filename1 filename2 If you do not want to overwrite the original file

Bulk convert all txt files in the current directory:

Find./-name ' *.txt '-exec enca-l zh_cn-x UTF-8 {} \;

4. Use PDFTK to operate the PDF file.

For more operations see: http://www.pdflabs.com/docs/pdftk-man-page/

(1) A.pdf is a book of all odd pages, b.pdf for all the even pages of the book, the following command can be combined two pdf into a page of normal book C.pdf:

PDFTK Shuffle a.pdf b.pdf output c.pdf

(2) Merging a.pdf and b.pdf into c.pdf:

PDFTK a.pdf b.pdf Cat Output C.pdf

or (using wildcards, all PDF files in the catalog will be merged):

PDFTK *.pdf Cat Output C.pdf

(3) Remove page 10th from A.pdf and create c.pdf:

PDFTK a.pdf cat 1-9 11-end output c.pdf

(4) A.pdf from page N to c.pdf:

PDFTK a.pdf cat N Output c.pdf

(5) Split the a.pdf into a single page document:

PDFTK A.pdf Burst

The a.pdf will be divided into a bunch of PDFs from pg_0001.pdf to the last page in the current directory.

(6) Rotate the a.pdf 5th page 90 degrees clockwise to generate C.pdf:

PDFTK a.pdf cat 1-4 5east 6-end output c.pdf

(7) Rotate the entire a.pdf document 180 degrees to generate C.pdf:

PDFTK a.pdf cat 1-endsouth Output c.pdf

5. Use Find to bulk delete soft links

Find-type L-delete [PATH]

If you want to delete an invalid soft link, execute the

find-l [PATH]-type L-delete

7. Use the Find batch to modify the directory under a certain format file permissions

For example, I would like to change all the TXT files in the directory to be non-executable, so as to avoid the always prompt "xxxx is an executable text file":

Find./-name ' *.txt '-exec chmod 644 {} \;

7, using ImageMagick batch conversion of the picture size under the catalogue

The first thing you need to install is imagemagic:

sudo apt-get install ImageMagick

Then, execute the following command:

Find < path >-name ' < file name > '-exec convert-resize length pixel x width pixel {} {} \;

8, using CONVMV and 7z to solve the Windows compressed files under Linux open garbled

We need 7zip and CONVMV. To see if the installation (Debian Department):

Dpkg-l | grep p7zip

Dpkg-l | grep CONVMV

If not installed, the Debian system is installed using the following command:
sudo apt-get install p7zip-full p7zip-rar CONVMV

Assuming that the zip file is named Abc.zip, then assuming that it is placed under a specific directory ~/abczip, execute the

CD ~/abczip
Lang=c 7z x Abc.zip
Convmv-f cp936-t utf8-r--notest *

Record the useful terminal tools under Linux

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.