Commands.page Logo

List Files Sorted by Modification Time Ubuntu

This article provides a quick guide on how to list files sorted by modification time in Ubuntu. It covers the essential terminal commands needed to view directory contents based on the most recent changes, helping users efficiently manage and locate updated files.

Basic Command for Newest Files

To list files with the most recently modified items at the top, use the ls command with the -t flag. Adding the -l flag provides a long listing format that includes detailed information about each file.

ls -lt

Basic Command for Oldest Files

To reverse the order and display the oldest modified files at the top, append the -r flag to the command. This sorts the directory contents from the earliest modification time to the latest.

ls -ltr

Understanding the Flags

Execute these commands in your terminal within the desired directory to see the results immediately.