Great simple test for network speed on a box without speedtest-cli or other tools installed.
using pv (pipeviewer) instead of cat to get a progress bar when grepping huge files.
Using httpie instead of curl so I can remember the flags.
The power of find -exec to run commands on a lot of specific files. The nice part is you can run it without exec first to see if you have the right set of files.
If you do a loop you can echo -e “$somevar\r” and then each write will overwrite the previous line so you screen doesn’t fill up but you do get a feel for the progress (to make it nice you need to pad with spaces, google for echo carriage return to learn more)
df -h /; echo "----"; for fattable in $(find /var/lib/mysql/ -name *.ibd -size +1G -exec ls -lh {} \; | awk '{ print $9 }' );do echo BEFORE " " $(ls -lh $fattable| awk '{ print $5" " }'); db=$(echo $fattable| cut -d/ -f5); otable=$(echo $fattable| cut -d/ -f6| cut -d. -f1); echo mysql -qbse \"use $db \; optimize table $otable\;\"|bash;echo AFTER" "" " $(ls -lh $fattable| awk '{ print $5" " }');echo "----" ;done; echo "----"; df -h /
apachectl fullstatus | grep ^[0-9]| awk '{ print $12" "$14 }' | sort | uniq -c| sort -n |tail
tail -100000 /var/log/nginx/access.log | sed "/$(hostname -i)/d" | awk '{ print $1" "$7 }' | sort | uniq -c | sort -n | tail -050
find . -mtime -1 | cut -d/ -f2 |uniq
pkill lsphp; sleep 2; while true; do sleep .4; strace -p $(ps aux | grep [i]ndex| awk '{ print $2 }' | head -01); done
for file in /proc/*/status ; do awk '/VmSwap|Name/{printf $2 " " $3}END{ print ""}' $file 2>/dev/null; done| awk '{ print $2" "$3" "$1 }' | sort -n | tail -20
find . -size +200M -exec ls -lh {} \; | awk '{ print $5" "$9 }'
awk '{ print $4 }'
https://explainshell.com/ vimdiff <( jq < /tmp/file1.json ) <( jq < /tmp/file2.json )
Install Tailscale on your machines, and your work machine is always just one ssh command away.
alias ll=“ls -l”
alias lln=“ls -lrt”
Apart from this, I have a few aliases defined to get the size of specific folders and their subfolders (using ‘du -h’ for human readable sizes). The aliases are named like “duh”, “dut” and so on.
git grep foo | cut -d: -f1 | uniq
rg -l foo | uniq
<make/build script> 2>&1 | tee build.log | grep <whatever>
2) Do everything within GNU Screen window with CTRL-A + Shift-H to log all output to logfile i.e. "screenlog.<window num>".
Both lifesavers when working with multiple systems and codebases.
3) Always use "set -o vi" with bash so that i can use vi/vim keybindings across everything.
tmux users can use it's `capture-pane` command, either before or after the fact if history is set big enough. There are several helpful flags worth researching.
e.g. `tmux capture-pane -pS - > ~/tmux.log` in a shell to save the history of that pane, or just `prefix+: capture-pane ...` from within tmux
docker ps
docker kill
git switch
git commit
git push
TheNewAndy•9h ago
More to the letter of the question, I use "cd -" frequently, "ps -e | grep some_process_i_would_like_the_pid_for", and while I don't use it frequently, I didn't know about "ssh-copy-id" for a long time, and would do it manually with a text editor in the past. Sorry if they are not sufficiently fancy - but for things to get used day to day for me, they will need to be short and sweet.
vinhnx•9h ago
scrapheap•7h ago
000ooo000•7h ago
scrapheap•7h ago