UNIX Delete / Remove Directory Command

https:/‮.www/‬lautturi.com
UNIX Delete / Remove Directory Command

To delete or remove a directory on a Unix system using the command line, you can use the rm command with the -r flag to delete the directory and all of its contents, including subdirectories and files.

For example, to delete a directory named "directory1" and all of its contents, you can use the following command:

$ rm -r directory1

Note that this will permanently delete the directory and all of its contents, and there is no way to recover them. Use caution when using the rm command.

You can also use the rmdir command to delete an empty directory. For example:

$ rmdir directory1

This will delete the directory if it is empty, but it will not delete any files or subdirectories within the directory.

For more advanced usage of the rm and rmdir commands, you can refer to the rm and rmdir man pages by running man rm and man rmdir on the command line.

Created Time:2017-10-30 14:27:22  Author:lautturi