Standard escape codes are prefixed with Escape
:
- Ctrl-Key:
^[
- Octal:
\033
- Unicode:
\u001b
- Hexadecimal:
\x1B
- Decimal:
27
target_host='google.com' | |
interval=2 | |
printf '\nWaiting for host %s' "${target_host}" | |
while true; do | |
if ping -c 2 -i .1 -W .5 ${target_host} > /dev/null; then | |
printf '\rHost is %s up. Time to continue' "${target_host}" | |
break | |
fi | |
#!/bin/bash | |
###### Variables | |
httpd_config='/etc/httpd' | |
PASSWD_FILE="/etc/httpd/passwd/${PASSWD_FILE:-passwords}" | |
httpd_home='/var/www/html' | |
programname="$(basename -- "$0")" | |
INDEX='-Indexes' |
#!/bin/bash | |
infile="$*" | |
if [ -n "$infile" ] | |
then | |
if [ -f "$infile" -a -r $infile ] | |
then | |
sed -e 's/[,;]\([,;]\)/ \1/g;' "$infile" | tr -d \"\'\` | column -t -s\;, |less | |
else |
install_packages () { | |
yum install -y -q "$@" & | |
yum_pid=$! | |
spin='-\|/' | |
i=0 | |
while kill -0 "${yum_pid}" 2>/dev/null; do | |
i=$(( (i+1) %4 )) |
set_color () { | |
local arg2 | |
case $2 in | |
bg|background) | |
arg2=setb | |
;; | |
*) | |
arg2=setf | |
esac |
function gs_set_config() { | |
form='' | |
IP="${1}" | |
options_list="${2}" | |
RET='' | |
if [ -z "$MAX_TRIES" ]; then | |
MAX_TRIES=5 | |
fi |
## To sort a file content and count use the commands below | |
sort list.txt | uniq -c | |
11 Sep 24 | |
21 Sep 25 | |
6 Sep 26 | |
2 Sep 27 | |
# The flag -c in the uniq command returns the total count of equal and consecutive entries |
# Expecify below the filetype (extension) | |
# Change the expression {0:D3} to alter the naming scheme | |
$i=1; Get-ChildItem *.jpg | %{Rename-Item $_ -NewName ('{0:D3}.jpg' -f $i++)} |
List of quick navigation on long comands in the bash terminal | |
Reference: https://www.skorks.com/2009/09/bash-shortcuts-for-maximum-productivity/ | |
Ctrl + a – Go to the start of the command line | |
Ctrl + e – Go to the end of the command line | |
Ctrl + k – Delete from cursor to the end of the command line | |
Ctrl + u – Delete from cursor to the start of the command line | |
Ctrl + w – Delete from cursor to start of word (i.e. delete backwards one word) | |
Ctrl + y – Paste word or text that was cut using one of the deletion shortcuts (such as the one above) after the cursor | |
Ctrl + xx – Move between start of command line and current cursor position (and back again) |