Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

rm(1) [bsd man page]

RM(1)							      General Commands Manual							     RM(1)

rm, rmdir - remove (unlink) files or directories SYNOPSIS
rm [ -f ] [ -r ] [ -i ] [ - ] file ... rmdir dir ... DESCRIPTION
Rm removes the entries for one or more files from a directory. If an entry was the last link to the file, the file is destroyed. Removal of a file requires write permission in its directory, but neither read nor write permission on the file itself. If a file has no write permission and the standard input is a terminal, its permissions are printed and a line is read from the standard input. If that line begins with `y' the file is deleted, otherwise the file remains. No questions are asked and no errors are reported when the -f (force) option is given. If a designated file is a directory, an error comment is printed unless the optional argument -r has been used. In that case, rm recur- sively deletes the entire contents of the specified directory, and the directory itself. If the -i (interactive) option is in effect, rm asks whether to delete each file, and, under -r, whether to examine each directory. The null option - indicates that all the arguments following it are to be treated as file names. This allows the specification of file names starting with a minus. Rmdir removes entries for the named directories, which must be empty. SEE ALSO
rm(1), unlink(2), rmdir(2) 4th Berkeley Distribution April 29, 1985 RM(1)

Check Out this Related Man Page

rmdir(1)						      General Commands Manual							  rmdir(1)

rmdir - Removes a directory SYNOPSIS
rmdir [-p] [-s] directory... STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: rmdir: XCU5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. OPTIONS
Removes all directories in a path name. For each directory argument, the directory entry it names is removed. If the directory argument includes more than one path name component, effects equivalent to the following command occur: rmdir -p $(dirname directory) That is, rmdir recursively removes each directory in the path name. OPERANDS
The path name of an empty directory to be removed. DESCRIPTION
The rmdir command removes a directory from the system. The directory must be empty before you can remove it, and you must have write per- mission in its parent directory. Use the ls -al command to see if a directory is empty. If a directory and a subdirectory of that directory are specified in a single invocation of rmdir, the subdirectory must be specified before the parent directory so that the parent directory will be empty when rmdir tries to remove it. RESTRICTIONS
A directory must be empty before you can remove it, and you must have write permission in its parent directory. If the -p option is used, all directories in the path must be empty except for the directory being recursively removed. EXIT STATUS
The following exit values are returned: Each directory specified by directory operand was successfully removed. An error occurred. EXAMPLES
To empty and remove a directory, enter: rm mydir/* mydir/.* rmdir mydir This removes the contents of mydir, then removes the empty directory. The rm command displays an error message about trying to remove the directories . (dot) and .. (dot dot), and then rmdir removes them. Note that rm mydir/* mydir/.* first removes files with names that do not begin with a (dot), then those with names that do begin with a (dot). You may not realize that the directory contains file names that begin with a (dot) because the ls command does not normally list them unless you use the -a option to see the files whose names begin with a (dot). To remove all of the directories in the path name a/b/c, enter: rmdir -p a/b/c Use a command like this one if directory a in the current directory is empty except that it contains a directory b and a/b is empty except that it contains a directory c. ENVIRONMENT VARIABLES
The following environment variables affect the execution of rmdir: Provides a default value for the internationalization variables that are unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the internationalization vari- ables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non-empty string value, overrides the values of all the other internationalization variables. Determines the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multibyte characters in arguments). Determines the locale for the for- mat and contents of diagnostic messages written to standard error. Determines the location of message catalogues for the processing of LC_MESSAGES. SEE ALSO
Commands: mkdir(1), ls(1), rm(1) Functions: rmdir(2), unlink(2), remove(3) Standards: standards(5) rmdir(1)
Man Page

Featured Tech Videos