Count number of files in a directory

cd /opt/mydir
ls -l | wc -l

Loading