General usage ubuntu comments. Separated in general and development related.
General scope useful commands
- Sync VM machine time
sudo ntpdate ntp.ubuntu.com
- Kill process in specific port
fuser -k {port}/tcp
- Grant sudo permissions to a folder
sudo chmod -R 777 {dir}
- Chech the available system space
df -h
Development related useful commands
- Remove local branch
git branch -d <branch_name>
- Undo last commit
git reset HEAD~
- Remove remote branch
git push origin --delete <branch_name>
- Reset ahead local commits to remote
git reset --hard <remote>/<branch_name>
- Create new branch from commit branch
git branch <branch_name> <sha1-of-commit>
- Stash changes
git stash
- Show stashed changes
git stash list
- Apply stashed changes
git stash apply
- Remove folder from git cache (after adding to .gitignore)
git rm -r --cached path_to_your_folder/
- Clean NPM registry and cache, avoiding ENOSPC and other errors
rm -rf ~/.npm
npm cache rm
npm cache clear
- Increade node.js process memmory (in MB)
node --max_old_space_size=8196 myServer.js
- Modify host file
sudo nano /etc/hosts
Node version manager. X.X.X
referes to Node version number.
- Install specific version of node
nvm install vX.X.X
- Set default node version
nvm alias default X.X.X
- Use version of node
nvm use X.X.X