Tags » Shell Script

Creating a shell script to manage the IS service

Hello there,

Today a quick tip that can help to manage the IS if it is down.

To do that, just create a new file .sh with these lines: 97 more words


get values of array in bash

get all values of array

ls /etc | grep passwd | j3RJ; echo ${PIPESTATUS[*]}

get first value of array

ls /etc | grep passwd | j3RJ; echo ${PIPESTATUS[0]}
… 14 more words
Shell Script

find files between dates

find files between two specified dates

find / -type f -newermt 2017-07-01 ! -newermt 2017-08-30 -ls

find files created between begin of current month and the current day … 80 more words

Shell Script

rapid backup file in bash

Append string to filename

cp /etc/fstab{,.backup}

Append string and date to filename

cp /etc/fstab{,.backup.$(date +%Y%m%d)}
Shell Script

Bash: Process Substitution

Connects the output of a command to a named pipe or an open file in /dev/fd. 71 more words


Bash Shell Options: extglob

I was lazy, but now I need the shell more than ever. You may use more patterns than POSIX ones with extglob enabled: 58 more words


calculate how many days until partition is full

number of days until / partition is full

df -m | grep /$ | awk '{ printf "%d\n", $4-$3/1024 }' > /tmp/free_space; find / -path /proc -prune -o -type f -ctime -1 -ls | awk '{n+=$7} END {printf "%d\n", n/1024/1024}' | awk 'BEGIN{ORS=" "} {print}' /tmp/free_space /dev/stdin | awk '{printf "%d%s\n", $1/$2," days until partition / is full"}'; rm -f /tmp/free_space
Shell Script