Skip to content

FAQforge

  • Site Notice
  • Privacy Policy

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

  • [Fixed] Ubuntu apt-get upgrade auto restart services
  • What is my IP – on Ubuntu Linux
  • How to Download and Use Putty and PuTTYgen
  • How to Download and Install Google Chrome Enterprise
  • Reset Rspamd Bayes filter

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