Last active
July 2, 2022 22:56
-
-
Save avdyushin/e6dabcdbf66b1597a201 to your computer and use it in GitHub Desktop.
Terminal commands cheat list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# ZSH, Mac OS X or Ubuntu | |
# | |
# Decode base 64 and convert into hex string | |
echo 'aGI32ansgxzKWh3RV4EjRwQsW1v1la+7NBTdjx8zYq0=' | base64 -D | hexdump -ve '1/1 %.2x' | pbcopy | |
# Get dirs sizes in one level and sort them | |
du --max-depth=1 -h | sort -n | |
# Find files contains string | |
grep -rl "string" path | |
# Find only *.m files | |
grep -irl --include=\*.m "string" path | |
# Rename all files into 1.txt, 2.txt, ... | |
n=0; for f in *; { n=$((n+1)); mv $f $n.txt } | |
# Rename files to lowercase | |
for f in *; do mv "$f" "`echo $f | tr "[:upper:]" "[:lower:]"`"; done | |
# Sum of last columns | |
awk '{s+=$NF} END {print s}' /tmp/c.txt | |
# Create new user with home dir | |
useradd -m %user% | |
# Setup password for user | |
passwd %user% | |
# Add user to sudo group | |
usermod -a -G sudo %user% | |
# Install uswgi | |
apt-get install python-pip python-dev | |
apt-get install libpcre3 libpcre3-dev | |
pip install uwsgi | |
apt-get install zsh nginx nginx-full nginx-extras uwgsi uwsgi-plugin-python | |
# Install flask | |
pip install Flask Flask-SQLAlchemy | |
# Git | |
# Show file history | |
git show --color $(git log --oneline filename | cut -f 1 -d ' ') filename | |
# Diff file in different branches | |
git diff branch1:filename branch2:filename | |
# Reset all local changes | |
git reset --hard HEAD | |
# Push tags | |
git push --follow-tags | |
# Delete local banches | |
git branch -D `git branch --list grigory\*` | |
# Find files contains substring | |
find . -type f -name \*.ext -exec grep 'subsctring' {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment