How to use the Linux mktemp command

Source: Internet
Author: User
Tags custom name

A temporary file created by mktemp for use by shell scripts.

Syntax

Mktemp [-qu] [file name parameters]

Parameters:

  • -If an error occurs during q & A execution, no information is displayed.

  • -U branch temporary files will be deleted before mktemp ends.

  • [File name parameter] the parameters of the custom file name must be in the format of "custom name. XXXXXX.

Instance

When you use the mktemp command to generate a temporary file, the file name parameter should be given in the form of "file name. XXXX". mktemp will create a temporary file based on the file name parameter. Enter the following command at the command line prompt:

Mktemp tmp. xxxx # generate a temporary file

After using this command, you can use dir or ls to view the current directory and get the following results:

Cmd @ cmd-desktop :~ $ Mktemp tmp. xxxx # generate a temporary file cmd @ cmd-desktop :~ $ Dir # view the current directory file test testfile testfile1 tmp.3847 # tmp.3847 is generated

The generated temporary file is tmp.3847, where "XXXX" in the file name parameter is replaced by four randomly generated characters.

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.