📒
SDV503
  • SDV503
  • Command Prompt
    • Windows Command Prompt
    • Mac OS Terminal
  • GIT & GITHub
    • GitHub
    • Git
      • Git Workflow
        • Forking Workflow
  • README
    • How to write a readme.md file?
    • Write a better README.me
    • Generate a README for GitHub Repo Quickly
  • Code-comments
    • Clean Comments
    • Writing Comments in a Good way
  • Pair Coding
    • What is Pair Coding?
    • Pair Programming Experience
  • Programming?
    • What is Programming?
    • What Is A Programming Paradigm?
    • JavaScript Programming Paradigms
  • Number Systems
    • Decimal and Binary numbers
  • JavaSCript
    • Introduction To JavaScript
      • The JavaScript Engine
  • JS Call Stack
    • JavaScript call stack
    • JavaScript & Memory
      • Memory Leaks in JavaScript
    • Execution Context and Execution Stack in Javascript
      • Javascript Execution Context and Hoisting
  • JavaScript Variables
    • Introduction to JS Data Types
    • Primitive and Non-Primitive
    • Operator precedence and associativity
      • JS Operators Part One
      • JS Operators Part Two
      • JS Operators Part Three
    • Clean Code for JS Variables
  • JavaScript Scopes
    • Scope (Chain) Visualized
  • Javascript  — this keyword
  • JavaScript Data Types
    • More JavaScript Data Types
  • JavaScript Expressions and Statements
  • if/else, switch and ternary operator
    • If/Else statement
  • Switch Statement
  • Ternary Operator
  • JavaScript Loops
    • Loops in JavaScript
      • Trouble With Loops
  • Objects
    • JavaScript Objects
      • Prototypal Inheritance Visualized
      • JavaScript Number Object
      • JavaScript String Object
  • Functions
    • JavaScript Function Part One
    • JavaScript Function Part Two
    • Immediately Invoked Function Expressions ~ IIFE
    • JS => Arrow Functions
    • JavaScript Callback
    • Hoisting in JavaScript
      • Hoisting Visualized
    • Recursion Functions
    • Curry and Function Composition
  • JavaScript Features
    • JSpread Operator
    • JavaScript Built-in Functions & Objects
  • Data Structures&Algorithms
    • JavaScript’s Data Types
    • Data Structures in JavaScript
      • Introduction to Big O Notation
      • Big O Notation in Javascript
      • Linked Lists
        • Linked Lists — 2
      • Hash Tables
      • Stack & Queue
  • TLDR
    • Single quotes (‘ ’) and double quotes (“ ”) in JavaScript
  • ES6
    • Generators and Iterators
    • Javascript Classes
    • JavaScript closures
    • JavaScript Promises & Async/Await
      • Event Loop Visualized
  • C#
    • What does C#? (C Sharp)
    • C# vs JavaScript
    • What Is The Difference Between C#, .NET, ASP.NET, Microsoft.NET, and Visual Studio?
    • What is the .NET Framework?
    • Methods and Properties of Console Class in C#
    • Datatypes in C#
    • C# Code Comments
    • The if statement
    • The switch statement
    • Loops
    • Comparison operators
    • Addition assignment operators
    • The String Interpolation Operator
    • Arrays
    • Lists
    • Dictionaries
Powered by GitBook
On this page
  • Opening the Terminal and Navigating Directories
  • Usage Examples
  • Making a Directory
  • Making a File
  • Copying a File
  • Deleting a File

Was this helpful?

  1. Command Prompt

Mac OS Terminal

Most of the time users interact through a Graphical User Interface to interact with the computer. You use the mouse to point and click to open, move, or create new files or open applications. But, you can also use the Terminal Application to interact with your machine through written commands. When you use the terminal, it allows you to dig deeper and customize in a way not possible through the GUI.

Opening the Terminal and Navigating Directories

Your terminal exists in the Applications directory. Open your Terminal app. You should see a prompt in the terminal window. it shoudl have the computer’s name (ABC’s Macbook), followed by the User name (ABC), and then a ’$.’ If you are in the root directory, the last character will be a ’#.’

To see what directory you are working in, just type the command

pwd

pwd stands for “Print Working Directory.” Directory is another word for folder.

If you want to list the contents of your directory use the command:

ls

To switch to a new directory you use the command:

cd

which stands for change directory.

Here is a list of common commands:

Command

Usage

pwd

Print Working Directory (Where Am I? )

ls

List contents of current directory

mkdir

Create a new directory

touch

Create a new file

cp

Copy a file

rm

Remove a file

rm -rf

Remove a directory

Usage Examples

Some of the aforementioned commands aren’t clear without examples. Below are a few usage examples to help provide you with some context.

Making a Directory

mkdir #YOUR-NEW-FOLDER-NAME-HERE

Making a File

touch YOUR-FILE-NAME.JS

You can make a file with any extension you choose. As long as it is in an a format accepted by the folder or machine.

Copying a File

Use the following syntax to copy a file from the terminal:

cp source destination

For example, if we have a file, ‘test.txt’ that is stored in our /Desktop directory and we want to copy it to the /Documents folder, our command would look like this:

cp ~/Desktop/test.txt ~/Documents

Deleting a File

Use the following syntax to delete a file

rm #PATHTOFILE

PreviousWindows Command PromptNextGitHub

Last updated 5 years ago

Was this helpful?