Skip to content

Instantly share code, notes, and snippets.

@romiras
Created November 28, 2024 23:08
Show Gist options
  • Save romiras/7da4560d5bf08139673f63b1a7bd9bbf to your computer and use it in GitHub Desktop.
Save romiras/7da4560d5bf08139673f63b1a7bd9bbf to your computer and use it in GitHub Desktop.
Shell commands 2020
cat /etc/lsb-release
sudo apt autoremove
sudo apt update && sudo apt upgrade
sudo apt-cache search
apt-cache show
sudo apt-get install --reinstall apparmor apparmor-profiles apparmor-utils
sudo ntpdate il.pool.ntp.org
grep microcode /proc/cpuinfo
sudo usermod -aG docker $USER
groups
sudo groupadd docker
docker run hello-world
pstree -u $USER
pstree -pnT 213095
rsync -av /from to/
cat bak-conf-list.txt | xargs tar czvf bak-`date +%F`.tgz
sudo -E printenv | less
sudo -E printenv | grep AWS
sudo hwinfo
sudo hwinfo --short
sudo lsmod
sudo lshw -c video
sudo fsck.ext4 -fn /dev/nvme0n1p1
sudo fsck.ext4 -V -fn /dev/nvme0n1p1
curl https://checkip.amazonaws.com
source ~/.bashrc
lsof -i :3306
htop -u $USER
ps -ef |rg docker
rename 's/_example//' *_example
# sudo wget -qO - HTTPS-REMOTE/DEB-GPG-KEY | sudo apt-key add -
ssh-keygen -t rsa -C "[email protected]"
ssh-add -L
ssh -T [email protected]
ssh -T [email protected]
git config --global url."[email protected]:".insteadOf "https://gitlab.com/"
git config --global user.name "John Smith"
git config --global user.email "[email protected]"
df -hT | grep -v squashfs
dd if=/dev/zero of=dummy_10mb bs=1048576 count=10
sudo pmap -x 6861 | tail -1
cat /proc/6861/smaps | bv
# echo benchmarking OpenSSL; openssl speed
ulimit -Sv 60000
cgexec -g memory:lowMem bin/rails s
netstat -tlpn4
dpkg -S /usr/bin/aa-notify
dpkg -l 'open-vm-tool*'
sudo apt-add-repository ppa:webupd8team/java
sudo update-alternatives --config javac
sudo nano /etc/systemd/logind.conf
find ~/Documents -type f \( -iname "*.zip" -o -iname "*.docx" -o -iname "*.xlsx" -o -iname "*.od?" \)
find . -type d -name delme -exec echo rm -rf "{}" \;
rename 's/\.bak~$/.bak/' *.bak~
zsync -i ubuntu-gnome-18.04.1-desktop-amd64.iso http://cdimage.ubuntu.com/ubuntu-gnome/releases/18.04/release/ubuntu-gnome-18.04.4-desktop-amd64.iso.zsync
nc -zv 1.2.3.4 3000
nc -l 8125
nc -u -l 8125
nc -u -4 -w 1 localhost 8125
nc -u -l 8125 > file.txt 2>&1
nc -u 8125
nc -u localhost 8125
#for n in `seq 1 5`; do echo -n "some.metric$n.namespace:1|c"| nc -u -q0 -4 -w 1 localhost 8125; done
for n in `seq 1 5`; do echo "some.metric$n.namespace:1|c"| nc -u -q0 -4 -w 1 localhost 8125; done
sudo netstat -p | grep 4647
sudo nmap -sS 10.0.0.12
sudo nmap -sS -Pn 10.0.0.12
sudo nmap --top-ports 10.0.0.12
sudo dmesg
sudo tail -f /var/log/kern.log
sudo tail -f /var/log/syslog
sudo journalctl --disk-usage
sudo journalctl --vacuum-size=500M
sudo snap set system refresh.retain=2
sudo ls -la /var/snap/docker/common/var-lib-docker/overlay2|less
docker system prune -a -f
pkill __debug_bin
pstree -p 43724
mkdir -p ~/.local/share/fonts; fc-cache -f
# echo -e "foo\nbar\nbaz" | ts '[%F %T]'
# echo '' | jsonpp
echo 'uPcASe' | ruby -p -e '$_.tr! "a-z", "A-Z"'
jq -c . < inp.json | pv > out.json
bzcat w1.txt.bz2 | egrep -v '^#' | grep svc | q -T -d ' ' "SELECT c5 as Action, count(*) as Qty FROM - GROUP BY Action" | less
# cat 18.csv |q -T -d ' ' ""
cat 18.csv |grep Prod | q -T -d ' ' "SELECT cast(strftime('%H',c2) as integer) as hour, c5 as Action, count(case when cast(c10 as integer)/100=2 then c10 end), count(case when cast(c10 as integer)/100=4 then c10 end), count(case when cast(c10 as integer)/100=5 then c10 end) FROM - GROUP BY hour, Action" | sed -E "s/\/.*\/(.*)$/\1/g" |less
cat 18.csv |grep Prod | q -T -d ' ' "SELECT cast(strftime('%H',c2) as integer) as hour, c5 as Action, count(case when cast(c10 as integer)/100=2 then c10 end), count(case when cast(c10 as integer)/100=4 then c10 end), count(case when cast(c10 as integer)/100=5 then c10 end) FROM - GROUP BY hour, Action ORDER BY Action, hour" | sed -E "s/\/.*\/(.*)$/\1/g" |less
zgrep web.1 file.tsv.gz | ruby -p -e 'cols = $_.split("\t"); $_ = "#{cols[1]}\t#{cols.last}"' | less
awk '{print length($1)}' DAT_000_000002.csv | sort -n | uniq -c
echo '<h1>hello, world</h1>' | bcat
gplothist < stat1.csv | bcat
head mon_events.log | jq -c '.data.Tasks' | bv
rg -C 5 _id .
nm -D /usr/lib/libruby-1.9.1.so.1.9 | less
objdump -T /usr/lib/libruby-1.9.1.so.1.9 | less
PKG_CONFIG_PATH=.rbenv/versions/2.3.5/lib/pkgconfig/ pkg-config --cflags --libs ruby-2.3
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF ..
cmake --build . -- -j$(nproc)
http --form POST https://trid-lookup-demo.herokuapp.com/detect file@~/.config/dconf/user
mysqldump -u USER1 -p --insert-ignore -t DB_name | pv
innotop -h $(cat ~/stg.txt | awk '{print $1}') -u $(cat ~/stg.txt | awk '{print $2}') -p $(cat ~/stg.txt | awk '{print $3}')
pt-mysql-summary -h $(cat ~/stg.txt | awk '{print $1}') -u $(cat ~/stg.txt | awk '{print $2}') -p $(cat ~/stg.txt | awk '{print $3}') --all-databases
mysqladmin status -c 5 -i 10 -h $(cat ~/stg.txt | awk '{print $1}') -u $(cat ~/stg.txt | awk '{print $2}') -p$(cat ~/stg.txt | awk '{print $3}')
sudo mysql --defaults-file=/etc/mysql/debian.cnf
find . -type f -name "*.rej" -print -exec rm {} \; && find . -type f -name "*.orig" -print -exec rm {} \;
find . -type f \( -name '*_BACKUP_*' -o -name '*_BASE_*' -o -name '*_LOCAL_*' -o -name '*_REMOTE_*' \) -delete
fsql "select * from . where name like '%.txt' and FORMAT(size, KB) > 1"
find . -type f -mtime -1
find . -type f -mtime -1 | rg '\.go'
find . -type d
find . -type f -executable
for f in *.sh; do shellcheck $f; done | bv
find . -type f -name 'rollbar.rb'
time git fetch -v
# git remote -v
# git config -l
# git diff > -`date +'%F-%H%M'`.patch
# git st | egrep "^(\s?M|A|R)"
# git st -- app config db lib vendor | grep -F "?"
# git st -- db/migrate/
# git reset --hard HAR^
# git reset --soft HEAD^
# git merge --squash branch1
# git mergetool
# git difftool
git merge --squash --no-ff branch-tmp
git rebase -i dev
git lg --color=never --reverse
# git merge --no-commit --no-ff BRANCH
# git lg --no-merges tag1..HEAD
# git cherry-pick
# git ci --amend
# git bisect start BAD GOOD
git bisect bad
git bisect good
# patch -p1 -R < run-dev.patch
# git lg origin/master..HEAD | bcat
# git stash && git pull && git stash pop
# git stash pop
gem update --system
bundle check
bundle install
bundle exec rackup
rails about
# bin/rake -T
bin/rails r 'puts ActiveSupport::Dependencies.autoload_paths'
# env $(grep -v ^# .env | xargs) bin/rake -T
# bin/rake routes |
tailf log/development.log
# bin/rake db:migrate:status | tail
rspec
# bin/rake jobs:workoff
# bin/rake admin:task; echo "Exit code: $?"
rails generate active_admin:install
rails generate devise:install
WEB_CONCURRENCY=1 rails s
foreman start
cap integration deploy:check
sudo npm install -g typescript
sudo npm install -g @angular/[email protected]
npm ls @angular/cli
npm install -g @angular/cli@9
npm install; alert
npm audit fix
ng serve
# heroku ps:restart web.1 -a APP
# heroku apps:info -a APP
# heroku run rails db:seed -a APP
# heroku run rake db:migrate -a APP
docker run --rm -it ruby:2.6-buster bash
docker run --rm -v `pwd`:/tmp/app gliderlabs/herokuish /bin/herokuish test
docker run --rm -v ~/docker_data/prometheus:/prometheus:z -v "$HOME/Foo/prometheus-statsd-integration-example/prometheus.yml:/tmp/prometheus.yml" -p 9090:9090 -it prom/prometheus "--config.file=/etc/prometheus/prometheus.yml"
docker run -d -v ~/docker_data/rabbitmq-data:/var/lib/rabbitmq --hostname perun-rabbit --name rabbit_dev1 -p 5672:5672 -p 15672:15672 rabbitmq:3.7-management-alpine
docker restart rabbit_dev1
docker rmi $(docker images --filter "dangling=true" -q --no-trunc)
docker images --digests=true
docker images | grep none | awk '{ print $3; }' | xargs docker rmi --force
docker run --rm --net=host -p 5000:5000 -e 'PORT=5000' -ti gin_app
docker-compose up -d
docker run --rm --name alpine_latest -it alpine sh
docker container ls
docker ps
docker build -t go-app --build-arg aws_region=$AWS_REGION --build-arg access_key=$AWS_ACCESS_KEY_ID --build-arg secret_key=$AWS_SECRET_ACCESS_KEY .
docker run --rm --entrypoint /bin/sh -it hashicorp/terraform:0.15.2 which terraform
docker run -it --entrypoint /bin/sh --rm prom/prometheus
docker build -f Dockerfile-producer -t amqp_demo .
docker run -e 'AMQP_URI=amqp://localhost:5672' --rm --network host -it amqp_demo
docker build -f Dockerfile-consumer -t amqp_demo .
docker build -t railsapp .
docker run -it railsapp
docker run -p 3000:3000 -it railsapp
aws sts get-session-token
aws s3 ls s3://
# aws s3 mb s3://mybucket --region us-east-2
aws s3api get-bucket-location --bucket MYBUC
aws s3api head-object --bucket MYBUC --key KEY
# mongo -u root -p example --authenticationDatabase admin my_db
mongo -u mongouser -p mongopwd
pip3 install -U httpie-jwt-auth
http --auth-type=jwt -j -S :5000/api/v1/notif
curl -s -X OPTIONS 'http://localhost:5000/api/v1/notif' -H "Origin: http://localhost:4200" -H "Access-Control-Request-Method: GET" -v 2>&1 | bv
snap info go
go mod init github.com/me/demo
go clean -i -n github.com/hashicorp/consul...
go run -race main.go
# go test -race
go test -run Test_RaceCondition -race
go list -m all
go build -x cmd/main.go
go test --race -v ./...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment