The Command Line Mostly MS Dos with some UNIX/LINUX Copyright © 2003-2015 Curt Hill.

Slides:



Advertisements
Similar presentations
DOS commands.
Advertisements

DOS & Windows O/s Prof. Sujata Rao Less 5.
A batch file is a file that contains a number of DOS commands, each of which could be run individually from the command prompt. By putting them into a.
Operating System Type of Operating System
Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
Jump to first page Unix Commands Monica Stoica Jump to first page Introduction to Unix n Unix was born in 1969 at Bell Laboratories, a research subdivision.
Cosc 4750 Getting Started in UNIX Don’t be afraid of the prompt, in linux it can be your best friend. In some cases, the only way to do certain things.
© 2007 The McGraw-Hill Companies, Inc. All rights reserved Working with the Command- Line Interface Chapter 14.
Now, return to the Unix Unix shells: Subshells--- Variable---1. Local 2. Environmental.
Command Console Tutorial BCIS 3680 Enterprise Programming.
FILES  A file is a collection of related information  Files are kept in directories on a disk.
Operating System Fundamentals
Windows Command Line Operating Systems Labs 3, 4, 5.
1 Some basic Unix commands u Understand the concept of loggin into and out of a Unix shell u Interact with the system in a basic way through keyboard and.
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software.
L INUX C OMMAND L INE I NTERFACE G UNAANBAN.G
Using Macs and Unix Nancy Griffeth January 6, 2014 Funding for this workshop was provided by the program “Computational Modeling and Analysis of Complex.
Or CMD/BATCH.  Title this comand makes the cmd prompt’s title whatever you would like it to be.
Ch 71 Using ATTRIB, SUBST, XCOPY, DOSKEY, and the Text Editor.
COMP1070/2002/lec4/H.Melikian COMP1070 Lecture #5  Files and directories in UNIX  Various types of files  File attributes  Notion of pathname  Commands.
DOS Understanding what you can do. Operating System Traits An OS only works with one type of processor –X86 processors for us; Motorola for Mac –Must.
Ch 51 Internal Commands COPY and TYPE. Ch 52 Overview Will review file-naming rules.
DOS Commands What is a command Types of DOS Commands Basic Terms
Ch 61 Using DEL, REN, MOVE, and RD /S. Ch 62 Overview Will continue to work with internal commands that help manage and manipulate files.
1 THE UNIX FILE SYSTEM By Chokechai Chuensukanant ID COSC 513 Operating System.
Unix Primer. Unix Shell The shell is a command programming language that provides an interface to the UNIX operating system. The shell is a “regular”
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
Chapter 9 Part II Linux Command Line Access to Linux Authenticated login using a Linux account is required to access a Linux system. The Linux prompt will.
Ch 21 Command Syntax Using the DIR Command with Parameters and Wildcards.
Chapter Four UNIX File Processing. 2 Lesson A Extracting Information from Files.
More Command Line Options Pipes, Redirection, Standard files Copyright © 2015 Curt Hill.
®® Microsoft Windows 7 for Power Users Tutorial 13 Using the Command-Line Environment.
Ch 41 Program Files, Data Files, and Subdirectories.
1 The EDIT Program The Edit program is a full screen text editor that allows you to: Create text files Create text files Edit an existing text files Edit.
UNIX Commands. Why UNIX Commands Are Noninteractive Command may take input from the output of another command (filters). May be scheduled to run at specific.
1 Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux Commands Reading None.
Lesson 2-Touring Essential Programs. Overview Development of UNIX and Linux. Commands to execute utilities. Communicating instructions to the shell. Navigating.
Operating Systems Concepts 1/e Ruth Watson Chapter 3 Chapter 3 DOS Ruth Watson.
BIF713 Basic Unix/Linux Commands Getting Help with Commands.
Basic MS-DOS. History MS-DOS 1.0 was released in August 1981, and was updated until April 1994 when it was replaced by Windows 95 All versions of windows.
Chapter 1 : The Linux System Part 2 Lecture 2 11/14/
1.  Microsoft DOS (Disk Operating System) use a command line user interface.command line  A command line user interface means that the user is required.
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification, Third Edition
Introduction to Programming Using C An Introduction to Operating Systems.
Operating System Fundamentals 1. Components of an OS 2. Functions of an OS 3. Types of OS 4. Command-line tools.
File and Folder CLI Commands 12/24/ Agenda Overview of OS functions and the SHELL Internal v External Commands Command History Making & Modifying.
Basic DOS How to get some work done. It’s all a file Everything is a file: OS files, Application files, Data files and Game files Files have 8.3 names:
Copyright © 2007 Heathkit Company, Inc. All Rights Reserved PC Fundamentals Presentation 10 – Using the Command Line.
© 2015 by McGraw-Hill Education. This proprietary material solely for authorized instructor use. Not authorized for sale or distribution in any manner.
Batch Files Weaker form of UNIX shell scripts. Introduction UNIX may use one of several shells The shell is the command interpreter It interacts with.
Batch Files Weaker form of UNIX shell scripts Copyright © by Curt Hill.
Copyright © Curt Hill Common Dialogs Easily Obtaining File Names in DevC++ Windows Programs.
Batch Files Flow of Control to Strengthen Copyright © by Curt Hill.
Operating Systems and Using Linux Courtesy of John Y. Park 1.
Batch Files More flow of control Copyright © by Curt Hill.
Linux Tutorial Lesson Two *Getting Help in Linux *Data movement and manipulation *Relative and Absolute path *Processes Note: see chapter 1,2,3 from Linux.
Operating System. What is Operating System OS is system software, which may be viewed as collection of software consisting of procedures for operating.
Guide to Parallel Operating Systems with Microsoft Windows XP and Linux Chapter 4 Directory Commands.
Learning Unix/Linux Based on slides from: Eric Bishop.
IST 222 Day 6. DOS Naming Conventions A filename contains up to 8 characters, a separating period, and a file extension of up to three characters This.
MS-DOS is an acronym for MicroSoft Disk Operating System It is a CUI based operating system. It provides user with a command prompt (generally called.
Mostly MS Dos with some UNIX/LINUX
PowerShell Introduction Copyright © 2016 – Curt Hill.
INTRODUCTION TO UNIX: The Shell Command Interface
UNIX/LINUX Commands Using BASH Copyright © 2017 – Curt Hill.
Cmdlets “Command-lets”
Operating System Fundamentals
Chapter 6 Using DEL, REN, MOVE, and RD /S Ch 6.
OPERATING SYSTEM B-TECH III YEAR I SEM BRANCH :ECE
Presentation transcript:

The Command Line Mostly MS Dos with some UNIX/LINUX Copyright © Curt Hill

Introduction The command line interface is a modified time-sharing command interface –Predates GUIs Still important for sophisticated professionals such as Software Engineers Microsoft has been trying to remove it from Windows since before XP Much of what you have seen hides the command line stuff Copyright © Curt Hill

Contrast Windows believes in two different styles of executables –A GUI oriented one and a console oriented on The GUI executable registers its controls and event handlers as its first order of business –By default it does not have a console A console executable does have a console –It immediately starts to do the work involved Copyright © Curt Hill

The Console Often called the DOS box –Only interface DOS had Paradigm is that of a printing terminal or glass teletype –Sequence of lines produced by program and user Minimal editing of the line –Recall previous typed line and backspace Copyright © Curt Hill

Command sequence Machine gives a prompt –Usually a C:...> with blinking cursor You answer with Command and If the command is valid it is executed When command is done go back to prompt Copyright © Curt Hill

Command format A command has this format –CMD parameters and files A command must be properly spelled A parameter is some extra info to the command –DOS standard starts with a slash (/) –UNIX standard starts with a dash (-) –Most are optional It is the program itself that determines the format of the parameter Copyright © Curt Hill

File specification How do we specify a file? –Files have several pieces for their name In DOS –File name –File extension –File directory In UNIX –The extension is just part of the name –A dot is an ordinary character Copyright © Curt Hill

File name Originally 1-8 characters –Now they may be much larger Name is composed of –Letters –Digits –Specials –Only characters that have special meaning in DOS may not be used Name should identify the particular project UNIX is a little more restrictive Copyright © Curt Hill

File type or extension Originally 0-3 characters –Now may be more Separated by a dot from name Used to describe the kind of stuff in the file Predefined extensions –.exe - program –.bmp – bitmap picture –.bat - DOS batch file A batch file will be discussed later Copyright © Curt Hill

File Directory Combination of the disk letter and subdirectory In Windows/DOS disk is a letter followed by a colon –In UNIX disk are represented by load points that are named not lettered Directories and subdirectories are delimited by \ in DOS and / in UNIX –These may be discussed in a subsequent presentation Copyright © Curt Hill

Defaults By default if subdirectory is not specified the current disk and directory are used These may be shown in the prompt –The form of the prompt may be set by the user Extension –Certain programs require certain extensions –Each program may assume an extension or not Copyright © Curt Hill

Wildcards Wildcards are ways to specify a whole group of files at once because of similarity of name * - matches as many characters as possible –No characters need follow it until a. ? - matches one and only one character Wildcards are often interpreted by the program so usage varies Copyright © Curt Hill

The C/C++ main function The standard main function looks like this: int main(int argc, char *argv[]) The initial int is the return value Argc is a count of command line parameters Argv is an array of character strings –The actual command line parameters The program needs to interpret these as it sees fit Copyright © Curt Hill

Parsing the command Def: to parse is to understand the form and meaning of communication or describe the form, function and relationships of a sentence How does DOS determine what to do with the command? Lets look Copyright © Curt Hill

Executable Location Where can an executable be and be found in the command prompt? You would think that executables must be the Windows directory or one of the Program Files directories This is partially but not fully true Executables must be on the Path The Path is an environment variable Copyright © Curt Hill

Environment Variables A set of name value pairs that affect how things operate Both Windows and UNIX have the concept Both systems have a TEMP variable which identifies a directory where a program may create temporary files Both also have the PATH variable Copyright © Curt Hill

The Path The Path environment variable is a string of directory names When a command needs an executable the Path directories are searched –If there are multiple files of the same name, the first one found is used Windows has two paths –A global one for all users –A local one for each user –The two are merged Copyright © Curt Hill

Finding the Path Like all good Windows options there are multiple ways to examine or set Control Panel / System Advanced System Settings Copyright © Curt Hill

Advanced Copyright © Curt Hill

Environment Variables Copyright © Curt Hill

Command Interpretation Suppose that at the prompt the command: XYZ /z abc.def is entered – what happens? The first word is the command name –This may be prefixed by the disk, subdirectory etc. –xyz is assumed to be name of command and /z and abc.def is passed to the command for inspection Copyright © Curt Hill

Searching for the command 1 First the internal commands are searched for this command –The internal commands are in the command processor –They do not have file representations –They include dir, type, ren, del, copy, etc If it is found then it is executed, otherwise the search continues Copyright © Curt Hill

Searching 2 Next we look in the current directory –There are two extensions that can be executed:.EXE.BAT –They will be searched in that order: first xyz.exe and finally xyz.bat If they are not found there, then the path is checked –The order of the directories in the path command is then the order they will be searched Copyright © Curt Hill

Path searches Like in the current directory, the first directory on the path is searched for xyz.exe and then xyz.bat Only if it is not found do we go to the second and subsequent directories If all the directories are searched and the command is not found, then we declare that this is an unknown file or command Copyright © Curt Hill

Advantages The OS does not distinguish between its own external commands and foreign commands Internal commands have an advantage over other commands However external commands are just files like any other If we want to redefine we can If we want to write a new kind of command that makes life easier all we have to do is put it on the path Copyright © Curt Hill

Commands We next want to consider various commands that may be useful These are typically file manipulation command Any executable can be used –If it generates a window it may still be started from the command line –Windows distinguishes between GUI and non-GUI executables Copyright © Curt Hill

DIR Short for directory Displays the files present in the local Command alone shows all files in current directory You may also use file names and wild cards DIR is an internal command UNIX used ls with different options

COPY Make an identical copy of a file COPY source destination COPY a.dat b.dat –Make a copy of a.dat –Same disk, directory, etc –Retains same date as the a.dat UNIX uses cp with different options

Copy Again Accepts wildcards in source file and matching in destination COPY must give it a new name or copy it elsewhere, since a directory can only have 1 identically named item Concatenation of files is allowed using + between file specs for source –COPY b.dat+c.dat all.dat Copyright © Curt Hill

DEL (ERASE) Removes the file from the disk Accepts wildcards DEL *.bak UNIX uses rm with different options

RENAME Gives a new name May abbreviate to REN May use wildcards UNIX uses mv which moves rather than renames A rename is move to same location with different name

CLS Clear the screen Copyright © Curt Hill

Directory Commands Cd or chdir changes the current directory Md or mkdir creates a new directory –Rd or rmdir destroys The directory name follows the command Two specials –Single dot refers to the current directory –Two dots refers the ancestral Copyright © Curt Hill

Conclusion We now have the basics Next we learn about redirection, pipes and standard files Then batch files