There isn't a command that will give you a simple "update available: yes/no" output, but there is a command that will show you a list of images available for download via FortiGuard + individual valid update steps. It roughly matches what you will see offered to you when you use the GUI to download firmware upgrades/downgrades for you:
diag test app forticldd 14
The first part will show you the available images:
# diag test app forticldd 14 There are total 80 images, last update: 80748 secs ago Image-07004000FIMG0012004001: version:7-4-1b2463-F, release_num=4, build_time=2309020144, type=upgrade Image-07004000FIMG0012004000: version:7-4-0b2360-F, release_num=4, build_time=2305121006, type=upgrade Image-07002000FIMG0012002005: version:7-2-5b1517-F, release_num=2, build_time=2306100555, type=upgrade Image-07002000FIMG0012002003: version:7-2-3b1262-F, release_num=2, build_time=2211122004, type=downgrade Image-07002000FIMG0012002002: version:7-2-2b1255-F, release_num=2, build_time=2210052007, type=downgrade
There is possible edge-case where an update might be already available for manual download but not yet available though FortiGuard, but most of the time this output should match the real availability of recent new firmware versions.
I've tried running the command which works to receive the version numbers, however when I try to grep the command in order to produce a modified output, grep does not filter the output but still displays the entire command's output. Please see attachment.
No need to grep. Kindly note that "diag test forticldd 14" (as posted by @pminarik) does list possible downgrades, but then list upgrades as "Upgrade matrix" .. Similarly to diagnose fdsm posted by @carlosaleman .
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.