CSCI0200
      • 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
      • Invitee
    • 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
    • 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 Sharing URL Help
Menu
Options
Versions and GitHub Sync 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
Invitee
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: resources --- # Terminal Commands Two of the most useful tools you should get familiar with are **terminal** and **git**. Familiarizing yourself with how to maneuver through the terminal and tools like git will be very helpful throughout CS200 and beyond. ## Terminal ### 1. Accessing the terminal * To open the terminal using macOS: Go to *Applications* -> *Utilities* -> Open *Terminal* - Alternatively, you can open *Spotlight Search* (keyboard shortcut is 'Command SpaceBar'), search for 'terminal', and open the first application listed * If you are using a a Windows machine: Search for *Command Prompt* ### 2. Basic Terminal Commands This is just a list of basic useful commands; feel free to skim through now then refer back to them as you need. | Command | Explanation | | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `man <command>` | `man` prints the manual of a given command. For all of these commands and any new commands, use `man` to find out more about them, e.g. `man pwd` | | `<command> --help` | Adding the `--help` tag after any command allows you to access the help menu for a specific command if available, e.g. `pwd --help` | | `pwd` | `pwd` or "print working directory" will print the full (absolute) path to the folder the user/terminal is currently at. | | `cd <directory>` | `cd` or "change directory" moves the user to the indicated directory if it exists inside the current directory. | | `cd <absolute-filepath>` | putting a `/` before a filepath indicates that it's absolute, i.e. that it starts from the root directory instead of from the current working directory (meaning it doesn't matter where you are now). | | `cd ..` | `..` is a link within every directory to the previous directory that contains the current directory, `cd ..` lets you move back one folder | | `cd ~ OR cd` | These commands will move you to your home directory (noted with a ~), which is usually your user name (e.g doing `cd` then `pwd` I get `/Users/anniecimack`). | | `ls` | `ls` prints the contents of the current directory. | | `mkdir <directory>` | `mkdir` creates a new empty directory named `<directory>` in the current directory. | | `rmdir <directory>` | This command removes an **empty** directory. It must be called in the directory that contains what a user wants to remove. | | `rm -r <directory>` | This command removes any directory and all of its contents. | | `cat <file>` | `cat` prints the contents of `file` to your terminal | | `vim/nano <file>` | `vim` or `nano` are basic text editors that work within the terminal; we'll talk more about them later | | `mv <filepath1> <filepath2>` | `mv` moves what file is at filepath1 to filepath2. for example, you could put a file into a folder with `mv file folder`. `mv` will also rename the file if you include a non-folder name at the end, e.g. `mv file folder/newname` | ___ **Practice Using your Terminal:** **Task:** Within your own terminal, we will make a cs200 directory and re-setup your file system to be based in your home directory and easily accessible. Feel free to change steps (e.g. disclude the browncs folder) or not use this, but at least go through the motions so you know how. First, cd home and make a new "browncs" folder to put everything in (I would also definitely just make a shortcut to this folder to put on your desktop and/or pin it in your Finder/File Explorer). ```t cd ~ mkdir browncs ``` Next, we'll hop inside and make a cs200 folder. ```t cd browncs mkdir cs200 ``` Now we'll make directories for different assignments. ```t cd cs200 mkdir hws mkdir labs mkdir projs ``` Finally, let's reclone the lab01 repo to our new labs folder. Let's also use a key trick! Whenever you're dealing with files or folders that exist, you can use tab to autofill what you've typed so far. Try typing `cd l` then pressing tab to complete the command. ```t cd labs ``` Then, click this url: https://classroom.github.com/a/hUL5du-F and clone the repo there. Now, let's also make a `lab99` directory to show off how tab autocomplete works. If we press tab and there are multiple options to select from with the same prefix we've given, like if we only type l but there are multiple labs, pressing tab again will show us all of them. Then, once we see our options, we can type the necessary amount (lab) then press tab to make it work. ```t cd l cd lab cd lab01 ``` Now, if you use `ls` to list what's contained in lab01, you'll see that there is a "just-for-fun" folder. Get in there yourself and play around with your new pet using the commands we've learned above. Feel free to also mess around with other files included or skip them until we actually get to the vim editor section. Create a home for the cat by making a new directory and moving the cat inside to protect it from the scary eagle. Then rename it also using! I've secretly included a few typos in the last parts so you'll have to type the interesting `mv` commands yourself (remember to use tab!) ```t cat cat-this-sample-text.txt cat scary-predator-eagle.txt mkdir new-cat-home mv cat-this-sample-typo.txt new-cat-home mv new-cat-home/cat-typo-sample-text.txt new-cat-home/Kryptonite ``` ## Basic Text Editing with Vim :::spoiler **If you have Windows, click here!** Windows unfortunately does not come with Vim pre-installed. You will have to install it manually. Follow [this guide](https://www.freecodecamp.org/news/vim-windows-install-powershell/#:~:text=Vim%20is%20a%20powerful%20code,it%20running%20on%20your%20PC.) to get it set up. **Note:** Don't worry about the 'PowerShell' bit - as long as you can use it in the basic command prompt application. ::: Sometimes you might find yourself in a position where you're working in the terminal and can't easily open or access a file with an application that has an easy-to-understand interface (e.g. Intellij). In these cases, it will be helpful to work with a terminal-level text editor, like Vim or nano. **Task:** Open your terminal and navigate to the folder that contains your code for lab 1. Remember to use `ls` to see what directories you can move into and `cd` to move into one of those directories! Once in that folder, navigate to the `src` folder. Opening a file with Vim is very simple. All you have to do is type `vim` followed by the file you want to open. So, if you want to open a file called `ILovecs200.java`, once you navigated to the proper directory, you would type the following command: ``` vim ILoveCS200.java ``` **Task:** Open `Leaf.java` with Vim. Once you've opened a file in Vim, your terminal will display all of the text that appears in the file. Vim has a lot of functionality, but we're only going to worry about insert mode right now. You are free to explore how the other commands work if you so wish. For a complete overview of everything you can possibly do with Vim, [look at this document](https://devhints.io/vim). Opening a file with Vim only displays it, so in order to edit any text in the file, we'll need to enter insert mode. **Task:** Enter insert mode by typing `i`. At the bottom of the terminal window, you should now see `---INSERT---`. Once you're in insert mode, you can make changes to a file and save them without having to open an application like TextEdit or IntelliJ. **Task:** Navigate around `Leaf.java` by using the arrow keys. Get to the last line and then hit enter. This should create a new line at the bottom of the file. Once you've done that, write yourself a comment (remember that comments start with a double backslash, i.e. `//`). **Note:** You can also scroll using a trackpad (though sometimes this can be a little finicky). Now that you've made a change to the document, you'll need to exit insert mode and save it! To exit insert mode, press the `esc` button on your keyboard. Once you've exited insert mode, you can save a file by typing `:w`. You can save and close a file by typing `:wq`. **Task:** Exit insert mode, then save and close `Leaf.java`. Those are the absolute basics of Vim! Feel free to play around and change the actual text in any of the lab 1 files to see how replacement works. You likely will not need to use this during this class, but you may find it helpful for the future! Now you know how to use some basic tools in the terminal! Hopefully, these skills give you a better sense of the inner workings of your computer. --- *Please let us know if you find any mistakes, inconsistencies, or confusing language in this or any other CS200 document by filling out the (optional) [anonymous feedback form](https://forms.gle/JipS5Y32eRUdZcSZ6)!

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