---
title: "Metadata management using GoCommands"
description: "List, add, and remove metadata on Data Store data objects, collections, resources, and users with GoCommands."
type: Guide
tags:
  - GoCommands
  - Metadata
generated:
  by: "claude/opus-5"
  at: "2026-09-11T00:00:00Z"
sources:
  - id: cyverse-learning-materials
    resource: "https://github.com/CyVerse-learning-materials/learning-materials-home/blob/b7392d21be4fd6a67d051847f98c81a18e058a12/docs/ds/gocommands/metadata_management.md"
    title: "CyVerse Learning Materials: docs/ds/gocommands/metadata_management.md"
    author: "team:cyverse"
    last_modified: "2025-03-25T14:01:09-07:00"
---

# Metadata management using GoCommands

GoCommands provides features to manage metadata for data objects, collections, resources, and users in the Data Store using the `lsmeta`, `addmeta`, and `rmmeta` commands.

Metadata consists of three components:

- **Name (Attribute):** The name of information.
- **Value:** The actual data or information.
- **Unit (Optional):** Specifies the unit of measurement, if applicable.


---

## :material-tag-edit-outline: List Metadata of Data Objects, Collections, Resources, or Users

```sh
gocmd lsmeta [flags] <irods-object>...
```

### iRODS Objects 

| iROD Object | Flag | Description |
|-------------|-------------|--------|
| `data object` or `collection` | `-P` | List metadata of data objects or collections |
| `resource` | `-R` | List metadata of resources |
| `user` | `-U` | List metadata of users |

### Example Usage

1. **List metadata of a data object:**
    ```sh
    gocmd lsmeta -P /iplant/home/myUser/file.txt
    ```

2. **List metadata of multiple data objects:**
    ```sh
    gocmd lsmeta -P /iplant/home/myUser/file1.txt /iplant/home/myUser/file2.txt
    ```

3. **List metadata of a collection:**
    ```sh
    gocmd lsmeta -P /iplant/home/myUser/dir
    ```

4. **List metadata of a resource:**
    ```sh
    gocmd lsmeta -R myResc
    ```

5. **List metadata of a user:**
    ```sh
    gocmd lsmeta -U myUser
    ```

## :material-tag-edit-outline: Add Metadata to Data Objects, Collections, Resources, or Users

```sh
gocmd addmeta [flags] <irods-object> <metadata-name> <metadata-value> [metadata-unit]
```

### iRODS Objects 

| iROD Object | Flag | Description |
|-------------|-------------|--------|
| `data object` or `collection` | `-P` | Add metadata to a data object or collection |
| `resource` | `-R` | Add metadata to a resource |
| `user` | `-U` | Add metadata to a user |

### Example Usage

1. **Add metadata to a data object:**
    ```sh
    gocmd addmeta -P /iplant/home/myUser/file.txt meta_name meta_value
    ```

1. **Add metadata to a data object with metadata-unit:**
    ```sh
    gocmd addmeta -P /iplant/home/myUser/file.txt meta_name meta_value meta_unit
    ```

3. **Add metadata to a collection:**
    ```sh
    gocmd addmeta -P /iplant/home/myUser/dir meta_name meta_value
    ```

4. **Add metadata to a resource:**
    ```sh
    gocmd addmeta -R myResc meta_name meta_value
    ```

5. **Add metadata to a user:**
    ```sh
    gocmd addmeta -U myUser meta_name meta_value
    ```

---

## :material-tag-edit-outline: Remove Metadata from Data Objects, Collections, Resources, or Users

```sh
gocmd rmmeta [flags] <irods-object> <metadata-ID-or-name>
```

**Note:** The `metadata-ID` is a numeric identifier for the metadata. It can be obtained from the output of the `lsmeta` command.

### iRODS Objects 

| iROD Object | Flag | Description |
|-------------|-------------|--------|
| `data object` or `collection` | `-P` | Remove metadata from a data object or collection |
| `resource` | `-R` | Remove metadata from a resource |
| `user` | `-U` | Remove metadata from a user |

### Example Usage

1. **Remove metadata from a data object by name:**
    ```sh
    gocmd rmmeta -P /iplant/home/myUser/file.txt meta_name
    ```

2. **Remove metadata from a data object by ID:**
    ```sh
    gocmd rmmeta -P /iplant/home/myUser/file.txt 979206950
    ```

3. **Remove metadata from a collection:**
    ```sh
    gocmd rmmeta -P /iplant/home/myUser/dir meta_name
    ```

4. **Remove metadata from a resource:**
    ```sh
    gocmd rmmeta -R myResc meta_name
    ```

5. **Remove metadata from a user:**
    ```sh
    gocmd rmmeta -U myUser meta_name
    ```

<p class="carc-provenance" markdown>Adapted from [CyVerse Learning Materials](https://github.com/CyVerse-learning-materials/learning-materials-home/blob/b7392d21be4fd6a67d051847f98c81a18e058a12/docs/ds/gocommands/metadata_management.md){target=_blank} (last source update 2025-03-25), CC BY 4.0. Spotted a problem? [Open an issue](https://github.com/UNM-CARC/cyverse/issues){target=_blank}.</p>
