Skip to content

Instantly share code, notes, and snippets.

@maclarensg
Last active September 17, 2018 03:54
Show Gist options
  • Save maclarensg/d1fa3cf43c5b96e316013082d4618d6d to your computer and use it in GitHub Desktop.
Save maclarensg/d1fa3cf43c5b96e316013082d4618d6d to your computer and use it in GitHub Desktop.
Linux snippets

Epoch

Current Epoch Time

echo $(($(date +'%s * 1000 + %-N / 1000000')))

Set Epoch time

echo $(($(date --date="Sep 17 00:00:00 SGT 2018" +'%s * 1000 + %-N / 1000000')))

Ignore KnownHostsFile StrictHostKeyChecking

ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no [email protected]
Warning: Permanently added '192.168.0.100' (RSA) to the list of known hosts.
[email protected]'s password:

Memory

Check top memory usage**

ps aux --sort -rss | awk '{print $1, $4}' | sed -n '1,30p'

sum with awk**

awk '{sum+=$2}END{print sum;}' 

CPU

show top with threads

top -H

Ps show threads

ps -T -p <main pid>

ps -p <main pid> -L

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment