# Bash Useful Examples

### Getting Started

1. [Hello.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/hello-world.sh): get a simple output
2. [Process.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/process.sh): execute more than one command in a script
3. [Interactive.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/interactive.sh): a simple but very much interactive script
4. [Special-Pattern.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/special-pattern.sh): draw a diamond pattern with dots(.)
5. [While-Read.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/while-read.sh): read lines from a file using while loop
6. [Read-Menu.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/read-menu.sh): display a menu for system information
7. [While-Menu.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/while-menu.sh): a repeated menu for system information
8. [Affect.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/affect.sh): print a spinner loader
9. [Colorful.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/color.sh): provide you with the output of several colours
10. [Convertlowercase.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/convertlowercase.sh): convert data either from the file or standard input to lowercase
11. [up.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/up.sh): move up a directory in shell script
12. [List-dir.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/list-dir.sh): list files in a directory
13. [Count-lines.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/count-lines.sh): print out the line number of each file in current directory
14. [Randomfile.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/randomfile.sh): create unique file/folder automatically with date and time stamp
15. [Random-emoji.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/random-emoji.sh): print ramdom emojis
16. [pomodoro.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/pomodoro.sh): a simple pomodoro app written in bash

### Programming

1. [VersionCompare.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/versioncompare.sh): compare two version number

### Utility

1. [Encrypt.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/encrypt.sh): encrypt a file/folder with password
2. [Archive-and-encrypt.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/archive-and-encrypt.sh): archive a path into a file and encrypt the file
3. [weather.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/weather.sh): check the weather in a specified location or using the geolocation of the ip address by default.
4. [WhereIP.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/whereIP.sh): Get location of an IP address.

### System Administration

1. [DirectorySize.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/directorysize.sh): output a specified directory's size
2. [Test-File.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/test-file.sh): evaluate the status of a file/directory
3. [Server-Health.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/server-health.sh): report server related information
4. [CPU.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/cpu.sh): report if CPU usage exceeds the threshold
5. [Disk-Space.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/disk-space.sh): check if the disk space crosses the limit
6. [CollectNetworkInfo.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/collectnetworkinfo.sh): gather information related to server
7. [RemoteBackup.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/remotebackup.sh): backup a local file into a remote server
8. [HardwareInfo.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/hardware_machine.sh): show hardware information for systems Linux
9. [Get-Temperature.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/get-temperature.sh): show CPU temperature

### Math

1. [Addition.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/addition.sh): perform addition of two numbers
2. [Subtraction.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/subtraction.sh): perform subtraction of two numbers
3. [Multiplication.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/multiplication.sh): perform multiplication of two numbers
4. [Division.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/division.sh): perform division of two numbers
5. [Simplecacl.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/simplecalc.sh): a simple calculator
6. [Table.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/table.sh): print table of any number
7. [EvenOdd.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/evenodd.sh): check if a number input from standard input is odd or even
8. [Factorial.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/factorial.sh): generate the factorial of a number
9. [Armstrong.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/armstrong.sh): check if a provided number is Armstrong or not
10. [Prime.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/prime.sh): check if a number is prime or not
11. [Fibonacci.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/fibonacci.sh): test if a number being entered is a Fibonacci or not
12. [Decimal2Binary.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/decimal2binary.sh): convert Decimal Number to Binary
13. [Binary2Decimal.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/binary2decimal.sh): convert Binary Number back to decimal
14. [Decimal2Hex.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/dec2hex.sh): convert Decimal Number to Hex
15. [Hex2Decimal](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/hextodec.sh): convert Hex number back to Decimal

### Image manipulation

1. [thumbnail.sh](https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/simple-bash-scripts/master/scripts/thumbnail.sh): create 400px thumbnails from images in a folder

{% hint style="info" %}
**Reference:**

<https://github.com/Advance-Innovation-Centre-AIC/simple-bash-scripts>
{% endhint %}

{% hint style="info" %}
**Practise More!**

<https://cheatsheets.zip/bash>
{% endhint %}


---

# 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://docs.aic-eec.com/computer-operation-systems/zero-to-linux-hero/anatomy-of-linux-system/basic-bash-script/experiment-02-system-variable-and-condition-bash-script/bash-useful-examples.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.
