how to differentiate file and directory name using ls command

how to differentiate file and directory name using ls command.

l

have you tried using ls -l command??

ls -l | grep ^d  # for directories

if you use ls -l, the contents in the directory listed as below.

drwxr-xr-x 3 truesrc staff 9728 Nov 15 18:37 exercises/
-rw-r--r-- 1 truesrc staff 155 Oct 8 12:52 fibbno.cc

if entry is a directory, it starts with bit 'd'
if entry is a file,it starts with '-'