Search
Notion
CMD
Print number of processes for user:
ps h -Led -o user | sort | uniq -c | sort -n
Bash
Print PIDs of the processes by multiple search patterns (-a to print full process info ):
pgrep -u userName -f 'java.*63(79|80|81|82)'
Bash
Create ext4 filesystem without reserved blocks (-m option):
mkfs.ext4 -m 0 /dev/sdd1
Bash
Create single-shot task to kill multiple processes at specific time:
echo "sleep 50 ; pkill -f 'java.*63(81|82)'" | sudo at $(date +%H:%M -d "+1 min")
Bash
Take mysqldump of particular database to get SCHEMA ONLY:
mysqldump -h HOST -u USR -p PASSWD DATABASE \ --single-transaction \ --column-statistics=0 \ --skip-triggers \ --set-gtid-purged=OFF \ --default-character-set=utf8 \ --no-data \ --result-file schema.sql
Bash
SCP with public key auth:
scp -i ~/.ssh/id_rsa username@12.34.56.78:/remote/path ./
Bash
Run command 3000 times, maximum 500 in parallel:
seq 1 3000 |xargs -I % -n1 -P500 command
Bash
Change time command output format:
TIMEFORMAT='%1lR'; time command
Bash
Compare file sizes:
find ./ -type f -printf '%f %p\n' |xargs -l sh -c 'echo `wc -c ${1}` `wc -c $(find /dir1/ /dir2/ -type f -name "${0}")`' |awk '$1 == $3 {print $2,$4}'
Bash
Check disk io statistics interactive:
iostat -x sda 2
Bash
Test disk for read io limit:
hdparm -tT /dev/sda
Bash
Show disk io-heavy tasks:
iotop -o
Bash
Get GitLab project release tarball URL:
curl -s --header "PRIVATE-TOKEN: *****" "https://gitlab.example.com/api/v4/projects/138/releases/2.1.2" \ |jq -r '.assets.sources[] | select(.format == "tar.gz") | .url'
Bash