---
title: Install ls-having on Linux | Snap Store
description: Get the latest version of ls-having for Linux - A command-line tool for
  finding directories based on specified flag files and other conditions
url: https://snapcraft.io/ls-having
---

# ls-having

[handy-common-utils (james-hu)](https://snapcraft.io/publisher/james-hu "View all snaps from handy-common-utils (james-hu)")

* [handy-common-utils (james-hu)](https://snapcraft.io/publisher/james-hu "View all snaps from handy-common-utils (james-hu)")
* [Development](https://snapcraft.io/search?categories=development)
* [Utilities](https://snapcraft.io/search?categories=utilities)

latest/stable 1.1.1

Install latest/stable of ls-having

This channel hasn't been updated in a while. It might be unmaintained and have stability or security issues.

---

**Install using the command line**

```
sudo snap install ls-having
```

Don't have snapd? [Get set up for snaps](https://snapcraft.io/docs/installing-snapd).

---

### Package name

* ls-having

---

### License

* Apache-2.0

---

### Last updated

* 27 May 2023 - latest/stable
* 27 May 2023 - latest/edge

This snap hasn't been updated in a while. It might be unmaintained and have stability or security issues.

---

### Websites

* [github.com/handy-common-utils/ls-having](https://github.com/handy-common-utils/ls-having "https://github.com/handy-common-utils/ls-having")

---

##### Report a Snap Store violation

* [Report this Snap](https://snapcraft.io/ls-having#report-snap-modal)

---

* [Description](https://snapcraft.io/ls-having#tab-description)
* [Security](https://snapcraft.io/ls-having#tab-security)

#### A command-line tool for finding directories based on specified flag files and other conditions

`ls-having` is a powerful open-source tool that makes it easy to find directories. With a simple and intuitive command-line interface, "ls-having" allows you to quickly search for directories based on specified flag files and other conditions, saving you time and effort. Whether you're a developer who works with mono repos, or you just need an easy way to find your directories, "ls-having" is the perfect tool for you.

* Flexible search options: "ls-having" allows you to specify various options and conditions for searching for directories, such as flag files, the check file, regular expressions for matching the check file, excludes, and maximum depth.
* Configurable error handling: "ls-having" provides an option for configuring how it handles errors such as non-existing directory or no access permission, allowing users to customize and integrate the tool for different situations.
* Cross-platform support: "ls-having" is available for Linux, MacOS, and Windows.
* Small and quick: "ls-having" has just one native executable file, there is no dependency on anything else, and the tool is just about 2MB in size. It starts and runs very quickly.

**Quick start**

Try this:

`ls-having -f package.json`

This will search for directories containing a "package.json" file in the current directory and print the names of those directories to the console. You can then use the output of "ls-having" as arguments for other commands, such as "xargs", to perform actions on those directories.

For more information on how to use "ls-having" and the available options and arguments, visit <https://github.com/handy-common-utils/ls-having> or run the `ls-having --help` command.

**Usage**

```
 Usage: ls-having -f name-or-glob [options] [root-dir]
 Options:
   -c, --check-file name          name of the additional file to check
   -i, --check-inverse            regard regular expression not matching as positive
   -e, --check-regexp expression  regular expression for testing the content of the check file (default ".*")
   -d, --depth int                how deep to look into subdirectories, 0 means only look at root directory, -1 means no limit (default 5)
   -r, --error string             how to handle errors such like non-existing directory, no access permission, etc. (ignore|panic|print) (default "ignore")
   -x, --exclude glob             glob of the directories to exclude, this option can appear multiple times
   -f, --flag-file glob           name or glob of the flag file, this option can appear multiple times
   -h, --help                     show help information
   -a, --match-all-flag-files      require all (instead of any) of the flag file names/globs to be matched
   -n, --no-default-excludes      don't apply default excludes
   -0, --print0                   separate paths in the output with null characters (instead of newline characters)
   -s, --subdirectories-only      don't return root directory even if it meets conditions
 References:
   Glob syntax: https://github.com/gobwas/glob#example
   Regexp syntax: https://pkg.go.dev/regexp/syntax
   Home page: https://github.com/handy-common-utils/ls-having
```

**Examples**

Find all directories in `./` having `package.json` file,
and run `npm audit fix` in them one by one:

`ls-having -f package.json | xargs -I {} bash -c 'cd "{}"; npm audit fix'`

Find all directories in `./` having `package.json` file
and the `package.json` file does not contain `"volta":`:

`ls-having -c package.json -i -e '"volta":'`

Find all directories in `./` having `cdk.json` file
and the `package.json` file in the directory has `mocha` specified as a dependency,
then for each of those directories reinstall latest version of `mocha` as dev-dependency:

`ls-having -f cdk.json -c package.json -e '"dependencies":\s*{[^{}]*"mocha":' | xargs -I {} bash -c 'cd {}; npm i -D mocha@latest'`

Find all directories in `~/myrepo1` having `build.gradle` file and a sibling directory `australia`:

`ls-having -f build.gradle -c ../australia ~/myrepo1`

---

## Install ls-having on your Linux distribution

Choose your Linux distribution to get detailed installation instructions. If yours is not shown, get more details on the [installing snapd documentation](https://snapcraft.io/docs/installing-snapd).

[### Arch Linux](https://snapcraft.io/install/ls-having/arch)

[### CentOS](https://snapcraft.io/install/ls-having/centos)

[### Debian](https://snapcraft.io/install/ls-having/debian)

[### elementary OS](https://snapcraft.io/install/ls-having/elementary)

[### Fedora](https://snapcraft.io/install/ls-having/fedora)

[### KDE Neon](https://snapcraft.io/install/ls-having/kde-neon)

[### Kubuntu](https://snapcraft.io/install/ls-having/kubuntu)

[### Manjaro](https://snapcraft.io/install/ls-having/manjaro)

[### Pop!\_OS](https://snapcraft.io/install/ls-having/pop)

[### openSUSE](https://snapcraft.io/install/ls-having/opensuse)

[### Red Hat Enterprise Linux](https://snapcraft.io/install/ls-having/rhel)

[### Ubuntu](https://snapcraft.io/install/ls-having/ubuntu)

[### Raspberry Pi](https://snapcraft.io/install/ls-having/raspbian)
