Linux Scripting with Shell/AWK/SED

- The beginning



- Debian wcurl


- Linux Boot Process #linux #boot


- deactivate pc speaker

└──╼ $sudo modprobe -r pcspkr

- progress bar script

a='-\|/'; or a='<^>v';

seq 0 50| while read i; do echo -en "\b${a:$((i%4)):1}"; sleep 1; done

a='<^>v';

echo -n $"Stopping Jboss:  " && seq 0 50|

while read i; do 

echo -en "\b${a:$((i%4)):1}";

sleep 1;

done


- split crt/pem 64 charters

cat cert.txt |sed "s/$(printf '%64s'|tr ' ' '.')\B/&\n/g"

- check open ports without netstat

declare -a array=($(tail -n +2 /proc/net/tcp | cut -d":" -f"3"|cut -d" " -f"1")) && for port in ${array[@]}; do echo $((0x$port)); done | sort | uniq

- java memory eats VMSwap (process time);

javapids=$(pidof java); for pid in ${javapids[@]}; do printf "pid $pid is using:"; (grep --color VmSwap /proc/$pid/status); done

pid 28780 is using:VmSwap:             0 kB

pid 6779 is using:VmSwap:              0 kB

pid 6749 is using:VmSwap:              0 kB

pid 6665 is using:VmSwap:              0 kB

pid 6649 is using:VmSwap:              0 kB

pid 6442 is using:VmSwap:          12280 kB

pid 6426 is using:VmSwap:          28272 kB


- awk print rows 1 and 10 and columns 1 and 3 from /etc/passwd in Linux  

awk -F ":" ' NR==1,NR==10 { print $1,$3 } ' /etc/passwd

root 0
bin 1
daemon 2
adm 3
lp 4
sync 5
shutdown 6
halt 7
mail 8
operator 11
- Crowdstrike

- How to use the TR command

a) upper cases
└──╼ $echo "Hello World"| tr [a-z] [A-Z]
HELLO WORLD


- Linux Slackware - history
Slackware was born in 1993, when Patrick Volkerding was a student at Minnesota State University Moorhead and helped a professor install SLS. Today Slackware is the oldest distribution that’s still maintained, and Volkerding is still the person handling that. #linux #slack
Image



- Path split with tr

- Linux Shell Script Structure







Comentarii

Postări populare de pe acest blog

Politics Meme

CS Lewis

Economic Crysis