You have downloaded a file to your "Download" area (which happens
frequently). You want to open the file.
$ open "$(ls -1tr | tail -1)"Explanation: ls -1tr lists the files in the directory with the lastest the oldest file first and the latest line last (time ordered reverse sort); the option -1 (one, not ell) forces each file name to be listed on a separate line. tail -1 extracts the last line. These two actions are done in a subshell $(...)$. The output of the subshell serve as input to the open command. The output is enclosed in " " to accommodate file names with blanks.
If you start using this command sequence then write a shell executable tool. Put in your PATH
#!/bin/zsh
#
# usage:
# latestfile .. displays the name of the latest file in current directory
# latest -op .. opens file with application specified by op
# -o .. use "open"
# -v .. use "vi"
# -any .. use "any"
a="$(ls -1tr | tail -1)" #capture last name
if [ $# -gt 1 ]; then #check for bad or incorrect usage
echo "too many paramters: quit"; exit -1
fi
if [ $# = 0 ]; then
echo $a; exit
fi
if [ $1 = "-o" ]; then
open "$a"; exit
elif [ $1 = "-v" ]; then
vi "$a"
else
${1#-} "$a"
fi