You are not logged in.
Hi there,
Does anyone know a handy command for the shell to list all recently used or modified files?
I was thinking about some sort of `ls` command but it should be universal and not limited to a specific directory.
Thanks!
Last edited by orschiro (2013-09-30 12:31:37)
Offline
If you want to find your distro's files that have altered the below command is what you are looking for:
sudo pacman -Qk
if you want to find your files - man find
https://balaskas.gr
Linux System Engineer - Registered Linux User #420129
Offline
Hello
ls plus option recursive:
ls -R
ls -R ./
ls -R /home/and -l for data
ls -Rlmaybe a grep afterwards.
Edit:
Option -ct for sort by last time modification: But it doesn't mix directories.
ls -RlctEdit 2:
Option -r for sort reverse: But it doesn't mix directories.
ls -rRlctLast edited by Alber (2013-09-30 08:55:52)
Because not all of us are native English speakers, try no to use slang or abbreviations, thank you.
Offline
Use find. This finds anything modified 1 day ago for example:
% find /foo -type f -mtime -1Offline
new_command_like_ls() {
find $1 -maxdepth $2 -type f -mtime -1 -printf "%T@-%Tk:%TM - %f\n" | sort -rn | cut -d- -f2-
}Maybe you want to be able to change -mtime to -atime or -ctime.
And you want some error handling ![]()
Offline
Use find. This finds anything modified 1 day ago for example:
% find /foo -type f -mtime -1
Nice, thanks a lot! I like the simplicity. ![]()
I am going with that one now:
alias recent='find * -type f -mtime -1 | tail'But thanks for all the other suggestions as well.
Last edited by orschiro (2013-09-30 12:31:27)
Offline
You realize the * in your statement is meant to be a path, no?
Offline
Path in that case would be /
...if you run as normal user you will get some permission denied errors with 600 and 700 files.
Last edited by graysky (2013-09-30 13:11:31)
Offline
Path in that case would be /
...if you run as normal user you will get some permission denied errors with 600 and 700 files.
But then I do not really understand why my command posted above also works fine.
[orschiro@thinkpad ~]$ find * -type f -mtime -1 | tail
Projects/Linux/PKGBUILD/tasky/src/tasky/.git/hooks/post-update.sample
Projects/Linux/PKGBUILD/tasky/src/tasky/.git/hooks/pre-applypatch.sample
Projects/Linux/PKGBUILD/tasky/src/tasky/.git/description
Projects/Linux/PKGBUILD/tasky/src/tasky/.git/packed-refs
Projects/Linux/PKGBUILD/tasky/src/tasky/.git/info/exclude
Projects/Linux/PKGBUILD/tasky/src/tasky/.git/index
Projects/Linux/PKGBUILD/tasky/src/tasky/.git/HEAD
Projects/Linux/PKGBUILD/tasky/src/tasky/.git/refs/heads/master
Projects/Linux/PKGBUILD/tasky/src/tasky/.git/refs/remotes/origin/HEAD
Projects/Linux/PKGBUILD/tasky/src/tasky/src/tasky.pyIt just lists files that reside in /home.
Last edited by orschiro (2013-09-30 13:33:31)
Offline
graysky wrote:Path in that case would be /
...if you run as normal user you will get some permission denied errors with 600 and 700 files.But then I do not really understand why my command posted above also works fine.
[orschiro@thinkpad ~]$ find * -type f -mtime -1 | tail Projects/Linux/PKGBUILD/tasky/src/tasky/.git/hooks/post-update.sample Projects/Linux/PKGBUILD/tasky/src/tasky/.git/hooks/pre-applypatch.sample Projects/Linux/PKGBUILD/tasky/src/tasky/.git/description Projects/Linux/PKGBUILD/tasky/src/tasky/.git/packed-refs Projects/Linux/PKGBUILD/tasky/src/tasky/.git/info/exclude Projects/Linux/PKGBUILD/tasky/src/tasky/.git/index Projects/Linux/PKGBUILD/tasky/src/tasky/.git/HEAD Projects/Linux/PKGBUILD/tasky/src/tasky/.git/refs/heads/master Projects/Linux/PKGBUILD/tasky/src/tasky/.git/refs/remotes/origin/HEAD Projects/Linux/PKGBUILD/tasky/src/tasky/src/tasky.pyIt just lists files that reside in /home.
You are likely executing the command from your home dir. If you want a system wide report, you will specify /
Offline
Yeah, the '*' as the first parameter for find just expands to all the files in the current directory (except for dot files). Which is a more verbose way of just saying '.'.
Offline