YouTip LogoYouTip

Linux Comm Mktemp

# Linux mktemp Command [![Image 3: Linux Command Reference](#) Linux Command Reference](#) The Linux mktemp command is used to create temporary files. mktemp creates a temporary file for use in shell scripts. ### Syntax mktemp **Parameters**: * -q If an error occurs during execution, no information will be displayed. * -u The temporary file will be deleted before mktemp exits. * The filename parameter must be in the format "custom_name.XXXXXX". ### Example When using the mktemp command to generate a temporary file, the filename parameter should be given in the form "filename.XXXX". mktemp will create a temporary file based on the filename parameter. Enter the following command at the command prompt: mktemp tmp.xxxx #Generate temporary file After using this command, you can use dir or ls to view the current directory, and you will get the following result: cmd@cmd-desktop:~$ mktemp tmp.xxxx #Generate temporary file cmd@cmd-desktop:~$dir #View current directory file test testfile testfile1 tmp.3847 #Generated tmp.3847 As can be seen, the generated temporary file is tmp.3847, where the "XXXX" in the filename parameter has been replaced by 4 randomly generated characters. [![Image 4: Linux Command Reference](#) Linux Command Reference](#)
← Linux Comm MoreLinux Comm Mdir β†’