Skip to content

Instantly share code, notes, and snippets.

@monbang
Created April 30, 2020 10:11
Show Gist options
  • Save monbang/448415720d077eeedbbe3267ce0c8dfa to your computer and use it in GitHub Desktop.
Save monbang/448415720d077eeedbbe3267ce0c8dfa to your computer and use it in GitHub Desktop.
bash aliases
# delete all but .ext "rm -- !(*.ext)"
# file and folder permissions
# find . -type f -exec chmod 644 {} \; file permissions
# find . -type d -exec chmod 755 {} \; folder permissions
# dos to unix
# find . -type f -name '*.php' -exec dos2unix '{}' +
# photo on trm "display photo.ext"
# photo resize all in folder "mogrify -resize 30% *.png" (works on the same file)
# only this photo "convert -resize 30% this.photo new-this.photo"
# addaing a "h" to "ls -lah" shows human firendly units
# " return to the cursor position before the latest jump
# `` (two back ticks) return to the line before the last jump (UNDO JUMP)
# '. jump to last changed line
# zip with git "git archive -o bitvolution.zip -9 HEAD"
# unzip to unzip file.zip -d destinationDirectory
# git push origin --delete <branch name>
# git branch -d <branch name>
# git checkout master
# git merge <branch name>
# git discard all changes including file delete after last commit "git reset HEAD --hard" and delete all untracked files "git clean -fd"
# exiftool "exiftool -ImageDescription='Demo image cpation'
# count all files in a folder "ls | awk -F . '{print $NF}' | sort | uniq -c | awk '{print $2,$1}'"
# find and replace "find foldername -name '*.rb' -type f -exec sed -i -e 's/regex/replacement/g' -- {} +"
# ln -s ~/sourcefile ~/destinationfile
# remove symlink unlink symlinkname
# ip link set interface up
# dhclient interface
# git branch merge and delete
# git checkout master # git merge branchname # git branch -d branchname # to
# delete remote branch - git push origin --delete branchname # remove any remote
# tracking branch # git fetch origin --p
#
# find duplicate rows "SELECT date FROM logs group by date having count(*) >= 2"
# mp4 to mp3 'ffmpeg -i k.mp4 -q:a 0 -map a k.mp3'
alias ll='ls -lah'
alias la='ls -Ah'
alias l='ls -CFh'
#alias bat='upower -i /org/freedesktop/UPower/devices/battery_BAT0| grep -E "state|to\ full|percentage"'
alias selenium='java -jar -Dwebdriver.gecko.driver=/home/riju/.selenium/geckodriver /home/riju/.selenium/selenium-server-3.7.jar'
alias basicapp='composer create-project --prefer-dist yiisoft/yii2-app-basic yii2-app'
#alias ystart='git clone https://dhrubajyoti-das@bitbucket.org/dhrubajyoti-das/yii-starter.git'
#alias wgetmirror='wget -mkEpnp --header="Accept: text/html" --user-agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0" '
alias wgetmirror='wget --no-clobber --convert-links --random-wait -r -p -E -e robots=off -U mozilla '
alias gzip="git archive -o master.zip -9 HEAD"
alias srv="php -S localhost:8080"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment