# File Storage and Compression

* `quota`
  * Luria has a disk usage quota on the head node. You can use the `quota` command to check what the size of the quota is and how much space you're currently using.
  * The `-s` flag will display the quota in a human-readable format. (e.g. 18K, 14M, 65G).

```bash
quota -s

Disk quotas for user asoberan (uid 247789): 
     Filesystem   space   quota   limit   grace   files   quota   limit   grace
/dev/mapper/cl-home
                  4391M  18432M    100G           24925       0       0        

# Space column shows how much space you're currently using on the head node
# Quota column is total amount of space allotted to you
```

* `du`
  * Stands for "disk usage". Reports how much disk space a directory is taken up.
  * Defaults to displaying the disk usage in kilobytes, but passing it the `-h` flag will return disk usage in a human-readable format. (e.g. 18K, 14M, 65G).
  * Will search the entire depth of the Unix tree starting from the directory you give it. You can control the depth which it searches by passing the `-d <num>` flag.

<pre class="language-bash"><code class="lang-bash"><strong># Displays the disk usage of every file under your home directory
</strong># The last entry will be the disk usage of your entire home directory
du -h ~

# Displays the disk usage of every file and directory immediately
# under your home directory
du -h -d 1 ~

# Displays the disk usage of one file, file.txt
du -h file.txt
</code></pre>

* `tar`
  * Combines multiple files or directories into one archive for easy sharing. Similar to "zipping" files, however tar does not compress by default.
  * Create an archive by passing the `-cf` flags
  * Can compress multiple files/folders using `gzip` by passing the `-z` flag when creating a new archive.
  * Useful when you have files that take up a lot of space and you want to save space.
  * Extract an archive by passing the `-xf` flags. Un-compress an archive by passing the `-z` flag to those two flags. &#x20;

```bash
# Create an archive of a directory and name it my_directory.tar
tar -cf my_directory.tar <directory>

# Create a compressed archive of a directory and
# name it my_compressed_directory.tar.gz
tar -czf my_compressed_directory.tar.gz <directory>

# Extract archive my_directory.tar
tar -xf my_directory.tar

# Uncompress the archive my_compressed_directory.tar.gz
tar -xzf my_compressed_directory.tar.gz
```

* `zip`
  * Zip multiple files and directories into one file. Zipping is similar to archiving with `tar`, but zipped files are easier to deal with on Windows machines.

```bash
# Zip a directory to the file my_directory.zip
zip my_directory.zip <directory>

# Unzip my_directory.zip
unzip my_directory.zip
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://igb.mit.edu/mini-courses/introduction-to-unix/files/file-storage-and-compression.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
