B2B
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    ###### tags: `Git` `Terminal` `Tips and Tricks` `ACC` # Terminal & Git Commands CheatSheet ## Terminal Commands ### ls / ls -a => List contends of current directory - Directories are listed simply as their name - A file will show it's file extension after like file.pdf - Tip ⇒ Don't see a file you know is in there? Try ls -a That will show all hidden files too. ### cd => Move between directories - cd dir_name => Moves you into the directory - cd .. => Moves you 1 directory up in the structure. - cd ~ = Moves you to the very top directory. - Tip ⇒ you can move into more than 1 directory at a time if you know the folder paths - cd Documents/CodingDojo/Git = instead of typing cd Documents then cd CodingDojo and so on. - Tip ⇒ Type the first 3 letters of a folder then hit the tab button to let it fill out the rest of the directory name - Tip ⇒ Have a directory name with a space (Unit 1)? To enter this folder cd Unit\ 1 would be your command ### Make directories or files - mkdir directory_name => Makes a directory ⇒ You will not see anything happen when you type mkdir newfolder for example it does make a folder called newfolder but you won't see it unless you enter ls. - Tip ⇒ Want to make a directory with a space in it? (Unit 1) Put single quotes around the desired directory name like this => mkdir 'Unit 1' - touch filename.ext = Makes a new file ⇒ Again you will not see anything happen but if you ls again you will see the new file. ### Remove directories or files - rmdir dir_name => will remove the dir. It will not show you that it is deleted. - The dir you are trying to delete must be completely empty for this to work - rm filename.ext => will remove the dir and agian will not show you that it is deleted. - Tip ⇒ system will NOT delete a directory if there is content in it. Don't see anything in their? Do a ls -a ### Open a file - code filename.ext => This will open the file in your default IDE - You must be in the dir that that file is located in for this to work. ### Renaming a file - mv index.html about.html (this will rename the index file to about) ### Moving a file - mv index.html ../unit2/index.html (this will take the index file move it up 1 folder then donw to unit2 folder and place it there) ### Copy a file - cp index.html copy.htmnl ### Copy a Directory - cp -rf Unit2 copy_Unit2 - It is important to have the -rf to make sure that all files and folders contained inside the origional also get copied. ## Git Commands ### Setting up your terminal to push to github - git config --global user.name "melissa-24" - In this case this would set the user name to my github username which is melissa24 - Make sure you use --global or it will only work for where you are in the directories right then. - git config --global user.email mlongenberger@codingdojo.com - This would set the email to the one above (make sure they are the same that the email you use here is the email for the github username) - git config --global user.password ************ - This one is a bit odd. You will type your password where the *'s are but nothing will show up so make sure you type carfully. - git config --global --list - This will allow you to see your stored settings. ### git init - initializes a new empty repository and create a hidden .git file This is how you will be able to push and save your work to github - The .git file contains everything the repository or project needs including commit logs. ### git clone urlLinkHere - This will create a clone of the repository from github. - In most terminals you have to hit CTRL + Shift + V for it to paste ### git checkout -b newBranchName - This is used to create a new branch. Unless this is done commits will be saved to the master branch. ### git checkout main - If you are currently working on something in the newBranchName branch but want to switch over to the main branch you would type this. In most cases you will need to commit your work before it will let you change ### git branch - This will show you all the branches that are part of the git repository ### git log - Gives you a log of all the backups or commits ### git blame filename.html - This is a great tool when working on a team. It allows you to see who wrote what - You will need a file name for this to work. ### git status - This will give you an update of what files have had changes but have not been committed and are not being tracked. ### git add filename.html / git add * - If entering for example filename.html then it will add just that file to the commit log. If using * Then it will add all files changed to the commit log - Tip. Type the first few letters of the file name to add and hit the tab button and it will finish the name - Tip. Have a folder inside the repo? Add all the files of that folder in 1 command by typing the folder name and adding / like a folder containing all CSS docs you names CSS simply do git add CSS/ ### git commit -m "enter message here" - This will submit a commit to the save file. Inside the "" goes your comment about the commit. Basically anything but should be relevant to the changes made - Tip ⇒ Commit often, you can keep creating commits before you push to github. They will all be uploaded. A commit just basically creates a retrievable save point ### git push / git push origin newBranchName - This is used to push all saved commits to github. - git push on it's on is only if you are working on the main branch (Don't worry it will say something if you can push) - Adding origin newBranchName means that you want to push your changes to the branch newBranchName. ### git pull - Once in the proper directory entering this command will pull changes from github that are not on your local machine - Tip => Sometime the terminal will tell you that this needs to be done other times if you do this it will let you know if the local copy matches the github copy

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully