Viewing Directories

ls

ls [-aAdglorRSt1] [-I <pattern>] <file-name>

Options:
a : List all entries, including hidden files (those that start with a ".")
A : Like "a", but don't display the "." and ".." directories
d : Display the directory but not its contents (doesn't work recursively)
g : Display the group ownership
l : Display a long listing (including permission mode, number of links, owner,
size in bytes, time last modified)
o : Display without colors
r : Reverse the sort order
R : Recursive
S : Sort by size
t : Sort by time

1 : (the number one) List one file per line

I <pattern> : Ignore files matching the shell pattern (unless they're listed on the command line)
Examples
ls       # Short listing
ls -al # Long listing
ls -alt # Sort by time (long listing)
ls ??*         # List files with names that are two or more characters long
ls .[^.]* # List hidden files (skipping the "." and ".." directories)

ls [a-zA-Z]* # List files that begin with a letter
ls [^0-9]* # List files that don't begin with a number (same as: ls [!0-9]*)

Misc

# Count the number of files in the current directory
find -maxdepth 1 -type f -name "*" | wc -l
# If there are jpg files in the current directory
if ls *.jpg 2> /dev/null | grep -q jpg; then ... fi
if [ "`find -maxdepth 1 -type f -name "*.jpg" | wc -l`" -gt "0" ]; then ... fi