How to use the Linux ar command

Source: Internet
Author: User

The Linux ar command is used to create or modify a file to be kept, or to extract files from the file to be kept.

Ar allows you to collect a large number of files into a single file. All member files keep their original attributes and permissions.

Syntax

Ar [-dmpqrtx] [cfosSuvV] [a <member files>] [B <member files>] [I <member files>] [keep files] [member files]

Parameters:

Required parameters:

  • -D. Delete the member files in the keep file.
  • -M: change the order in which member files are stored.
  • -P: displays the content of the member file in the file.
  • -Q will append the user to the end of the file to be kept.
  • -R: Insert the file into the storage file.
  • -T displays the files contained in the kept files.
  • -X Saves the member files in your own files.

Option parameters:

  • A <member File> Insert the file into the specified member file in the keep file.
  • B <member File> before inserting a file into a specified member file in the kept file.
  • C. Create and keep documents.
  • F. To prevent too long file names from being compatible with ar commands of other systems, you can use this parameter to cut down the names of long member files to be placed in the files.
  • I <member files> before you insert a specified member file in the kept file.
  • O preserve the date on which files are kept.
  • S if the file to be kept contains the object mode, you can use this parameter to create a symbol table for the file to be kept.
  • S does not generate a symbol table.
  • U only inserts new files with a specified date into the keep file.
  • Detailed information is displayed when the v program is executed.
  • V displays the version information.

Instance

Package files

Root@w3cschool.cc ~ # Ls // display the current directory file a. cb. c d. c install. log qteanaconda-ks.cfg c. c Desktop [root@w3cschool.cc ~] # Ar rv one. bak. c B. c // package. c B. c file ar: creating one. baka-. ca-B. c [root@w3cschool.cc ~] #

Package multiple files

Root@w3cschool.cc ~ # Ar rv two. bak *. c // package. file ar ending with c: creating two. baka-. ca-B. ca-c. ca-d. c [root@w3cschool.cc ~] #

Display package content

Root@w3cschool.cc ~ # Ar t two. bak a. cb. cc. cd. c [root@w3cschool.cc ~] #

Delete the member file of the package.

Root@w3cschool.cc ~ # Ar d two. bak a. c B. c. c [root@w3cschool.cc ~] # Ar t two. bak d. c

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.