Skip to content

Instantly share code, notes, and snippets.

@kenng
Last active August 5, 2021 04:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenng/2248129aa72a1071d4aa6bc4188a5651 to your computer and use it in GitHub Desktop.
Save kenng/2248129aa72a1071d4aa6bc4188a5651 to your computer and use it in GitHub Desktop.
linux productive command line
#!/bin/bash
##### find the last modified file (exclude folder)
# show files sorted by modification time in reverse order
alias lsr="ls -ctrla"
lsrexec(){ find . -maxdepth 1 -type f -exec ls -ctrA1 "{}" +; }
lsrlast(){ lsaexec | tail -n1; }
# example to find the last modified file with 'tar' in its name: lsagrep tar
lsrgrep(){ lsaexec | grep $1 | tail -n1; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment