Pergunta basica programaçao shell

Hello

I am starting to program in Shell and would like to know how can I list the most recent files from a directory ... For example:
a directory where the files have S1, S2 and S3.
The most recent are the files S1 and S2 (are tied with the date of creation).

How do I list them?

Hello,

Per our forum rules, all users must write in English, use semi-formal or formal English language and style, and correct spelling errors.

The reason for this is that most software and operating systems are written in English and these are software related technical forums.

In addition, nearly 95% of all visitors to this site come here because they are referred by a search engine. In order for future searches on your post (with answers) to work well, you need to spell correctly!

So, as a benefit and courtesy to current and future knowledge seekers, please be careful with your language, check your spelling and correct your spelling errors. You might receive a forum infraction if you don't pay attention to this.

Also, do not write in cyberpunk or abbreviated chat style under any circumstances and do not use profanity. This is not a chat room, it is a formal knowledge base to serve you and everyone, of all ages and cultural backgrounds.

Thanks!

The UNIX and Linux Forums

There is no date of creation information, only the date of last modification.

To list files, most recent first:

ls -t

If you only want the two most recent, pipe the output through head:

ls -t | head -n 2

Have a play around with ls and head/tail e.g.

ls -lrt | tail -5

(or ls -rt | tail -5 for shorter output) 

will get you the 5 most recent files...

HTH

the problem is: i want to create a program to find the most recent files from a directory... in case of being 2 or 3 files with the same date , i would like to list them
what really cares is when i make a call system with the program name what i want it to do is list the most recent file from the current directory