Original author(s) | Ken Thompson, Dennis Ritchie (AT&T Bell Laboratories) |
---|---|
Developer(s) | Various open-source and commercial developers |
Operating system | Unix, Unix-like, DOS, MSX-DOS, FlexOS, OS/2, Windows, ReactOS, KolibriOS |
Platform | Cross-platform |
Type | Command |
In computing, rmdir
(or rd
) is a command which will remove an empty directory on various operating systems.
The command is available in Unix (e.g. macOS, Solaris, AIX, HP-UX), Unix-like (e.g. FreeBSD, Linux), DOS, Digital Research FlexOS, [1] IBM OS/2, [2] Microsoft Windows [3] or ReactOS [4] operating systems. On MS-DOS, the command is available in versions 2 and later. [5] DR DOS 6.0 also includes an implementation of the rmdir
command. [6]
It is also available in the open source MS-DOS emulator DOSBox and in KolibriOS. [7] The numerical computing environments MATLAB and GNU Octave include an rmdir
function with similar functionality. [8] [9]
Normal usage is straightforward:
$ rmdirname_of_directory
where name_of_directory corresponds with the name of the directory one wishes to delete. There are options to this command such as -p in Unix which removes parent directories if they are also empty.
For example:
$ rmdir-pfoo/bar/baz
will first remove baz/, then bar/ and finally foo/ thus removing the entire directory tree specified in the command argument.
rmdir will not remove a directory if it is not empty in UNIX. The rm
command will remove a directory and all its contents recursively. For example:
$ rm-rfoo/bar/baz $ rm-rffoo/bar/baz
Normal usage is identical to Unix-like operating systems:
>rmdir name_of_directory
The equivalent command in MS-DOS and earlier (non-NT-based) versions of Microsoft Windows for deleting non-empty directories is deltree
.
In later version of Windows:
>rd /s directory_name
Windows based on the NT kernel (XP, Vista, 7, 8, Server 2003/2008) are case insensitive, just like their earlier predecessors, unless two files of the same name and different case exist. Then case sensitivity applies when selecting which file to use, or if the case does not match either file, one may be chosen by Windows.
Having two files named the same with different case sensitivity is allowed either when Windows Services for Unix is installed or when the Windows Registry settings are set to allow it.
An example of the security risk is:
Using rd/rmdir and two directories with the same name and different case sensitivities exist, one of which contains valid data and/or programs, and the other contains incriminating materials and/or malware. If rd/rmdir gets executed without regard to case sensitivity and Windows chooses the legitimate folder to delete, the only folder left is the undesired one. Windows then uses this folder instead of the previously legitimate one to execute programs, and one may be led to believe it contains legitimate data.
The cd
command, also known as chdir
, is a command-line shell command used to change the current working directory in various operating systems. It can be used in shell scripts and batch files.
In computing, dir
(directory) is a command in various computer operating systems used for computer file and directory listing. It is one of the basic commands to help navigate the file system. The command is usually implemented as an internal command in the command-line interpreter (shell). On some systems, a more graphical representation of the directory structure can be displayed using the tree
command.
The mkdir
command in the Unix, DOS, DR FlexOS, IBM OS/2, Microsoft Windows, and ReactOS operating systems is used to make a new directory. It is also available in the EFI shell and in the PHP scripting language. In DOS, OS/2, Windows and ReactOS, the command is often abbreviated to md
.
In Unix-like and some other operating systems, the pwd
command writes the full pathname of the current working directory to the standard output.
In computing, at
is a command in Unix-like operating systems, Microsoft Windows, and ReactOS used to schedule commands to be executed once, at a particular time in the future.
In computing, touch
is a command used to update the access date and/or modification date of a computer file or directory. It is included in Unix and Unix-like operating systems, TSC's FLEX, Digital Research/Novell DR DOS, the AROS shell, the Microware OS-9 shell, and ReactOS. The command is also available for FreeDOS and Microsoft Windows.
In computing, echo
is a command that outputs the strings that are passed to it as arguments. It is a command available in various operating system shells and typically used in shell scripts and batch files to output status text to the screen or a computer file, or as a source part of a pipeline.
Command Prompt, also known as cmd.exe or cmd, is the default command-line interpreter for the OS/2, eComStation, ArcaOS, Microsoft Windows, and ReactOS operating systems. On Windows CE .NET 4.2, Windows CE 5.0 and Windows Embedded CE 6.0 it is referred to as the Command Processor Shell. Its implementations differ between operating systems, but the behavior and basic set of commands are consistent. cmd.exe is the counterpart of COMMAND.COM in DOS and Windows 9x systems, and analogous to the Unix shells used on Unix-like systems. The initial version of cmd.exe for Windows NT was developed by Therese Stowell. Windows CE 2.11 was the first embedded Windows release to support a console and a Windows CE version of cmd.exe. The ReactOS implementation of cmd.exe is derived from FreeCOM, the FreeDOS command line interpreter.
rm
is a basic command on Unix and Unix-like operating systems used to remove objects such as computer files, directories and symbolic links from file systems and also special files such as device nodes, pipes and sockets, similar to the del
command in MS-DOS, OS/2, and Microsoft Windows. The command is also available in the EFI shell.
In computing, exit
is a command used in many operating system command-line shells and scripting languages.
In computing, more
is a command to view the contents of a text file one screen at a time. It is available on Unix and Unix-like systems, DOS, Digital Research FlexOS, IBM/Toshiba 4690 OS, IBM OS/2, Microsoft Windows and ReactOS. Programs of this sort are called pagers. more
is a very basic pager, originally allowing only forward navigation through a file, though newer implementations do allow for limited backward movement.
In computing, SUBST
is a command on the DOS, IBM OS/2, Microsoft Windows and ReactOS operating systems used for substituting paths on physical and logical drives as virtual drives.
The NTFS file system defines various ways to redirect files and folders, e.g., to make a file point to another file or its contents without making a copy of it. The object being pointed to is called the target. Such file is called a hard or symbolic link depending on a way it's stored on the filesystem.
In computing, DELTREE
is a command line command in some Microsoft operating systems, SpartaDOS X and FreeDOS that recursively deletes an entire subdirectory of files.
A batch file is a script file in DOS, OS/2 and Microsoft Windows. It consists of a series of commands to be executed by the command-line interpreter, stored in a plain text file. A batch file may contain any command the interpreter accepts interactively and use constructs that enable conditional branching and looping within the batch file, such as IF
, FOR
, and GOTO
labels. The term "batch" is from batch processing, meaning "non-interactive execution", though a batch file might not process a batch of multiple data.
In computing, del
is a command in command-line interpreters (shells) such as COMMAND.COM
, cmd.exe
, 4DOS, NDOS, 4OS2, 4NT and Windows PowerShell. It is used to delete one or more files or directories from a file system.
In computing, label
is a command included with some operating systems. It is used to create, change, or delete a volume label on a logical drive, such as a hard disk partition or a floppy disk. Used without parameters, label
changes the current volume label or deletes the existing label.
In computing, help
is a command in various command line shells such as COMMAND.COM
, cmd.exe
, Bash, qshell, 4DOS/4NT, Windows PowerShell, Singularity shell, Python, MATLAB and GNU Octave. It provides online information about available commands and the shell environment.
In computing, replace
is a command that is used to replace one or more existing computer files or add new files to a target directory. Files with a hidden or system attribute set cannot be replaced using replace
. The command lists all files that are replaced.