Steve
Steve

Reputation: 1402

Display the date modified of a file in another directory?

I want to display the date modified of a file that is in another directory.

e.g. I am in /some/directory and I grep -rHl "foo" which returns a list of files. I am curious about the date modified of /a/completely/different/directory/result.txt without having to go to that directory and list the files.

Can this be done?

Upvotes: 0

Views: 61

Answers (1)

urznow
urznow

Reputation: 1801

Could use stat from GNU Coreutils:

stat -c %y /path/to/file

output:

2020-12-08 15:43:01.306251716 +0100

Or ls from GNU Coreutils:

ls --full-time /path/to/file

output:

rw------- 1 user user 759 2020-12-08 15:43:01.306251716 +0100 /path/to/file

Upvotes: 1

Related Questions