Simple question, but I'm not sure where to look and google doesn't respond to periods and slashes.
I'm just trying to count the # of files & directories in the current directory (not including subfolders/files) and was trying to differentiate
ls -1 | wc -l
and ls | wc -l
since they seem identical. A site I was looking at said **"Keep in mind that this is also counting the ./ and ../ directories."** regarding the one with ls -1
, and I'm not sure if that means it includes the directories before or something (which I don't want), but it didn't seem to do that from testing.
Could someone confirm which one of those would be most adequate for counting # of files & directories in the current directory only (not sub) and what they mean by ./ and ../ directories?
Asked by Adam
(291 rep)
Jan 30, 2013, 12:53 PM
Last activity: Mar 22, 2025, 02:38 PM
Last activity: Mar 22, 2025, 02:38 PM