Main Page

From whitwiki

Linux Commands


vi tips

Also may be obvious but :%! runs any terminal command on your buffer. I use it to open logs, then grep for stuff. Or grep -v to remove stuff from the logs until you narrow down on what you want.

in vi/vim, you can hit

 :%! jq . 

and it'll validate your json w/o leaving the editor

also another jq tip since I live in json lately

%! jq . --indent 4

This means, please don't make it look awful, thanks.

base64 file transfer with copy/paste

tar -czf - deployment* | base64 -w 0

take the output, and dump it into a file.

then on the other end:

base64 -d < end.txt | tar -xvzf - 

better netstat

 ss -altp 


for port in 22 80 443
  if echo -n | nc -w1 localhost "$port" > /dev/null 2>&1; then
    echo "port ${port} on localhost: open"
    echo "port ${port} on localhost: closed"

find a startup app in systemd

systemctl list-unit-files |grep -I blah

ls for lazy people

This is just an alias for ls that'll add the numerical permission set before each line. Because people are lazy. And can't add

alias lso='ls -alG | awk '\''{k=0;for(i=0;i<=8;i++)k+=((substr($1,i+2,1)~/[rwx]/)*2^(8-i));if(k)printf(" %0o ",k);print}'\'