Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Tab to autocomplete a command or directory which saves much time.
- ls -la to list all files in a directory
- Git
- git init to initialize a git directory in a directory of existing code, to remove just remove the .git directory
- git status to see status
- touch .gitignore to make a gitignore directory, code .gitignore to open this and then add the files to ignore
- git add -A to add all files in the directory to the staging area
- git reset arg1 to remove arg1 from the staging area, git reset without an argument resets all
- git commit -m “This is where you describe the commit” to commit
- git pull <name> <branch> updates your repository if others have pushed commits
- git push <name> <branch> pushes your commits to the remote repository; git push origin master
- In Git, origin is a placeholder name for the URL of the remote repository. Git sets up the origin by default when it clones a remote repository. You can use origin to access the remote repository without having to enter a full URL every time. This also means that you can have multiple remotes for a repository by giving each a unique name.
- git log to see a log of commits that were made, who made them, etc
- git clone <url> <where to clone> to clone a remote repository
- git diff shows changes made to code
- git branch <name> to create a branch of code to work within
- git branch -a to see all the branches
- git checkout <name> to begin working in <name> branch
- git push -u <name> <branch> to “associate the local branch with the remote repository branch” so that you can use just git pull and git push in the future
- to merge a branch:
- git checkout master
- git pull <repositoryName> master
- git branch --merged
- git merge <branchName>
- git push <repositoryName> master
- to delete a branch:
- git branch –merged
- git branch -d <branchName>
- git branch -a
- git push <repositoryName> --delete <branchName>
- BasicTerminalCommands
- ~ represents the home directory
- ls lists files in the current directory
- ls -a shows hidden files
- ls -l shows more information
- ls -h shows more filesize in prefixed terms
- ls -s sorts by filesize
- ls -t to sort by time modified
- ln to make a hard link to a file ex: ln a.txt b.txt
- ln -s to make a symbolic link to a file or directory (more common than using a hard link)
- pwd to show current directory
- cd ~/music (example) to go to a different directory
- cd by itself goes to home directory
- cd .. goes up to the parent directory
- mkdir to make a directory
- mkdir -p to make nested directory
- mkdir -v for a verbose mode (useful to keep track of what you’re doing)
- cp arg1 arg2 copies the file (arg1) to the location (arg2)
- you can copy multiple files using cp arg1 arg2 arg3… argFinal where argFinal is a directory the files are being copied to.
- cp supports -v
- cp -R to copy the contents of a directory into another directory.
- cp -i to ask for confirmation if a file is going to be overwritten
- cp -f to force overwrite if ‘permission denied’
- rm is to remove a file or folder, supporting the same flags/arguments as the cp commands
- mv to move files, supporting the same flags/arguments as the cp/rm commands
- mv can also be used to rename a file
- (mv essentially combines cp and rm)
- | is the ‘pipe’ command and can be used to chain multiple commands together
- > write the results of a command into a file
- < read from a file
- . to refer to all files in a directory
- code . In a project directory to open all of the project files.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement