Skip to content

Instantly share code, notes, and snippets.

@kenng
Last active August 5, 2021 04:39
Show Gist options
  • Select an option

  • Save kenng/2248129aa72a1071d4aa6bc4188a5651 to your computer and use it in GitHub Desktop.

Select an option

Save kenng/2248129aa72a1071d4aa6bc4188a5651 to your computer and use it in GitHub Desktop.

Revisions

  1. Ken Ng revised this gist Aug 5, 2021. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions bash.sh
    Original file line number Diff line number Diff line change
    @@ -2,8 +2,8 @@

    ##### find the last modified file (exclude folder)
    # show files sorted by modification time in reverse order
    alias lsa="ls -ctrla"
    lsaexec(){ find . -maxdepth 1 -type f -exec ls -ctrA1 "{}" +; }
    lsalast(){ lsaexec | tail -n1; }
    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
    lsagrep(){ lsaexec | grep $1 | tail -n1; }
    lsrgrep(){ lsaexec | grep $1 | tail -n1; }
  2. Ken Ng created this gist Aug 5, 2021.
    9 changes: 9 additions & 0 deletions bash.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    #!/bin/bash

    ##### find the last modified file (exclude folder)
    # show files sorted by modification time in reverse order
    alias lsa="ls -ctrla"
    lsaexec(){ find . -maxdepth 1 -type f -exec ls -ctrA1 "{}" +; }
    lsalast(){ lsaexec | tail -n1; }
    # example to find the last modified file with 'tar' in its name: lsagrep tar
    lsagrep(){ lsaexec | grep $1 | tail -n1; }