Unix

rm and rmdir Command in Unix/Linux

In unix rm and rmdir commands are used to remove the files and directories.
rmdir command removes only empty directories, if the directory contain files it fails.
The syntax of rmdir command is

The options are
  • -p: Remove directory and parent directories
  • -v: Provides the diagnostic information of the directory processed
The syntax of rm command is

Rm command can be used to delete both directories and files
The options are
  • -f: Ignore nonexistant files and never prompt before removing.
  • -i: Prompt before every removal
  • -I: Prompt once before removing more than three lines, or when removing recursively.
  • -r: Renove directories and their contents recursively
  • -help: Display a help message and exit
  • -version: Display version information and exit
Examples of rm and rmdir Command
Command to remove all files in a directory

Command to remove directory

Here docs is the directory




Powered by Blogger.