---
title: "Check if command exists with shell script"
description: "Check if command exists with shell script"
canonical: https://oozou.com/til/check-if-command-exists-with-shell-script-52
locale: en
date: 2020-10-13
topic: shell
---

# Check if command exists with shell script

> Check if command exists with shell script

Published: 2020-10-13 · Topic: [shell](https://oozou.com/til-topics/shell) ([markdown](https://oozou.com/til-topics/shell.md))

```bash
if ! type gem > /dev/null; then
  echo 'gem command not found.'
fi
```

---

Contact OOZOU: hello@oozou.com · +66 2544 0000 · https://oozou.com/contact

More for AI agents: https://oozou.com/llms.txt · every page has a markdown twin at its URL plus ".md"
