Commands

July 4, 2024 ยท View on GitHub

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 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.โ†‘

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โ†‘

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โ†‘