I\'m trying to create a macro for Keyboard Maestro for OS X doing the following:
You can't do it with only ls. However, as echo is generally built into the shell, it doesn't really add any overhead into the script. To get just the name of the file, I'd suggest:
echo -n "newest: $(ls -t1 | head -n1)"
If, for some reason, you really want to eliminate the head, then I suppose you could go for something like:
ls -t1 | ( read n; echo -n "newest: $n")
(read is built into the shell, head isn't.)
Note that these solutions do not recurse into subdirectories, since that was not specified in the question. In fact, subdirectories may be printed as the newest "file".