Skip to content

FAQforge

  • Site Notice
  • Privacy Policy
    • Cookie Declaration

shellscript

Get the name of the newest file in a directory on the linux shell

by Till Brehm

If you have a directory with many files (a few thousand in my case) and need to know which one is the newest, then the following command might be useful. It returns the name and details of the newest file in a directory where it is executed: ls -tl | sed -n 2p

Categories Basics, CentOS, Debian, Distributions, Linux & Unix, Ubuntu Tags bash, Shell, shellscript 5 Comments

Recent Posts

  • Yarn Installation on Debian Linux
  • Fetch Emails from Gmail via POP3 or IMAP on Ubuntu 22.04
  • How to relay email from Postfix mail server to Gmail on Ubuntu 22.04
  • How to Install Mono on Debian Linux
  • How to Install Gradle Build Tool on Rocky Linux

Categories

  • Android
  • Basics
  • CentOS
  • Controlpanels
  • Debian
  • Distributions
  • Email
  • FTP
  • iPad & iPhone
  • ISPConfig 2
  • ISPConfig 3
  • Linux & Unix
  • Mac OS X
  • Microsoft Exchange Server 2016
  • MySQL
  • O365
  • PostgreSQL
  • PowerShell
  • Programming
  • Server
  • Ubuntu
  • Uncategorized
  • Virtualisation
  • Vista
  • Webserver
  • Windows
  • Windows 10
  • Windows 7
  • Windows 8
  • Windows Server 2012 R2
  • Windows Server 2016
  • XP

Search

Categories

  • Android
  • Basics
  • CentOS
  • Controlpanels
  • Debian
  • Distributions
  • Email
  • FTP
  • iPad & iPhone
  • ISPConfig 2
  • ISPConfig 3
  • Linux & Unix
  • Mac OS X
  • Microsoft Exchange Server 2016
  • MySQL
  • O365
  • PostgreSQL
  • PowerShell
  • Programming
  • Server
  • Ubuntu
  • Uncategorized
  • Virtualisation
  • Vista
  • Webserver
  • Windows
  • Windows 10
  • Windows 7
  • Windows 8
  • Windows Server 2012 R2
  • Windows Server 2016
  • XP

Pages

  • Privacy Policy
  • Site Notice
© 2023 FAQforge • Built with GeneratePress