To delete a file, we use the remove command which is rm and then we type the filename we want to remove
rm errorfile.txt
We can also use the -v for verbose and the -i for interactive(Ask before deleting the file) options when removing a file
rm -vi errorfile-copy.txt
There is no trash file, so once a file is deleted, it is gone
An empty directory can be removed with the command rmdir
rmdir Emptydirectory
We add some files into a directory with the command:
Touch Newdirecotry2/file{1..5}.txt
This will create empty files file1.txt, file2.txt. file3.txt, file4.txt, and file5.txt
The rm command will remove a directory that is not empty but we need to add the -r (for remove recursively)
rm -r Newdirectory2
Adding the lower case -i option will require you to confirm deleting every file in that directory
Adding the upper case -I option will only require you to confirm once for the entire directory and everything in it
Tag: xóa thư mục linux, Linux, tutorial, remove, rm, delete, file, directory, Bash, ubuntu, command line
Xem thêm: https://thuthuat789.com/category/review
Nguồn: https://thuthuat789.com
if some of you should be having problems with permission denied just use the sudo command
example: sudo rm -r exampledirectory/
i'm so grateful to have ever found this tutorial, thank you mr!
Very good vid my man keep up the good work
Perfect. Such an easy video to follow. Thank you. 🙏🏼
thank u sir very useful
rm: cannot remove 'filename': Is a directory
It says, cannot remove /etc/apt/sources.list.d/ppa-beardoverflow-ts3client.list': Permission denied
Have 3 locked folders in my download folder. Please provide script to delete them
Thank you
So clear yet concise. I love your delivery. So glad that I found your channel. Great work! Subbed 👍🏾
Things explained very clearly. What would be the command to delete files from a directory which are one week older? Any help is appreciated.
wow my man your some cool
Thank you. That was clear and very helpful.
Thanks! Very helpful indeed. Can you please show how to find a corrupted file in linux and remove? Thanks in advance.
As usual, very well done. Thanks!
Even though it's basic stuff, you present it very well and usually show me something I still didn't know. You have a great style of delivery making things very clear. Thank you for your videos. They are very well presented.