Im having trouble figuring out that, if I'm in let say the directory /home/test/test2 but I want to find the number of files in the /home directory, how would I do it.
I know how to do it if it was the other way around, like in your home directory, list files in /home/test/test2, you would do:
ls /home/test/test2 | wc -l
but how would I do it if I was in the test2 directory and wanted to find the number of files in the home directory.
Thanks
/home
directory? (Or is/home
your home directory??) (3) Do you know how to refer to your home directory on the command line? (Hint:"$HOME"
is one way, typing it out (e.g.,/home/shawn
) is another, and there’s an even better way.) (4) If you’re asking about/home
, why don’t you thinkls /home | wc -l
will work? If you’re asking about your home directory, can you figure it out from what I’ve just said? – Scott - Слава Україні Feb 13 '16 at 07:49