Cheat Sheet
Useful bash commands and snippets.
apt-cache policy kubelet
apt-get install kubelet=1.13.4-00
apt-mark hold kubelet kubeadm kubectl
apt-mark unhold kubelet kubeadm kubectl
for user in $(cut -f1 -d: /etc/passwd); do crontab -u $user -l; done
du -sch .[!.]* * |sort -h
du -hsc * |sort -h
sudo apt install ncdu
ncdu
find . \
-name "*.txt" \
-maxdepth 2 \
-type d \
-exec du -csh --block-size=1M {} \;
find . -name "server.log-2018*" \
-print0 | xargs -0 rm -f
find . -type f -print0 | xargs -0 sed -i 's/OLD/NEW/g'
Sort by second column:
grep -air "count-" file-name* |sort -k2
List all hard drives and partitions:
sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL
Get 20 most recent:
journalctl -n 20
journalctl -u kubelet
#!/bin/bash
service=mongod
if (( $(ps -ef | grep -v grep | grep $service | wc -l) > 0 ))
then
echo "$service is running!!!"
else
/etc/init.d/$service start
fi
sudo /bin/dd if=/dev/zero of=/var/swap.0 bs=1M count=1024
sudo /sbin/mkswap /var/swap.0
sudo /sbin/swapon /var/swap.0
echo "/var/swap.0 swap swap defaults 0 0" >> /etc/fstab
Replace 1024 with your desired swap size in MB.
sudo swapoff -a
systemctl is-enabled PROCESS-NAME-HERE
systemctl list-units --type service --all
Input
ctrl+]
Then execute:
close
wget \
--recursive \
--no-clobber \
--page-requisites \
--html-extension \
--convert-links \
--restrict-file-names=windows \
--domains devops.buzz \
--no-parent \
https://www.devops.buzz/public/
Last modified 2yr ago