Skip to content

Latest commit

 

History

History
1720 lines (860 loc) · 34 KB

COMMANDS.md

File metadata and controls

1720 lines (860 loc) · 34 KB

Commands

archive

array

command

cryptography

date

event

filesystem

float

fn-fx

ftp

function

git

http

input

integer

internal

ip

math

misc

output

process

string

system

time

variable

archive compress tar.gz , archive tar.gz

compress file/folder to a .tar.gz file

archive compress tar.xz , archive tar.xz

compress file/folder to a .tar.xz file

archive compress .zip , archive zip

compress file/folder to a .zip file

archive decompress tar.gz , decompress tar.gz

decompress a .tar.gz file to specified path

archive decompress tar.xz , decompress tar.xz

decompress a .tar.xz file to specified path

archive decompress .zip , archive unzip

decompress a .zip file to specified path

array all

access all array elements

array at index

retrieve element from array at specified index (zero based)

array concat

concatenate two arrays

array contains

check if the array contains an element

array declare

declare an array

array delete at

delete element at index from array

array delete

delete entire array

array filter

filter elements of an array based on given grep pattern

array iterate , array forEach

iterate array elements

array length

length of an array

array print , echo array

iterate array elements

array push , array add

push new item to the end of array

array slice , array range

n elements of an array from specified index (zero based)

array replace

find and replace elements in array using regex

array reverse

reverse order of array elements

array set element

set array element at specified index

command failure check , cmd failure check

check if last command failed

hide command error , don't show command error

If a command fails don't show error (suppress stderr)

if command exists , if cmd exists

check if command exists

command nice , cmd nice

run command with desired privilege. n: -20 (highest priority) to 19 (lowest priority)

command renice , cmd renice

change running process priority. n: -20 (highest priority) to 19 (lowest priority)

command , cmd , command substitution , cmd substitution

run command (command substitution)

command substitution

run command (command substitution)

command success check , cmd success check

check if last command succeed

crypto base64 decode

decode variable from base64

crypto base64 encode

encode variable to base64

crypto hash

compute hash of variable (md5, sha, sha1, sha224, sha256, sha384, sha512)

date now short

yyyy/mm/dd

date now dayOfMonth

current day of month (1..31)

date now dayOfWeek

current day of week name (A: full, a: abbreviated)

date now dayOfYear

current day of year (1..366)

date now short

yyyy/mm/dd

date now monthName

current month name (B: full, b: abbreviated)

date now monthNumber

current month number (1..12)

date now UTC

coordinated Universal Time

date now year

current Year (Y: full, y: last two digits)

event CTRL+C , event terminated

register a function (handler) to run on script termination (CTRL+C)

event EXIT

register a function (handler) to run on script exit

iterate directories

write to a file

directory create nested

create nested directories

directory create

create directory

directory delete nested , directory remove nested

delete directory and all contents↑

file delete , file remove

delete file(s)

file read

read a file

file search , search in files , find in files

find files which contain search criteria in given path and below

file write multiline sudo

write multiple lines into file when sudo permission is required

file write multiline

write multiple lines into file

file write

write to a file

iterate files

write to a file

find file , find directory

find files (-type f) or directories (-type d) by name or pattern (*.jpg)

if directory exists

check if a directory exists

if file executable

check if file is executable

if file link

if given path is a symbolic link

if file exists

check if the file exists

if file not empty

check if file size is greater than zero

if file readable

check if file readable

if file writeable

if file writeable

if file newer

check if file1 is newer than file2

if file older

check if file1 is older than file2

if file =

check if files are equal

if path exists

if path exists (file, directory, link...)

remove old/new files/directories

find and remove files(f)/directories(d) older(+)/newer(-) than x days

if float = , if double =

if numbers are equal

if float >= , if double >=

if num1 is greater to num2

if float > , if double >

if num2 is greater than num2

if float <= , if double <=

if num1 is lesser or equal to num2

if float < , if double <

if num1 is lesser than num2

if float != , if double !=

if numbers are not equal

fn animation animate

animate frames of animation with interval seconds between frames circular and pendular

fn animation pacman

pacMan animation (eating input text)

fn banner color

print a color banner.

fn banner simple

function: print a banner with provided title and surrounding character

fn import

import functions from other shellscript files

fn options , fn input choice

provides a list of choices to user and returns the index of selected choice

fn checkbox , fn input multichoice

provides a list of choices to user and returns the index of selected choices

fn math average

calculate average of given integers

fn math factorial

calculate n↑

fn math fibonacci series

array of fibonacci series

fn math fibonacci

calculate Nth fibonacci number

fn math product

calculate product of given integers

fn math sum

calculate sum of given integers

fn progress

progress bar function

fn scan local

scan localhost's port range (tcp/udp)

fn time format seconds

format seconds into days/hours/minutes/seconds

fn urldecode

decodes encoded URL

fn urlencode

encodes URL

fn version compare , fn semver compare

function: compares two semvers and returns >, < or =

fx animation animate

call animate function to start animation

fx animation animate

call animate function to start animation

fx animation pacman

call pacMan animation (eating input text) function

fx banner color

call bannerColor function

fx banner simple

call bannerSimple function

fx import

import functions from other shellscript files located in a directory (default: lib) relative to current file

fx options , fx input choice

call input choice function

fx checkbox , fx input multichoice

call input multichoice function

fx math fibonacci

calculate Nth fibonacci number

fx math average

call math average function

fx math factorial

calculate n↑

fx math fibonacci series

array of fibonacci series

fx math product

call math product function

fx math sum

call math sum function

fx progress

call progress bar function

fx scan local

call scan function to scan localhost over a port range

fx time format seconds

call formatSeconds function

fx urldecode

call urldecode function

fx urlencode

call urlencode function

fx version compare , fx semver compare

call versionCompare function

ftp delete file

delete specified file from ftp server

ftp download

download specified file from ftp server

ftp list

get the list of files on the ftp server at specific path

ftp rename

rename specified file/directory on ftp server

ftp upload

upload specified file to ftp server

function arguments , func args

function all arguments array

function arguments count , func args count

number of function arguments

function , func

function

function return value , func return value , func ret val

last function/command return code

git begin , git start

Initialize git configurations

git branch create

create branch locally and switch into it.

git branch delete local

delete local branch.

git branch delete remote

delete remote branch.

git branch list

list all branches.

git branch push

push branch to remote.

git branch rename

rename current branch.

git changes revert

revert tracked changes

git clone branch https

clone a remote branch to local machine over HTTPS.

git clone branch

clone a remote branch to local machine over SSH.

git clone https

clone remote repository to local machine over HTTPS.

git clone

clone remote repository to local machine over SSH.

git commit list notPushed

list non pushed commits.

git commit search

search for a commit which contains searchCriteria.

git commit undo

undo last N commits (soft: preserve local changes, hard: delete local changes

git commit

commit changes.

git config list

list git configurations.

git config set

configure git.

git patch apply

apply a patch from file

git patch create

create a patch from changes

git remote list

list all remotes

git remote urlAdd https , git remote url add https

add remote url using HTTPS

git remote urlAdd , git remote url add , git remote urlAdd ssh , git remote url add ssh

add remote url using SSH

git remote urlChange https , git remote url change https

change remote url using HTTPS

git remote urlChange , git remote url change , git remote urlChange ssh , git remote url change ssh

change remote url using SSH

git tag commit , git commit tag

tag a commit

git tag list

list all tags

git tag remote delete

delete tag from remote

git tag remote push

push tag to remote

http cookie

send http request with cookies, using curl

http download

download from url and save to /path/to/file, using curl

http GET , http DELETE

send http GET/DELETE request using curl

http header

send http request with custom header, using curl

http POST file

send file with http POST, using curl

http POST , http PUT

send data with http POST/PUT, using curl

input password

get text as input from user without showing characters

input text , ask question

get text as input from user

if int =

if integers are equal

if int >=

if int1 is greater or equal to int2

if int >

if int1 is greater than int2

if int <=

if int1 is lesser or equal to int2

if int <

if int1 is lesser than int2

if int !=

if integers are not equal

for ij

for loop by index

for i

for loop by index

for in collection

for loop in collection

for in column

for loop in collection

for in range

for loop in collection

if

if

iff not

if condition is false then run command (short circuit)

iff

if condition is true then run command (short circuit)

loop infinite

infinite loop

switch case

switch case

loop until

until loop

loop while

while loop

ip local IPs

array of local IPs

ip info

public ip information

ip public

public ip address

math +

add two variables

math const 𝛾

math Euler-Mascheroni constant

math const e

math Napier's constant

math const Ω

math Omega constant

math const ϕ

math golden ration constant

math const π

math PI constant

math --

decrement integer variable

math /=

divide int1 by int2 and assign the whole part to int1

math /

divide int1 by int2 as integers and returns whole part

expr , arithmetic

arithmetic operations on integers

math ++

increment integer variable by 1

let

arithmetic operations on integers

math -=

subtract int2 from int1 and assign the result to int1

math %=

divide int1 by int2 and assign the reminder to int1

math %

reminder of dividing int1 by int2 (modulus)

math *=

multiply int1 by int2 and assign the result to int1

math *

multiply int1 by int2

math +=

add int1 and int2 and assign the result to int1

math ^

exponentiate base to power

math 0.00

math operations with up to scale decimal places precision

math random

generate random integer x such as min <= x <= max

math √ , math sqrt

square root of var up to scale decimal places

math -

subtract int2 from int1

am I not root , am I not sudo

check if script is not running as root (sudo)

am I root , am I sudo

check if script is running as root (sudo)

animation frame

define animation frame

argument parsing , parse args

parse command line arguments (flags/switches)

echo text , print text

print text, variable or both

echo variable , print variable

print text, variable or both

exit code

provide an exit code on error

os is

The OS running on this machine

region , section

comment out a special region (i.e. variable declarations)

shebang , bash , first line

shell shebang

sleep

sleep for a specified amount of time (s: second, m: minute, h: hour, d: day)

stopwatch elapsed

elapsed time

stopwatch start

start stopwatch

stopwatch stop

stop stopwatch

summary

script summary

timeout

run command within a time frame

color black

write in black

color blue

write in blue

color cyan

write in cyan

color green

write in green

color magenta

write in magenta

color red

write in red

color white

write in white

color yellow

write in yellow

format bold

write in bold

format dim

write in dim

format italic

write in italic

format reverse

write in reverse

process ID(s)

find process ID(s) aka PIDs

process instances

list processes

process kill

kill process by name

process list all

list processes

process Name by ID

find process name by it's ID(s)

string concat , string + string

concatenate two strings

string contains , if string contains

check whether string contains substring

string indexOf

first index of substring in a string

if string empty

if string is empty

if string = , string equal

if strings are equal

if string not empty

if string is not empty

if string != , string not equal

if strings are not equal

string length

length of string in characters

string random

random string from provided characters with desired length (default: 8)

string replace all

find all occurrences of a substring and replace them

string replace once

find first occurrence of a substring and replace it

string replace

find all occurrences of a substrings and replace them

string reverse

reverse string characters

string substring count , string substring frequency

frequency of a substring in a string

string substring

part of the string from offset (zero indexed) up to characters length

string toLower

convert string to lowercase

string toUpper

convert string to uppercase

string trim all

remove all white space(s)

string trim left

remove leading white space(s)

string trim right

remove trailing white space(s)

string trim

remove leading and trailing white space(s)

system distro codename

OS codename (i.e. Focal Fossa)

system distro name

OS ID (i.e. Ubuntu)

system distro version

OS Release (i.e. 20.04.2)

system kernel name

OS kernel name (i.e. Linux)

system kernel release

OS kernel release (i.e. 4.4.0-140-generic)

system memory info

system memory information in kilobytes (KB)

system processor architecture , system cpu architecture , system cpu arch

processor architecture (i.e. x86_64)

system processor count , system cpu count

processor count (cores)

system processor model , system cpu model

processor model name (i.e. Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz)

system processor type , system cpu type

OS processor type (i.e. x86_64)

system service manage , system systemd manage

manage service operations

system uptime seconds

system uptime in seconds.

system uptime

system uptime. -p: --pretty, -s: since

time seconds epoch

seconds since epoch (1970-01-01 00:00:00)

time now local

current local time (R: 24hrs, r: 12hrs)

time now local

current local time (R: 24hrs, r: 12hrs)

time now UTC

current UTC time

time now UTC

current UTC time

variable assign , variable set

assign a value or another variable to a new variable

variable default value , assign if empty

assign default value to variable if variable is empty otherwise assign null

var , variable read , variable expand

read the value of a variable