Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

On Linux I use zsh, but these should translate.

Some of my favourite recent ones...

List most recently modified files from the current directory and any below it. Helps remind me what I was working with when I don't ssh into a box regularly :

  alias changedfiles="find . -type f -print0 | xargs -0 stat --format '%Z :%z %n' | sort -nr | cut -d: -f2- | head -n 20"
[ Need to tweak that sometime for BSD find on MacOSX, but I use it primarily on Linux ]

Before backing up from a Unix-typical filesystem to an ExFAT volume attached by USB, find problematic characters in filenames from the current directory and any below :

  function badnames {
	find . -name '*[?<>\\:*|\"]*'
  }

A big favourite on volumes with deeply nested directory structures. My favourite technique for a quick directory find and switch.

If you use FZF, this will show all directories (not files) from the current directory downwards. You can do an incremental fuzzy search by starting to type, and quickly change to that directory by pressing Enter when the desired one is highlighted.

  function fd() {
	local dir
	dir=$(find ${1:-.} -path '*/\.*' -prune -o -type d -print 2> /dev/null | fzf +m) && cd "$dir"
  }
Love that one. As 'fd' is right under the fingers on the home row, the directory search and switch can look like magic when used quickly as part of the workflow.


Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: