rm

remove files 

Command, KornShell Built-in


SYNOPSIS

rm [-fiqRrv] [-d|s] file ...


DESCRIPTION

rm removes each specified file argument (provided that it is a valid path name). If you specify either . or .. as the final component of the path name for a file, rm displays an error message, and moves onto the next file. If you specify a file you do not have write permission for, rm asks you for confirmation. Type the yes expression defined in LC_MESSAGES (the English expression is typically y or yes) if you really want it deleted.

Options

-d 

delays the removal of the specified files until the system is rebooted. This option and the -s option are mutually exclusive.

This option relies upon the underlying operating system's capability to perform the action at reboot time.

-f 

deletes read-only files immediately, without asking for confirmation. When you specify this option and a file does not exist, rm does not display a warning message and does not modify the exit status. If you specify both -f and -i, rm uses the option that appears last on the command line.

-i 

prompts for confirmation (from standard input) before deleting each file or confirmation before entering a subdirectory if either the -r or -R option is specified. If you specify both -f and -i, rm uses the option that appears last on the command line.

-q 

suppresses warning messages. Error messages are still displayed. When you specify this option and a file does not exist, rm does not display a warning message but it does modify the exit status.

-R 

recursively removes the entire directory structure if file is a directory.

-r 

is equivalent to -R.

-s 

saves the file for undeletion if possible. An attempt is made to put the file in the Recycle Bin and if this attempt fails then the file is quietly deleted. This option and the -d option are mutually exclusive.

-v 

prints file names to standard output as they are being processed.


DIAGNOSTICS

Possible exit status values are:

0 

Successful completion.

1 

Failure due to any of the following:

— inability to remove a file
— tried to remove directory without specifying -r or -R
— inability to find file information when using -r or -R
— inability to read directory when using -r or -R
2 

Failure due to any of the following:

— invalid command line option
— no files specified


NOTE

rm is provided as both an external utility and a built-in MKS KornShell utility.

rm -f used to display a useage message and exit with a failure. A change to IEEE Std 1003.1-2008 'POSIX.1' requires rm -f to silently exit with status zero.


PORTABILITY

POSIX.2. x/OPEN Portability Guide 4.0. All UNIX systems. Windows 8.1. Windows Server 2012 R2. Windows 10. Windows Server 2016. Windows Server 2019. Windows 11. Windows Server 2022.

The -d, -q, -s, and -v options are extensions to the POSIX standard. The -d and -s options are only available on Windows.


AVAILABILITY

PTC MKS Toolkit for Power Users
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
PTC Windchill Requirements and Validation


SEE ALSO

Commands:
cp, mv, pending, rmdir, sh


PTC MKS Toolkit 10.4 Documentation Build 39.