

In this case %b matches the 3 letter month and %e is a space-padded day value matching the format of ls instead of a 0-padded day value that the default date uses. GNU date formatting is really helpful for outputting your date exactly how you need. Ls -ltr directory/ | grep "$(date +"%b %e")" Does the same thing and requires no awk print statements or conditionals.

Why not just use gnu date's built in formatting instead? That said, all the ls solutions seem really cumbersome piping to awk. This isn’t as efficient as simply adding the -ls argument to find, as it then does an "ls" for each file matched, but it does give you more control over the output.I think these ls commands are far better than using find if the additional file metrics that find (which just returns filenames) does not provide are needed. daystart -ctime 4 -type f` do ls -l $f done To do it a different format you could do as in the following example, using ls to get the date and time of modification: for f in `find. The above lists the find output in `ls -dils` format. It needs to be put at the end after the other arguments otherwise it’ll return more than just the files specified by the search criteria. īy adding the "-ls flag" find will also show the filesizes etc as shown in the example output below. The example below shows the output of the current working directory which contains some Linux ISO images and their md5sum files: $ find.

The find command simply outputs the list of the filenames, with absolute paths. To find all the files that were modified two days ago, you would do this: find.
