Can `-t` and `-u` be combined?

QuestionsQuestions8 SkillsProDec, 10 2025
074

Yes, absolutely! -t and -u can be combined with the ls command, but it's important to understand what their combined effect will be.

When you combine them, for example:

  • ls -ltu (or ls -ult, the order usually doesn't matter for ls options)
    This command will:

    1. List files in the long format (-l).
    2. Use the access time for both display and sorting (-u).
    3. Sort the output by time (specifically, the access time because of -u) in reverse chronological order (newest first) (-t).

    So, ls -ltu will show you the files sorted by their last access time, with the access time prominently displayed in the output.

  • ls -tu
    This command will simply list the file names (not long format) sorted by their last access time, from newest to oldest.

The key is that when -u is present, it tells ls to consider the access time for any time-based operations (like sorting or displaying in long format with -l). If -u were not present, -t would use the modification time.

Does that explanation clarify how they work together? Feel free to try it out in the terminal!

0 Comments

no data
Be the first to share your comment!