Hints & Tips

 Extracting / untarring .tar.gz

tar -xvf file.tar.gz

Echoing file change for configs 

echo "server.host: 0.0.0.0 \nelasticsearch.url: \"http://elastic:9200\"" > /opt/kibana/config/kibana.yml

Take the string in quotes and output it into kibana.yml

 

See what ports a server is listening on

netstat -plnt

Or:

nmap localhost

or a portscal using nc or

netstat -tanpul | grep LISTEN

 

In access log look for string local-dev.groupster.io, split the line with spaces and return the 4th element, sort them to get the unique versions (sorting is required first), then count how many lines!

cat access.log | grep "local-dev.groupster.io" | awk -F ' ' '{print $4}' | sort | uniq | wc -l

 

Count how many sockets in TIME-WAIT state

ss | grep TIME-WAIT | wc -l

 

Listing where space is used from the curent folder

du -csh *

Forward a local port to an address and port on the remote machine

ssh -L [bind_address:]port:host:hostport

 

 

Redirect output (stdout and stderr) to file and screen

program [arguments...] 2>&1 | tee out.log

 

Stopping a program to inspect what its doing

Ctrl + Z
bg
<whatever>
fg

 

ldd - see what a program links to

 

ssh tunnel for specific host on target

ssh -L 9090:prometheus.management.order.ri-tech.io:9090 admin@jump.management.order.ri-tech.io -i ~/.ssh/ri.aws.order.management-jump -N

 

Details
Updated: 6th July 2024

Play Blokr Now FREE!
blokr.io the web game where you can eat other blocks!