Some useful linux command of ubuntu

#For configuring SSL in apache
sudo apt-get install openssl
sudo apt-get install libssl-dev

openssl x509 -outform der -in certificates.pem -out your-cert.crt

#reset commit and commit file again
git reset HEAD~ –soft

#git command for command line
#clone a repository
git clone git@github.com:fuadomar/lal-tuktuk.git

#commit all file
git add .
or
git add -A
git commit -m “some message”

#pull file
git remote add origin git@github.com:akash073/rubyonrails.git
git pull origin master
git pull

#see all local branch
git branch

#fetch a specific remote branch
git fetch origin akash-first-deployment-picture-removed
git checkout akash-first-deployment-picture-removed

#push it to remote repository
git checkout -b akash-dev #if you want to create newbranch
git checkout akash-dev #else

#Change working branch :
git checkout akash-dev
git push -u origin akash-dev

#see all diff
git diff [fileName] or
git diff –cached [fileName] or

git diff –cached

git diff HEAD *

#After conflict
git commit -am ‘Conflicts resolved’

#reverting all to master branch
git fetch origin
git reset –hard origin/master

==========================================

#remote connect to aws vps
ssh-keygen -t rsa

#connect
ssh -i /akash.pem ubuntu@ec2-52-36-150-153.us-west-2.compute.amazonaws.com

#add public key to server to ssh login
cat ~/.ssh/id_rsa.pub | ssh -i /akash.pem ubuntu@ec2-52-36-150-153.us-west-2.compute.amazonaws.com “mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys && sudo service ssh restart”

reload ssh

#Add ssh key to github
xclip -sel clip < ~/.ssh/id_rsa.pub Add ->profile ->SSH key+name +paste

#add user as super user

How to Add a User and Grant Root Privileges on Ubuntu 14.04

Leave a Reply

Your email address will not be published. Required fields are marked *