Linux mktemp command
Linux mktemp command is used to create a temporary file.
A staging file mktemp established for shell script use.
grammar
mktemp [-qu][文件名参数]
Parameters:
- -q If an error occurs when executed, it will not display any information.
- -u staging file before the end of mktemp first deleted.
- [Filename argument] filename parameter must form "a custom name .XXXXXX" of.
Examples
When using the mktemp command generates a temporary file name parameter should be "File name .XXXX" aproach, mktemp creates a temporary file based on the file name argument. At the command prompt, enter the following command:
mktemp tmp.xxxx #生成临时文件
After using this command, you can use dir or ls to see the current directory, the following results were obtained:
cmd@cmd-desktop:~$ mktemp tmp.xxxx #生成临时文件 cmd@cmd-desktop:~$dir #查看当前目录 file test testfile testfile1 tmp.3847 #生成了tmp.3847
Thus, the temporary files generated for tmp.3847, where filename parameter "XXXX" is replaced by four randomly generated characters.