Locate a Command

1
$ which iostat
1
$ whereis iostat
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
$ 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)"
1
$ sudo find / -name iostat
1
$ command -v ssh

Display information about the command type

1
2
3
4
5
$ 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)
1
2
$ readlink --version
$ readlink --help
1
2
3
4
5
6
7
8
$ 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