Getting Started with Command Prompts

Similar documents
The Command Shell. Fundamentals of Computer Science

The Directory Structure

ENCM 339 Fall 2017: Editing and Running Programs in the Lab

History. Terminology. Opening a Terminal. Introduction to the Unix command line GNOME

A+ Guide to Managing & Maintaining Your PC, 8th Edition. Chapter 3 Introducing Windows Operating Systems

Operating System Interaction via bash

Chapter 2 Text Processing with the Command Line Interface

Introduction to Linux Spring 2014, Section 02, Lecture 3 Jason Tang

Examples: Directory pathname: File pathname: /home/username/ics124/assignments/ /home/username/ops224/assignments/assn1.txt

Operating Systems and Using Linux. Topics What is an Operating System? Linux Overview Frequently Used Linux Commands

Citrix Desktop for Home Computers Mac OS Instructions

Science One CS : Getting Started

Absolute and Relative Paths

Organizing Screens with Mission Control

Chapter Two. Lesson A. Objectives. Exploring the UNIX File System and File Security. Understanding Files and Directories

CSCI 161: Introduction to Programming I Lab 1b: Hello, World (Eclipse, Java)

Computer Skills: Files and Folders Tutorial

Instruction: Download and Install R and RStudio

Lab: Supplying Inputs to Programs

Mac OS X Part 3. The University of Utah Student Computing Labs Macintosh Support

CSCI 161: Introduction to Programming I Lab 1a: Programming Environment: Linux and Eclipse

All Creative Designs. Basic HTML for PC Tutorial Part 1 Using MS Notepad (Version May 2013) My First Web Page

About the Presentations

Shell Programming Overview

your Apple warranty; see There are two main failure modes for a mirrored RAID 1 set:

RWT Network System Installation Guide

Flash Video Encoder CS3 Fetch Microsoft Office 2004 (Excel, imovie. Powerpoint, Word, Entourage) itunes

Explorations in Computing

Vendio Stores WebDAV Setup & Access

Linux File System and Basic Commands

Chapter Two Bonus Lesson: JavaDoc

Scripting Languages Course 1. Diana Trandabăț

5/8/2012. Creating and Changing Directories Chapter 7

How to Access CTC via VPN with Mac OS 10.7x

Command Line Navigation and Compiling

Unix/Linux Basics. Cpt S 223, Fall 2007 Copyright: Washington State University

Future Technology Devices International Ltd. Mac OS X Installation Guide

Running Java Programs

Internal Commands COPY and TYPE

Introduction to REXX Programming Language

CPSC 150 Laboratory Manual. Lab 1 Introduction to Program Creation

Lab 1: Setup 12:00 PM, Sep 10, 2017

CSE115 Lab exercises for week 1 of recitations Spring 2011

Session 1: Accessing MUGrid and Command Line Basics

Instructions. First, download the file

More details on paths in MATLAB

Tiny Instruction Manual for the Undergraduate Mathematics Unix Laboratory

This will be a paragraph about me. It might include my hobbies, where I grew up, etc.

Mac OS X. Starting Up. The Menulets/ Menu Extras. The Menu Bar. The Apple Menu. The Disk/Hard Drive. The Dock. The Finder

Guided Tour (Version 3.3) By Steven Castellucci as Modified by Brandon Haworth

Installation Guide: VirtualBox, Windows 10, and Microsoft Visio (Mac OS)

COMP 110/401 WINDOWS COMMAND INTERPRETER. Instructor: Prasun Dewan (FB 150,

All messages are color-coded to display messages as New, Seen, Answered, Flagged or Deleted.

Meeting your new mac

ROS-Industrial Basic Developer s Training Class: Linux Basics. Southwest Research Institute Last Updated 2017

CS 1110 SPRING 2016: GETTING STARTED (Jan 27-28) First Name: Last Name: NetID:

INSE Lab 1 Introduction to UNIX Fall 2017

C:\> command prompt DOS prompt cursor

Unix Tutorial Haverford Astronomy 2014/2015

Understanding Math 2008 and Understanding Numeration 2008 Installation Manual for Macintosh

GMI-Cmd.exe Reference Manual GMI Command Utility General Management Interface Foundation

School Installation Guide ELLIS Academic 5.2.6

Read&Write 5 GOLD FOR MAC MANUAL

Some examples of common standards supported by Mac OS X are:

First of all, these notes will cover only a small subset of the available commands and utilities, and will cover most of those in a shallow fashion.

UNIX Tutorial One

Moving to the Mac A GUIDE FOR NEW USERS OF MAC OS X. [Type here]

Laboratory Exercise #0

Introduction to Linux. Fundamentals of Computer Science

Overview of the UNIX File System

Unix Introduction. Getting started with the Unix Operating System

MTweb and Macintosh Computers FTP Using FileZilla Download FileZilla

FireAMP Connector for Mac Diagnostic Data Collection

Managing Files & Folders

About shells and command lines

CMSC 104 Lecture 2 by S Lupoli adapted by C Grasso

Creating a Program in JCreator. JCreator is then used to create our program. But the first step is to create a new file.

DATA 301 Introduction to Data Analytics Command Line. Dr. Ramon Lawrence University of British Columbia Okanagan

Why learn the Command Line? The command line is the text interface to the computer. DATA 301 Introduction to Data Analytics Command Line

First of all, these notes will cover only a small subset of the available commands and utilities, and will cover most of those in a shallow fashion.

C++ Support Classes (Data and Variables)

1 Getting Started with Linux.

Basic Unix. Set-up. Finding Terminal on the imac. Method 1. Biochemistry laboratories Jean-Yves Sgro

Class 1: Homework. Intro to Computer Science CSCI-UA.0101 New York University Courant Institute of Mathematical Sciences Fall 2017

Files to Contents. User Guide March 11, 2008

Working with R in batch mode: Some notes for beginners

Introduction to ClientTrack 15 for PA HMIS

Using Blackboard Drive to upload/manage content in Blackboard Learn

CSE 303 Lecture 2. Introduction to bash shell. read Linux Pocket Guide pp , 58-59, 60, 65-70, 71-72, 77-80

UNLV Computer Science Department CS 135 Lab Manual

CMSC 201 Spring 2017 Lab 01 Hello World

CP Lab 1: Introduction to DICE and the C compiler

WA2423 JavaScript for Web 2.0 Development. Classroom Setup Guide. Web Age Solutions Inc. Copyright Web Age Solutions Inc. 1

Macintosh OS X 10.4 Tips

Linux Pathnames and Directories

CS108 Lecture 09: Computing with Text Reading and writing files. Aaron Stevens 6 February Overview/Questions

Activating your Home Access Center Account

CHEM5302 Fall 2015: Introduction to Maestro and the command line

Introduction to Network Operating Systems

Working with AutoCAD in Mixed Mac and PC Environment

Transcription:

Getting Started with Command Prompts Updated December, 2017 Some courses such as Java Programming will ask the student to perform tasks from a command prompt (Windows) or Terminal window (Mac OS). Many students have never had an opportunity to work with command prompts before, so this document will introduce the concepts necessary to be successful in the course activities. What is a Command Prompt? Before graphical operating systems like Microsoft Windows and Apple Mac OS, users interacted with computers through a command prompt. Command prompts are text-based windows where users can type commands and receive text-based output. You don t have any familiar mouse input options or graphical buttons, labels, or other widgets common in graphical forms. Windows Command Prompt Mac OS Terminal Prompt http://www.compuscholar.com Page 1

How do I Start a Command Prompt? On Windows computers you can start a command prompt from the Start Menu on Windows 7. Select Programs or Programs and Features and then scroll down to the Accessories folder. Inside the Accessories folder you will find the Command Prompt icon. Click that icon to launch your Command Prompt. Windows 8 and 10 users can search for the Command Prompt by typing command in the search box and selecting the Command Prompt result. On Mac computers, you may have the terminal docked near the bottom of your screen as shown to the left. If not you can start it from your Finder application by navigating to your Applications/Utilities folder and clicking on the Terminal icon. http://www.compuscholar.com Page 2

Command Prompts Focus on a Directory Your computer hard drive contains a number of directories and sub-folders in a hierarchical arrangement. Your command prompt will always be focused on one particular directory at a time, and that directory is typically reflected in the text prompt. In the example below the Windows command prompt is focused on the C:\Users\Chris directory. Commands that you type into the Windows command prompt will appear after the right angle bracket >. On Mac OS your directories are also displayed on the command line. In this example we are in the student account home directory, represented by a tilde character (~). Changing Directories Whenever you run a command (such as compiling or running a Java program), that command will execute in the context of your current directory. So you will want to change your current directory to focus the command prompt on the folder that contains your source files. To change the directory, use the cd command. That means from the command prompt you type cd followed by the target directory: cd <target directory> http://www.compuscholar.com Page 3

Directories are names separated by backslashes (Windows) or forward slashes (Mac OS). The parent or higher-level directory is to the left and the child or lower-level directory names are to the right. My Projects\HelloWorld (Windows) My Projects/HelloWorld (Mac OS) In this Windows example we use the cd command to change to a new directory. We can use the same cd command on Mac OS. Depending on your version of Mac OS, you can use the same double-quotes around the entire path, OR you could add a backslash (\) in front of every space within the path like this: The Mac Terminal will only show the last (leaf) subdirectory and not your full path. Above you can see just the HelloWorld part of the full path. Notice how the command prompt changes to reflect the new directory that has the focus. If you attempt to change to an invalid directory you will get an error message! An error message almost certainly means you have made one of these common mistakes: Spelling a directory name incorrectly (Spaces are important! Mac OS is also case sensitive.) Failing to use the correct forward slash (/) or backslash (\) for your operating system. http://www.compuscholar.com Page 4

Forgetting to use double-quotes on Windows to surround your full directory name Forgetting to put a backslash in front of spaces within a path on Mac OS Attempting to change to a directory that does not actually exist If you have not created the HelloWorld directory underneath My Projects in the example above, then you will not be able to cd to that directory and you will receive an error message. If you are confused about what directories are on your hard drive, you can always use Windows File Explorer or Mac OS Finder to review your directory structure and create directories. Some Windows computers may have more than one hard drive identified by different letters like C or D. To change your command prompt to focus on a different drive, just type the drive letter followed by a colon. From there you can use the cd command to access other directories on that different drive. http://www.compuscholar.com Page 5

Absolute vs. Relative Paths When you run the cd command to change to a different directory, you can use an absolute path containing the entire directory structure at once. If your target directory starts with a slash, that indicates an absolute path that will begin from the root of that hard drive. If you omit the leading slash, that means you want to change to a directory relative to your current location. In this example we begin with an absolute step to get to the example user s Documents directory and then take smaller steps to reach HelloWorld. Mac OS works the same way, but you also have a special character (~) that represents your user account s home directory. http://www.compuscholar.com Page 6

Getting Directory Listings Students may want to examine the contents of the current directory in order to confirm that the right files are in the right place. On Windows type dir to get a directory listing. On Mac OS, type ls to get a directory listing. You can also use Windows File Explorer or Mac OS Finder to visually inspect the contents of your directories! Attempting to build and run Java programs against files require you to be in the right directory containing the correct files. If you receive error messages while following the documented activity steps, that means you are either focused in the wrong directory, or have not stored the correct files in that directory. http://www.compuscholar.com Page 7