Apple - Does just 'rm -rf' delete any files?
No, rm -rf
will not delete any files because you did not supply an argument to the command.
From the manual page:
rm removes each specified file.
This means you can use it to remove a list of files at once, e.g. with
rm -rf test1.txt test2.txt
Fortunately, all you did was pass an empty list of files, so it deleted nothing. Also, what @SolarMike says: if you don't know what a command does, don't run it. macOS is designed to 'hide' all dangerous (but potentially powerful) Unix operations from the end user.
For the layman/Linux/Unix newbie:
rm
alone doesn't do anything because you haven't told it what to get rid of.
man rm
can explain most of this, if you understand it.
-r
means recursive, as in "include everything in subfolders"
-f
means force, "don't ask me to confirm" mode
rm -rf
(DON'T DO THIS)/
would say delete everything under /
(the root folder) without checking (on recent macOS versions SIP will prevent you from removing macOS itself by this, but a lot of other stuff will get deleted)
rm [some file name]
would just delete that file.
rm -rf /home/myuser/books
would delete everything in myuser
's books
folder, as well as the folder.