Locate a Command

$ which iostat
$ whereis iostat
$ sudo apt update && sudo apt upgrade
$ sudo apt install plocate

$ locate iostat
$ locate example.txt
$ locate [example]	# Search partial matches
$ locate -i [Example]	# Case-insensitive
$ locate -n 5 filename
$ locate --regex -i "(\.mp4|\.avi)"

$ locate [filename] | wc -l
$ locate -c [filename]

$sudo updatedb
$locate [example] | grep "$(date +%Y-%m-%d)"
$ sudo find / -name iostat
$ command -v ssh

Display information about the command type

$ type ssh
$ type sleep head
$ type -p pwd
$ type -a pwd
$ type -t grep
  • alias (shell alias)
  • function (shell function)
  • builtin (shell builtin)
  • file (disk file)
  • keyword (shell reserved word)
$ readlink --version
$ readlink --help
$ readlink -f $(which ssh)
$ readlink -e desk
$ readlink -m desk3
$ readlink -n desk4
$ readlink -q desk
$ readlink -s desk5
$ readlink -s desk5
$ readlink -z desk2
comments powered by Disqus