IT nerd

  • 0 Posts
  • 4 Comments
Joined 2 years ago
cake
Cake day: June 22nd, 2023

help-circle

  • There are a lot of great commands in here, so here are my favorites that I haven’t seen yet:

    • crontab -e
    • && and || operators
    • “>” and >> chevrons and input/output redirection
    • for loops, while/if/then/else
    • Basic scripts
    • Stdin vs stdout vs /dev/null

    Need to push a file out to a couple dozen workstations and then install it?

    for i in $(cat /tmp/wks.txt); do echo $i; rsync -azvP /tmp/file $i:/opt/dir/; ssh -qo Connect timeout=5 $i “touch /dev/pee/pee”; done

    Or script it using if else statements where you pull info from remote machines to see if an update is needed and then push the update if it’s out of date. And if it’s in a script file then you don’t have search through days of old history commands to find that one function.

    Or just throw that script into crontab and automate it entirely.


  • You can do “ss -aepni” and that will dump literally everything ss can get its hands on.

    Also, ss can’t find everything, it does have some limitations. I believe ss can only see what the kernel can see(host connections), but tcpdump can see the actual network flow on the network layer side. So incoming, outgoing, hex(?) data in transit, etc.

    I usually try to use ss first for everything since I don’t think it requires sudo access for the majority of its functionality, and if it can’t find something then I bring out sudo tcpdump.