Linux Tips
while loop
| while true; do ./exec.sh; sleep 10; done
|
Heredoc
Send a block of text to a command via standard input
Using cat
| cat <<EOF > file.txt
line 1
line 2
EOF
|
Note, this write to file.txt. Use >> file.txt to append
But this doesn't work well with sudo - so better use tee
Using tee
| sudo tee /etc/file.conf > /dev/null <<EOF
data
EOF
|
xarg with awk
J'suis une flemme:
| kubectl get deployment -n default --no-headers | awk '{print $1}' | xargs -r kubectl delete deployment -n default
|
tmux
How to enable logging in tmux?
To log tmux pane output to a file, use the pipe-pane command with a shell command that redirects to a file. i
Start logging current pane
| Ctrl+b
:pipe-pane -o "cat >> ~/tmux-log.txt"
|
Stop logging
Log with timestamp in filename
| Ctrl+b
:pipe-pane -o "cat >> ~/tmux-$(date +%Y%m%d-%H%M%S).log"
|