The ls command is the most widely used command to display the contents in a directory on a Linux/Mac device terminal.
If you want to sort the output of the ls command by date and time you can make use of the -t option along with the ls -l command,
% ls -lt
total 60
drwx------ 1 root root 4096 Aug 7 17:28 root
drwxrwxrwt 1 root root 4096 Aug 7 17:20 tmp
drwxr-xr-x 5 root root 360 Aug 7 16:52 dev
dr-xr-xr-x 13 root root 0 Aug 7 16:52 sys
dr-xr-xr-x 180 root root 0 Aug 7 16:52 proc
drwxr-xr-x 1 root root 4096 Jul 31 17:20 etc
drwxr-xr-x 1 root root 4096 Jul 31 16:57 run
drwxr-xr-x 1 root root 4096 Jul 31 16:56 home
drwxr-xr-x 1 root root 4096 Apr 5 05:17 var
drwxr-xr-x 2 root root 4096 Apr 5 05:01 media
drwxr-xr-x 2 root root 4096 Apr 5 05:01 mnt
drwxr-xr-x 2 root root 4096 Apr 5 05:01 opt
drwxr-xr-x 2 root root 4096 Apr 5 05:01 srv
drwxr-xr-x 1 root root 4096 Apr 5 05:01 usr
lrwxrwxrwx 1 root root 7 Apr 5 05:01 bin -> usr/bin
lrwxrwxrwx 1 root root 7 Apr 5 05:01 lib -> usr/lib
lrwxrwxrwx 1 root root 8 Apr 5 05:01 sbin -> usr/sbin
drwxr-xr-x 2 root root 4096 Apr 15 2020 boot
In order to display the latest files and directories first as a list make use of -r option as well along with -lt
% ls -ltr
total 60
drwxr-xr-x 2 root root 4096 Apr 15 2020 boot
lrwxrwxrwx 1 root root 8 Apr 5 05:01 sbin -> usr/sbin
lrwxrwxrwx 1 root root 7 Apr 5 05:01 lib -> usr/lib
lrwxrwxrwx 1 root root 7 Apr 5 05:01 bin -> usr/bin
drwxr-xr-x 1 root root 4096 Apr 5 05:01 usr
drwxr-xr-x 2 root root 4096 Apr 5 05:01 srv
drwxr-xr-x 2 root root 4096 Apr 5 05:01 opt
drwxr-xr-x 2 root root 4096 Apr 5 05:01 mnt
drwxr-xr-x 2 root root 4096 Apr 5 05:01 media
drwxr-xr-x 1 root root 4096 Apr 5 05:17 var
drwxr-xr-x 1 root root 4096 Jul 31 16:56 home
drwxr-xr-x 1 root root 4096 Jul 31 16:57 run
drwxr-xr-x 1 root root 4096 Jul 31 17:20 etc
dr-xr-xr-x 181 root root 0 Aug 7 16:52 proc
dr-xr-xr-x 13 root root 0 Aug 7 16:52 sys
drwxr-xr-x 5 root root 360 Aug 7 16:52 dev
drwxrwxrwt 1 root root 4096 Aug 7 17:20 tmp
drwx------ 1 root root 4096 Aug 7 17:32 root
Conclusion:
- ls -l: l option to displays the output as a list
- ls -lt: t option to display list in order of oldest date to lastest date and time
- ls -ltr: tr option to display list in order of lastest date to oldest date and time

Sort ls command date and time
More Posts related to Linux,
- [Fix] Linux - bash: useradd: command not found
- Calculate days between dates using dateutils ddiff command
- pwd Command - Print Working Directory
- Rename a directory using Linux/Unix command
- How to go to the End of File in Nano Editor
- How to tar.gz a directory or folder Command
- How to remove/delete a directory in Linux/macOs
- How to Display content of a file in Terminal Screen?
- ls command sort by file size [Linix/UNIX/macOS/bash]
- How to Copy Entire Directory to another Directory in Linux
- 3 ways to clear screen on Linux Terminal
- Command to check Last Login or Reboot History of Users and TTYs
- How to check uptime of Linux/Unix/macOS system/server using console command?
- How to backup a file in Linux/Unix
- Command to know the installed Debian version?
- Check SSH/OpenSSH version Command
- 3 Commands to stop Nginx Server
- Linux: Create a New User and Password and Login Example
- How to install npm on Ubuntu
- How to List All Users in Linux
- How to Get the List of Shells on Linux
- Fix - ssh-copy-id no identities found error
- Installing and using unzip Command to unzip a zip file using Terminal
- scp: ssh: connect to host xxxx port 22: Connection refused Error
- zsh hello world example
More Posts:
- Must Know Homebrew Commands for Mac/Linux Users - MacOS
- [Fix] Steam Friends Network Unreachable Error - HowTos
- Mac - Chrome Open a new window in Incognito mode - Chrome
- How to Sync Microsoft Teams Calendar with Mac Calendar - Microsoft
- Deep Dive: Java Object Class from java.lang Package - Java
- cURL Option to show HTTP Response Status Code - cURL
- How to check zsh installed version using terminal - MacOS
- Tutorial Java SOAP WebServices JAS-WS with Eclipse J2EE IDE and Tomcat Server Part 1 - Java