# Script \`nc-shares\` - list shares on command line

**URL:** <https://help.nextcloud.com/t/script-nc-shares-list-shares-on-command-line/185599>\
**Category:** 📑 How to\
**Tags:** admin-scripts, sharing\
**Created:** [March 17, 2024, 10:49pm UTC](https://help.nextcloud.com/t/script-nc-shares-list-shares-on-command-line/185599 "2024-03-17T22:49:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ernolf](https://help.nextcloud.com/user_avatar/help.nextcloud.com/ernolf/32/77874_2.png) [@ernolf](https://help.nextcloud.com/u/ernolf)\
**Post date:** [March 17, 2024, 10:49pm UTC](https://help.nextcloud.com/t/script-nc-shares-list-shares-on-command-line/185599/1 "2024-03-17T22:49:55Z")

</div>

This script lists shares much more clearly than the [sharelisting](https://github.com/nextcloud/sharelisting) app, which only outputs in json or csv format.  
Anyone who needs a quick overview of their shares will certainly be well served with this tool.

I have been using this tool myself for a very long time. However, now I have integrated it into the same framework as my other published scripts. So it uses the same modules, which simplifies publishing as only a module loader is needed. The modules all build on each other, so the wheel doesn’t have to be reinvented for each script.

Installation of the script:

```sh
sudo wget -qO /usr/local/bin/nc-shares https://global-social.net/script/nc-shares
sudo chmod +x /usr/local/bin/nc-shares

```

###### Explanation:

- the first line downloads the script into the directory _`/usr/local/bin`_
- the second line makes it executable

You only need to install it once.  
As all of my scripts it is modular, comes signed and does an integrity check on the first run for the script and checks the hash of the loaded modules on every startup.

Here the help screen (may change in future):

```auto
user@box:~# nc-shares -h

  Usage: nc-shares [-s|--sharetype=(0-13)] -- user|all
          nc-shares -h|--help

  Options: (* = default value)
         -h --help help (print this help information)
         -s --sharetype=[0-13] A number from 0 to 13, meaning:
                                  0 = user
                                  1 = group
                                 (2 = usergroup Internal type used by DefaultShareProvider)
                                * 3 = link (default)
                                  4 = email
                                  5 = contact (ToDo Check if it is still in use otherwise remove it)
                                  6 = remote
                                  7 = circle
                                  8 = guest
                                  9 = remote group
                                 10 = room
                                (11 = userroom Internal type used by RoomShareProvider)
                                 12 = deck
                                (13 = deck user Internal type used by DeckShareProvider)

         user nextcloud user
         all all nextcloud users

  examples:
  list all shares from all users shared with groups
         nc-shares -s 1 -- all
  list all link-shares from user "Max"
         nc-shares Max

```

Feedback and suggestions for improvements/additions are always welcome!

* * *

Good luck,  
ernolf
