Wednesday, August 15, 2007

Unix - `rm,rmdir`

Unix command.

`rm` - remove files or directories

Usage:
rm [OPTION]... FILE...

OPTIONS:
Remove (unlink) the FILE(s).
-d, --directory unlink FILE, even if it is a non-empty directory (super-user only)
-f, --force ignore nonexistent files, never prompt
-i, --interactive prompt before any removal
-r, -R, --recursive remove the contents of directories recursively

Example:
delete non-empty directory.
....
[root@server /]# rm -rf /tmp
[root@server /]#
....
----------------------------------------------------------------------

`rmdir` - remove empty directories
Remove the DIRECTORY(ies), if they are empty.

Example:
[root@server /]# rmdir /tmp
rmdir: `/tmp': Directory not empty

......
Make empty directory and use this command again.
........
[root@server /]# mkdir newdir
[root@server /]# rmdir newdir
....

No comments: