Home » mcq » Unix » Which command is used to delete all files in the current directory as well as all files and sub-directories in its subdirectories? A. rm * B. rm -r * C. rm all D. rm *.* E. None of the above
rm *
rm -r *
rm all
rm *.* E. None of the above
Answer is Wrong!
Answer is Right!
The correct answer is: B. rm -r *
The rm command is used to delete files. The -r option tells rm to delete directories recursively, meaning that it will delete the directory and all of its contents. The * wildcard matches any file or directory name. So, the command rm -r * will delete all files and directories in the current directory, as well
89.4 11.4 132.3c6.3 23.7 24.8 41.5 48.3 47.8C117.2 448 288 448 288 448s170.8 0 213.4-11.5c23.5-6.3 42-24.2 48.3-47.8 11.4-42.9 11.4-132.3 11.4-132.3s0-89.4-11.4-132.3zm-317.5 213.5V175.2l142.7 81.2-142.7 81.2z"/>
Subscribe on YouTube
as all files and directories in its subdirectories.
Option A, rm *, would delete all files in the current directory, but it would not delete any directories. Option C, rm all, is not a valid command. Option D, rm *.*, would delete all files in the current directory, including hidden files. Option E, None of the above, is also incorrect.