Skip to main content
cope with spaces and backslashes in file names
Source Link
Gilles 'SO- stop being evil'
  • 865.9k
  • 205
  • 1.8k
  • 2.3k

This script works for me:

#!/bin/bash # while IFS= read -r line; do find "$line" -printf '%T@ %p\n' done | sort -k 1nr | sed 's/^[^ ]* //' | head -n 10 

you can pipe your find through it:

(0)asus-romano:~/tmp% find . -type f | ./script11.sh ./script11.sh ./script10.sh [...] 

In zshyou could used a global alias, which is much faster, but I think that bashdoes not have them:

(0)asus-romano:~/tmp% alias -g showlast10="-printf '%T@ %p\n' | sort -k 1nr | sed 's/^[^ ]* //' | head -n 10" (0)asus-romano:~/tmp% find . -type f showlast10 ./script11.sh ./script10.sh ./Just tab.xyz [...] 

This script works for me:

#!/bin/bash # while read line; do find "$line" -printf '%T@ %p\n' done | sort -k 1nr | sed 's/^[^ ]* //' | head -n 10 

you can pipe your find through it:

(0)asus-romano:~/tmp% find . -type f | ./script11.sh ./script11.sh ./script10.sh [...] 

In zshyou could used a global alias, which is much faster, but I think that bashdoes not have them:

(0)asus-romano:~/tmp% alias -g showlast10="-printf '%T@ %p\n' | sort -k 1nr | sed 's/^[^ ]* //' | head -n 10" (0)asus-romano:~/tmp% find . -type f showlast10 ./script11.sh ./script10.sh ./Just tab.xyz [...] 

This script works for me:

#!/bin/bash # while IFS= read -r line; do find "$line" -printf '%T@ %p\n' done | sort -k 1nr | sed 's/^[^ ]* //' | head -n 10 

you can pipe your find through it:

(0)asus-romano:~/tmp% find . -type f | ./script11.sh ./script11.sh ./script10.sh [...] 

In zshyou could used a global alias, which is much faster, but I think that bashdoes not have them:

(0)asus-romano:~/tmp% alias -g showlast10="-printf '%T@ %p\n' | sort -k 1nr | sed 's/^[^ ]* //' | head -n 10" (0)asus-romano:~/tmp% find . -type f showlast10 ./script11.sh ./script10.sh ./Just tab.xyz [...] 
Source Link
Rmano
  • 3.5k
  • 5
  • 25
  • 38

This script works for me:

#!/bin/bash # while read line; do find "$line" -printf '%T@ %p\n' done | sort -k 1nr | sed 's/^[^ ]* //' | head -n 10 

you can pipe your find through it:

(0)asus-romano:~/tmp% find . -type f | ./script11.sh ./script11.sh ./script10.sh [...] 

In zshyou could used a global alias, which is much faster, but I think that bashdoes not have them:

(0)asus-romano:~/tmp% alias -g showlast10="-printf '%T@ %p\n' | sort -k 1nr | sed 's/^[^ ]* //' | head -n 10" (0)asus-romano:~/tmp% find . -type f showlast10 ./script11.sh ./script10.sh ./Just tab.xyz [...]