I am trying to figure out how Linux determines whether an object in directory is a file or folder. There's got to be a property (I am guessing in Stat) that Linux references from which lets it know quickly. It's hard to find information on google because when you enter a query like "how linux differentiates between file folder" you get a lot of tutorials on what physically makes them different which is annoying :P.
I don't know too many of the internals of Linux (not as many as I'd like). But if you run the ls -a -l command in a directory, you see complete information on the listed files. In the file permissions part of the listing for each item, the first property indicates whether a listed item is a file or a directory. For files there is a dash - (flag not set). For directories it's d (flag set). The other flags rwxrwxrwx relate to the items read/write/execute privileges for the owner, members of the owners group and all other users. So there's at least a flag that gets set.
I don't know much more than that.
I natively run slackware so my command prompt is in color. So blue is folder, red is compressed file, green is executable, white is just a general file (script, or text file.) etc.... If I find myself on another linux platform that doesn't natively differentiate I do "ls --color=always" or "dir --color=always." Don't have much experience with ubuntu or debian, I know it works on redhat and redhat clones. I assume ubuntu or debian isn't much different. You could always ls --help or dir --help it to see how its set up for your flavor.