Linux Notes

Linux misc

SSH Folder permissions

#private key
chmod 600 id_rsa

#pub keys
chmod 644 .pub

# ~/.ssh
chmod 700 .shh

# home	
chmod 755 ~

# remove or change password from key
 ssh-keygen -p
 
 ssh-keygen -p [-P old_passphrase] [-N new_passphrase] [-f keyfile]
 

Tar exclude “node_modules”

tar  --exclude=**/node_modules/* --exclude=.git  -cvfz backup.tgz folder/

Mysql

mysql --host=localhost --user=myname --password=password <mydb>
mysql -h localhost -u myname -p password <mydb>

Misc

#import
mysqldump -u root -p --opt --all-databases > alldb.sql
mysqldump -u root -p --all-databases --skip-lock-tables > alldb.sql

#export
mysql -u root -p < alldb.sql

Git

Create Branch and push to Remote

$git checkout -b test origin/test
$git push -u origin <BRANCH>

Set upstream

$git branch --set-upstream-to=origin/<BRANCH> <BRANCH>

Change remote

git remote rm origin

$ git remote add origin https://github.com/user/repo.git
# Set a new remote

$ git remote -v
# Verify new remote
> origin  https://github.com/user/repo.git (fetch)
> origin  https://github.com/user/repo.git (push)

Leave a Reply

Your email address will not be published.