Artificial intelligent assistant

how to grep in the output of ls -a I'd like to `grep` the output of `ls` and pipe it into `less` so I can scroll through the output. This doesn't work, but ideally, I'd be able to type this: ls -alh | grep "file" | less Any suggestion how to do this? My over-all goal is to view the modification dates of all files in the current directory which contain "file" in their filenames. I have read into `stat` but this seems too verbose for my purposes.

I'm assuming `stat` being "too verbose" means the command outputs a lot of other information too, which it does by default if you don't request specific bits of info from it.

With GNU `stat`:


stat --printf '%y\t%n\
' -- *file*


That would output only the modification timestamp in human-readable format followed by a tab and the filename. This will be done on all filenames that contains the substring `file`. Set the `dotglob` shell option in `bash`, with `shopt -s dotglob`, to also allow hidden filenames to be included.

Use `%Y` in place of `%y` to get the modification timestamps in seconds since Epoch instead.

On BSD systems, use


stat -f '%Sm%t%N' -- *file*


instead (does the same thing). Change `%Sm` to `%Fm` to get seconds since the Epoch.

See the manual for `stat` (`man 1 stat`) on you system for further information.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 46d979897af92d9f2632ee0b0e0dd01b