Git commnad
- git init: (Initialize the local directory as a Git repository.)
- git add: (Add the files in your new local repository. and staging)
- git reset HEAD file_name: (for unstage)
- git commit -m "First commit" (commit the code)
- git remote add origin remote_repository_url (Sets the new remote)
- git pull origin development : (pull from remote)
- git push origin master (push the code)
- git config --list (show the git config )
- git config --system --unset credential.helper
git config --global --unset credential.helper
git config --global credential.helper manage (chage the git config: u can use any one maybe) - git log --oneline -5
- git log --oneline -5 origin/development
- git branch
- git checkout branch_name
- git cherry-pick sha1
- git commit --amend
- git reset HEAD~ ( git reset last commit)
- git marge <branch_name> you have to location destination branch(like master)
- let now you are in master branch and want to marge branch1
- so command lik git marge branch1
- git cherry-pick <sha1> cherry pick is used to replace in the top of current branch.
- git checkout <prev_sha1> <filename> file change to sha1 commited file
- git push origin -u <branch_name> it will create a branch in remote. -u = upstream
- git stash "current changes keep in the drap mode"
- git stash pop
- git stash list
- git checkout . "that means current change will be removed"
- git reset c602b9fc --hard " it will remove all the commit after c602b9fc and head will be c602b9fc"
- merge is used to merge two branches. follow the two steps
- git checkout master
- git marge <features1> merge is used to merge two branches
git reset c602b9fc --hard
git push origin master --force
https://help.github.com/en/articles/adding-an-existing-project-to-github-using-the-command-line
Linux common command:
- sudo tail -n 20 /var/log/nginx/error.log (to see the log of nginx server)
- chmod -R <permissionsettings> <dirname> (change the folder permision and its subfolder and files)
- chmod 755 -R <folder-name>
- pwd (to check the current directory)
- cat <filename> : is used to check file text
- file edit way:********* ()
- vi filename
- (Enter) i
- change the text
- Esc
- :wq
- enter
- exit file without saving
- :q (enter)
- Access EC2 using ssh
- chmod 400 SPWStaging-ASDAccount.pem (first time)
- ssh -i "SPWStaging-ASDAccount.pem" ec2-user@ec2-18-212-2-219.compute-1.amazonaws.com
- sudo su (ec2-user is used as a super user)
- wget <url> to download the from internet
- unzip to extrac the file in linux
- sudo useradd <user_name> adding user in linux
- sudo passwd <user_name> set the password
- sudo userdel <user_name> deleting the user
- sudo groupadd <groupd_name> add the group in linux command
- sudo touch <file_name> create the file
- sudo vi <file_name> to open the file in file text check 5 point
- sudo cp <file_name> <folder_name> copy the file to specific folder
- sudo mv <file_name> <folder_name> to move the file
- sudo rm <file_name> to remove the file
- sudo mkdir <directory_name> to create a directory in linux
- sudo rmdir <directory_name> to remove the directory in Linux
- sudo grep -i <string_name> <file_name> just like as ctrl+f features in command line. Flag: -n, -v,-c, -i
- sudo sort <file_name> sort the file string
- ls -l to show the file list with permission
- chown <user_name> <file_name> to change ownership of file like "Tushar(user) to root user"
- chmod <permission_number (777)> <file_name> (pronounce: ch-mod/ch-own)
- 777 means
- first 7 = user permission
- second 7 = group permission
- third 7 = other user of that group user
- id - show the user id
- tar -cvf <file_name> <source_folder_name> to zip as the file
- tar -xvf <file_name> unzip tar the file
- cut -c1-2 <file_name> to cut the string from the file. here c means column from 1 to 2
- sed 's/<replaced_string>/<replace_by_string>' <file_name>
- to replace the string in file
- history <last_history_showing_number> show the list of history
- history 5
- free -k/-m is used to check memory space in the system
- ssh-keygen -t rsa to create public private key to get access. from the next time just type enter
- to generat the key
- ifconfig / ip a to check the ip address
- env for the environment variale
- sudo app-get install pinta to install the software in ubuntu
- scp -i ec2-access.pem /home/cefalo/Tushar/a2n/boilerplate/sveltekit/node_modules.zip ubuntu@ec2-63-33-70-8.eu-west-1.compute.amazonaws.com:/opt/boilerplate/boilerplate-sveltekit // upload local zip to aws ec2
Ref:
- https://hackr.io/blog/basic-linux-commands
- https://www.computerhope.com/unix/uchown.htm
- https://www.edureka.co/blog/linux-commands/
- https://www.guru99.com/must-know-linux-commands.html
- https://www.howtogeek.com/412055/37-important-linux-commands-you-should-know/
ggggggggggggggggggg
No comments:
Post a Comment