How do I remove a directory in Linux using the shell prompt?
You can use the following commands:
[a] rmdir command : remove empty directories.
[b] rm command : remove files or directories.
Linux Delete a Directory Command Examples
The syntax is as follows:
rmdir dirName
Login using the ssh client or open a command-line terminal (select Applications > Accessories > Terminal under Gnome desktop), than type the following command to delete empty directory called foo:
rmdir foo
By default, the rm command does not remove directories. Use the --recursive (-r or -R) option to remove each listed directory, too, along with all of its contents including all files and subdirectories:
rm -r documents
You can also specifiy the full path:
rm -r /data/dir1 rm -r /home/vivek/dir2 rmdir $HOME/mp3
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop









![Linux Copy File Command [ cp Command Examples ]](http://s13.cyberciti.org/images/shared/rp/3/2.jpg)



{ 0 comments… add one now }