Bash Useful Examples
A collection of simple Bash scripts.
Getting Started
Hello.sh: get a simple output
Process.sh: execute more than one command in a script
Interactive.sh: a simple but very much interactive script
Special-Pattern.sh: draw a diamond pattern with dots(.)
While-Read.sh: read lines from a file using while loop
Read-Menu.sh: display a menu for system information
While-Menu.sh: a repeated menu for system information
Affect.sh: print a spinner loader
Colorful.sh: provide you with the output of several colours
Convertlowercase.sh: convert data either from the file or standard input to lowercase
up.sh: move up a directory in shell script
List-dir.sh: list files in a directory
Count-lines.sh: print out the line number of each file in current directory
Randomfile.sh: create unique file/folder automatically with date and time stamp
Random-emoji.sh: print ramdom emojis
pomodoro.sh: a simple pomodoro app written in bash
Programming
VersionCompare.sh: compare two version number
Utility
Encrypt.sh: encrypt a file/folder with password
Archive-and-encrypt.sh: archive a path into a file and encrypt the file
weather.sh: check the weather in a specified location or using the geolocation of the ip address by default.
WhereIP.sh: Get location of an IP address.
System Administration
DirectorySize.sh: output a specified directory's size
Test-File.sh: evaluate the status of a file/directory
Server-Health.sh: report server related information
CPU.sh: report if CPU usage exceeds the threshold
Disk-Space.sh: check if the disk space crosses the limit
CollectNetworkInfo.sh: gather information related to server
RemoteBackup.sh: backup a local file into a remote server
HardwareInfo.sh: show hardware information for systems Linux
Get-Temperature.sh: show CPU temperature
Math
Addition.sh: perform addition of two numbers
Subtraction.sh: perform subtraction of two numbers
Multiplication.sh: perform multiplication of two numbers
Division.sh: perform division of two numbers
Simplecacl.sh: a simple calculator
Table.sh: print table of any number
EvenOdd.sh: check if a number input from standard input is odd or even
Factorial.sh: generate the factorial of a number
Armstrong.sh: check if a provided number is Armstrong or not
Prime.sh: check if a number is prime or not
Fibonacci.sh: test if a number being entered is a Fibonacci or not
Decimal2Binary.sh: convert Decimal Number to Binary
Binary2Decimal.sh: convert Binary Number back to decimal
Decimal2Hex.sh: convert Decimal Number to Hex
Hex2Decimal: convert Hex number back to Decimal
Image manipulation
thumbnail.sh: create 400px thumbnails from images in a folder
Practise More!
Last updated