Wichtige Mac Terminal commands:
Häufig benötigte Terminal-Befehle unter macOS: Dateien zusammenführen, Textstrings ersetzen, Suche und Dateiverwaltung.
Alle text files zusammenführen:
$ for i in *.md; do echo ${i}>>test.txt;cat ${i} >>test.txt; done
Alle files durchgehen und text string ersetzen:
$ perl -pi -w -e ‘s/3AE51/3AE53/g’ ./*.xml
or:
$ find . -name ‘*.eml’ -print0 | xargs -0 sed -i “” “s/Sender: reis24exporter@gmail.com/Sender: noreply@reis24exporter.tscharf.com/g”
Scann for ip addresses used:
$ for ip in $(seq 1 254); do ping -c 1 141.23.176.$ip -W 1; done
Find local PC’s in network:
$ arp -a
Listening for open connections:
$ lsof -i | grep -E “(LISTEN|ESTABLISHED)” | awk ‘{print $1, $8, $9}’
Terminal MAC Adresse ändern / Change MAC address :
$ ifconfig en0 | grep ether
$ sudo ifconfig en0 lladdr 58:e2:8f:36:ba:f
Setup a easy server(everything what you typ will be send to the client):
->Server Terminal:
$ nc -lk 9999
->Client Terminal:
$ curl localhost:9999
Convert Videos .MOV to .AVI :
$ ffmpeg -i movie.mov -acodec copy -vcodec copy movie.avi
Export all pictures from a video :
$ ffmpeg -i Video.mpg Pictures%d.jpg
Server established:
Now all the connections coming to our server on port 8080 will be automatically redirected to 192.168.1.200 server on port 80. But since we are using a pipe, data can only be transferred & to be able to receive the data back, we need to create a two way pipe. Use the following commands to do so:
$ mkfifo 2way
$ ncat -l 8080 0<2way | ncat 192.168.1.200 80 1>2way
->Create a Backdoor for your system on Port 10000:
$ ncat -l 10000 -e /bin/bash
Netcat for more clients:
$ while true; do echo ‘Welcome and Welcome to the example’;done | ncat -l -v -k -p 8380
Disable gatekeeper/app certificate:
$ sudo spctl — master-enable
Convert all pdf to png in folder:
$ for i in *.pdf; do name=$i;name=${name%.*};convert -density 300 $i -background white -alpha remove -alpha off ${name}.png;done
Convert first page of pdf to png in folder:
$ for i in *.pdf; do name=$i;name=${name%.*};echo $name’.pdf[0]’;convert -density 300 $name’.pdf[0]’ -background white -alpha remove -alpha off ${name}.png;done
Convert all page of pdf to png in folder:
$ for i in {1..1900}; do echo $i;done
Auflistung aller offenen Verbindungen:
$ lsof -i -P | grep ESTABLISHED
Check time on server:
$ curl -I https://www.tixforgigs.com/de-de/Event/33295/bucht-der-traumer-2020-greenland-westufer-helenesee-frankfurt-oder | grep “^date”
Find all big files:
$ find / -xdev -type f -size +100M
cat peptides.txt | while read line
do
do something with $line here
done
Resize all images in a folder:
$ mogrify -resize 960 *.png
$ mogrify -resize 960x528 *.png
Freezing dependencies to txt file:
$ pip freeze > requirements.txt
Show biggest file:
$ ncdu

