Skip to content

Bash Commands

Prashant edited this page Feb 20, 2020 · 15 revisions
Files

fdupes -m <dir> Find duplicate file

ls -1 | wc -l Count number of files in dir

react native

open "rndebugger://set-debugger-loc?host=localhost&port=8081" to open debugger

Force pull

git fetch --all

git reset --hard origin/master

NPM cache clean

RN < 0.50 - watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache clean && npm install && npm start -- --reset-cache

RN >= 0.50 - watchman watch-del-all && rm -rf $TMPDIR/react-native-packager-cache-* && rm -rf $TMPDIR/metro-bundler-cache-* && rm -rf node_modules/ && npm cache clean && npm install && npm start -- --reset-cache

npm >= 5 - watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache verify && npm install && npm start -- --reset-cache

Windows - del %appdata%\Temp\react-native-* & cd android & gradlew clean & cd .. & del node_modules/ & npm cache clean --force & npm install & npm start -- --reset-cache

command to avoid ENOSPC:

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

Remove upper commit

git reset HEAD^ # remove commit locally

git push origin +HEAD # force-push the new HEAD commit

SSH

ssh -L 8888:127.0.0.1:8888 liggghts@192.168.104.66 -N -v -v Run jupyter from remote server

ssh-copy-id user@ip-address Add ssh key to remote server

Docker

su - ${USER} docker login

docker ps -a to view all docker container

docker run -p 4000:80 bookbrainz Run the docker app

docker run -d -p 4000:80 bookbrainz Run the docker app in background

docker build -t friendlyhello . Create image using this directory's Dockerfile

docker container ls List all running containers

docker container ls -a List all containers, even those not running

docker container stop <hash> Gracefully stop the specified container

docker container kill <hash> Force shutdown of the specified container

docker container rm <hash> Remove specified container from this machine

docker container rm $(docker container ls -a -q) Remove all containers

docker image ls -a List all images on this machine

docker image rm <image id> Remove specified image from this machine

docker image rm $(docker image ls -a -q) Remove all images from this machine

docker login Log in this CLI session using your Docker credentials

docker tag <image> username/repository:tag Tag for upload to registry

docker push username/repository:tag Upload tagged image to registry

docker run username/repository:tag Run image from a registry

AWS Login

ssh -i "sparkmain.pem" ubuntu@ec2-18-216-9-110.us-east-2.compute.amazonaws.com

rsync -avz --progress -e "ssh -i ~/Documents/Spark-Node/sparkmain.pem" ubuntu@ec2-18-216-9-110.us-east-2.compute.amazonaws.com:/home/ubuntu/spark/backup /home/legolas/Documents/uploads

sudo mongoexport --db spark20 --collection counter_students --jsonArray --out counter_students.json

Resize ec2 instance

Clone this wiki locally