- Create tar archive:
tar -czvf LotsOfFiles.tgz LotsOfFiles
- Uncompress tar archive:
tar -xvf LotsOfFiles.tgz
- Delete all files with specific extension in dir:
find . -name "*.DS_Store" -type f -delete
- List all files with specific extension in dir:
find . -name "*.DS_Store" -type f
- List all directories that contain specific character (underscore in this case):
find . -name '*_*' -type d
- Remove docker image:
sudo docker rmi -f <IMAGE ID>
- Stop process for docker container
docker rm name_of_the_docker_container
git reset --hard origin/main
- Stage only deleted files git:
git ls-files --deleted | xargs git add
- Get vim on ubuntu machine:
apt-get update && apt-get install apt-file -y && apt-file update && apt-get install vim -y
- List files changed in commit (by hash): first
git log
and thengit show --pretty="" --name-only <hash>
- Undo last commit from local:
git reset --soft HEAD~1
- Undo last commit from remote: first
git reset HEAD^
and thengit push origin +HEAD
- Restore uncommited deleted file: first
git reset HEAD <file>
and thengit checkout -- <file>
- List all conda envs created on system:
conda env list
- Find text in dirs:
grep -rnw '/path/to/somewhere/' -e 'pattern'
- Display all available GPUs:
lspci -k|grep -iA2 "VGA"
- List all of your conda environments:
conda info --envs
- Disable conda on startup:
conda config --set auto_activate_base false
- Discard local changes on one file:
git checkout -- <file>
- Default location for saving generated SSH keys:
/Users/<username>/.ssh/
- Give sudo permissions to user:
sudo usermod -aG sudo <user>
- Commit changes made to Docker container:
docker commit <container_id> new_image_name:tag
- Tag Docker image:
docker tag <image_id> username/repository:tag
- Push Docker image:
docker push username/repository:tag
Feel free to open a PR to add other useful commands.