echo * | rm -f not work? as per my understanding,
echo * should list all the files in the directory and pipe should send this list as an argument to the
rm -f command, which should delete the files. What am I missing?
Pipe sends data to stdin. And not to arguments list. These are two very different concepts.
Arguments are what is in line after command line. Stdin is basically just like a file that is already opened, from which you can read.
Please also note that doing things like this:
echo * | xargs rm -f is bad idea because it might do weird things in case of files with spaces in names, or with "-" at the beginning.