You can delete the directory using any one of the following command:
rmdir command : It removes the directory entry specified by each directory argument, provided it is empty.
rm command : It removes the file. But, can be used to remove directory too even if directory is not empty.
Tutorial details | |
---|---|
Difficulty | Easy (rss) |
Root privileges | No |
Requirements | rmdir/rm |
Time | 1m |
Syntax: Remove an empty directory with the rmdir command
The basic syntax is:
rmdir dirNameHere
To remove an empty directory called foo in the current directory, enter:
rmdir foo
To remove an empty directory called foo in the current directory, enter:
rmdir foo
To remove an empty directory called foo/bar, enter:
rmdir -p foo/bar
Syntax: Remove directory and all its files including sub-directories with the rm command
The basic syntax is:
rm -rf dirNameHere
Warning: There is no undo in the command line/shell. So be careful with the following command. You may loss data permanently.
To remove movies-mp3 directory, enter:
rm -rf movies-mp3
More more information see rmdir(1) and rm(1) command man pages.
🐧 2 comments so far... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
Hi
thanks a lot, very nice article
what the command for delete files using terminal ubuntu…full command