Delete / Remove a Directory Linux Command
EMBEDDED FOR US :: EFU :: Discussions
Page 1 of 1
Delete / Remove a Directory Linux Command
Delete / Remove a Directory Linux Command
I am new to Linux and command line. How do I delete or remove a directory?
Use the rmdir command. This command remove the DIRECTORY(ies), if they are empty. Open a command-line terminal (select Applications > Accessories > Terminal), and then type the following command to remove a directory called /tmp/docs:
rmdir /tmp/docs
If a directory is not empty you will get an error:
$ rmdir letters
Output:
rmdir: letters: Directory not empty
You can cd to the directory to find out files:
$ cd letters
$ ls
Linux Remove Entire Directory Command
To remove all directories and subdirectories use rm command. For example remove letters and all subdirectories and files inside this directory, type the following command (warning all files including subdirectories will be deleted permanently):
$ rm -rf letters/
I am new to Linux and command line. How do I delete or remove a directory?
Use the rmdir command. This command remove the DIRECTORY(ies), if they are empty. Open a command-line terminal (select Applications > Accessories > Terminal), and then type the following command to remove a directory called /tmp/docs:
rmdir /tmp/docs
If a directory is not empty you will get an error:
$ rmdir letters
Output:
rmdir: letters: Directory not empty
You can cd to the directory to find out files:
$ cd letters
$ ls
Linux Remove Entire Directory Command
To remove all directories and subdirectories use rm command. For example remove letters and all subdirectories and files inside this directory, type the following command (warning all files including subdirectories will be deleted permanently):
$ rm -rf letters/
Similar topics
» Linux directory structure 1.2
» installing sqlite 3 on linux/windows,mac
» porting linux on tiny 6410 mini 6410 friendlyarm board
» configuring and building the linux kernel for tiny 6410 and mini6410
» linux/unix and windows: Image converter commands for ImageMagick
» installing sqlite 3 on linux/windows,mac
» porting linux on tiny 6410 mini 6410 friendlyarm board
» configuring and building the linux kernel for tiny 6410 and mini6410
» linux/unix and windows: Image converter commands for ImageMagick
EMBEDDED FOR US :: EFU :: Discussions
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|