Thursday 13 June 2019

Useful terminal commands for MAC, Ubuntu or Windows

Search specific type of file in all folder

  • find ~ -type f -name '*pdf'
  • find ~ -iname '*pdf'

Search specific type of file in current folder
  • find . -iname '*pdf'
Make file executable
  • chmod +x file.xx'
Run PHPFixer on current folder
  • php-cs-fixer fix --diff --dry-run --stop-on-violation -v --using-cache=no
  • php-cs-fixer fix --stop-on-violation -v --using-cache=no
Make your git branch prefix
  • curl https://gist.githubusercontent.com/bartoszmajsak/1396344/raw/bff6973325b159254a3ba13c5cb9ac8fda8e382b/prepare-commit-msg.sh > .git/hooks/prepare-commit-msg && chmod u+x .git/hooks/prepare-commit-msg
Delete node_modules from a certain folder
  • copied from https://stackoverflow.com/questions/42950501/delete-node-modules-folder-recursively-from-a-specified-path-using-command-line
  • find . -name 'node_modules' -type d -prune -print -exec rm -rf '{}' \; 

Open a very large file like log files
  • tail -500 bigfile | less
Show hidden files in mac
  • defaults write com.apple.Finder AppleShowAllFiles true
  • killall Finder

Add entries to a file by using export
  •   echo 'export PATH="/usr/local/opt/php@8.0/bin:$PATH"' >> ~/.zshrc

      echo 'export PATH="/usr/local/opt/php@8.0/sbin:$PATH"' >> ~/.zshrc


Install Python
  • brew install pyenv
  • pyenv install 2.7.18
  • pyenv global 2.7.18

Share:

Popular Posts

Recent Posts

Pages

Powered by Blogger.

About Me

My photo
For the past 10 years, I've been playing with codes using PHP, Java, Rails. I do this for a living and love new things to learn and the challenges that comes with it. Besides programming I love spending time with friends and family and can often be found together catching the latest movie or planning a trip to someplace I've never been before.