# \*Nix Commands

### Create package

Below command will create a package from files located in different directories & files with and without preserving the directory structure.

`-C` is used to change directory and then include the following file. Without it the directory structure is preserved. The files and folder appear in the root directory

```
tar -czf project-name.tar.gz ./bin/startserver.sh -C build/libs project-1.0.jar -C ../../lib/properties log4j2-project.xml
```

### String Operations

Check null value in strings

```
// Check null value in string
my_var="nixCraft"
if [ -z "$my_var" ]
then
      echo "\$my_var is NULL"
else
      echo "\$my_var is NOT NULL"
fi
```

#### &#x20;Split Strings

```
// Split and get the last results
$ foo=hadoop-mapreduce-client-core-2.7.3
$ echo ${foo##*-}

// Split and get a substring    
```

### Miscellaneous

**Find jar versions of all jars in a folder from its manifest file**\
\&#xNAN;*ls | xargs -I {} 'unzip {} META-INF/MANIFEST.MF; version=\`cat META-INF/MANIFEST.MF | grep "Implementation-Version\\|Bundle-Version" | sed "s/Bundle-Version: //" | sed "s/Implementation-Version: //"\`;echo {} -------- $version >> jar-version.txt'*


---

# 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://sauravv.gitbook.io/workspace/nix-commands.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.
