The Command Prompt Commands are the way to “do things” in Unix

Slides:



Advertisements
Similar presentations
1 Introduction to UNIX Ke Liu
Advertisements

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.
Unix Basics. Systems Programming: Unix Basics 2 Unix Basics  Unix directories  Important Unix file commands  File and Directory Access Rights through.
What is Unix? A multi-user networked operating system –“Operating System” Handles files, running other programs, input/output Just like DOS or Windows.
What is Unix? A multi-user networked operating system –“Operating System” Handles files, running other programs, input/output Looks like DOS…but more powerful.
A Mini UNIX Tutorial. What’s UNIX?  An operating system run on many servers/workstations  Invented by AT&T Bell Labs in late 60’s  Currently there.
CS 141 Labs are mandatory. Attendance will be taken in each lab. Make account on moodle. Projects will be submitted via moodle.
Using Macs and Unix Nancy Griffeth January 6, 2014 Funding for this workshop was provided by the program “Computational Modeling and Analysis of Complex.
Systems Programming Concepts
Learning basic Unix command IT 325 operating system.
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.
Introduction to Unix Bent Thomsen Institut for Datalogi Aalborg Universitet.
Introduction to Unix Bent Thomsen Institut for Datalogi Aalborg Universitet.
Unix Basics Chapter 4.
Basic unix commands that everyone should know (Even if you have a mac) Slightly more advanced:
The UNIX development environment CS 400/600 – Data Structures.
Session 2 Wharton Summer Tech Camp Basic Unix. Agenda Cover basic UNIX commands and useful functions.
1 Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux Commands Some content in this lecture added.
Operating Systems and Using Linux CMSC 104, Lecture 3 John Y. Park 1.
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.
BIF713 Basic Unix/Linux Commands Getting Help with Commands.
Welcome to CS323 Operating System lab 1 TA: Nouf Al-Harbi NoufNaief.net.
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: whereis, which, whoami, finger, passwd, cal, date Working with Files: cat, more, less.
Λειτουργικά Συστήματα – Lab2 Γιάννης Πετράκης. Directory Navigation and Control  The Unix file system is set up like a tree branching out from the root.
1 Lecture 2 Working with Files and Directories COP 3353 Introduction to UNIX.
Isecur1ty training center Presented by : Eng. Mohammad Khreesha.
UNIX filesystem CS 2204 Class meeting 2 *Notes by Doug Bowman and other members of the CS faculty at Virginia Tech. Copyright
Linux A practical introduction. 1)Background and Getting Started Linux is an operating system with multiple providers Red Hat/CentOS (our version) Ubuntu.
 Last lesson, the Windows Operating System was discussed along with the Windows command shell  Unix is a computer operating system, that similarly manages.
What is Unix? A multi-user networked operating system –“Operating System” Handles files, running other programs, input/output Just like DOS or Windows.
Learning basic Unix command It 325 operating system.
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.
CMSC 104, Version 8/061L03OperatingSystems.ppt Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux.
Unix Lab Fall Shell Scripting ●Through the shell (LXTerminal) you can: ●Run programs. ●Interact with the file system. ●Change settings. ●Send/receive.
Learning Unix/Linux Based on slides from: Eric Bishop.
CMSC 104, Version 9/011 Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux Commands Reading None.
UNIX To do work for the class, you will be using the Unix operating system. Once connected to the system, you will be presented with a login screen. Once.
Commands Basic syntax of shell commands UNIX or shell commands have a basic structure command -options target command comes first (such as cd or ls) any.
Andy Wang Object Oriented Programming in C++ COP 3330
Lecture 2 Working with Files and Directories
Some Linux Commands.
Useful Linux Commands.
Eric Shook Department of Geography Kent State University
CSE 374 Programming Concepts & Tools
Operating Systems and Using Linux
Operating Systems and Using Linux
Exploring the UNIX File System and File Security
Operating Systems and Using Linux
IWS (Instructional Work Servers)
Operating Systems and Using Linux
Operating Systems and Using Linux
IWS (Instructional Work Servers)
The Unix File System.
Operating Systems and Using Linux
Andy Wang Object Oriented Programming in C++ COP 3330
UNIX/LINUX Commands Using BASH Copyright © 2017 – Curt Hill.
Operating Systems and Using Linux
Operating Systems and Using Linux
CSE 303 Concepts and Tools for Software Development
Operating Systems and Using Linux
Module 6 Working with Files and Directories
What is Unix? A multi-user networked operating system
Lab 2: Terminal Basics.
January 26th, 2004 Class Meeting 2
LPI Linux Certification
Presentation transcript:

The Command Prompt Commands are the way to “do things” in Unix A command consists of a command name and options called “flags” Commands are typed at the command prompt In Unix, everything (including commands) is case-sensitive [prompt]$ <command> <flags> <args> fiji:~$ ls –l -a unix-tutorial Command (Optional) arguments Command Prompt (Optional) flags Note: Many Unix commands will print a message only if something went wrong. Be careful with rm and mv.

Getting help with man man (short for “manual”) documents commands man <cmd> retrieves detailed information about <cmd> man –k <keyword> searches the man page summaries (faster, and will probably give better results) man –K <keyword> searches the full text of the man pages fiji:~$ man –k password passwd (5) - password file xlock (1) - Locks the local X display until a password is entered fiji:~$ passwd

Directories In Unix, files are grouped together in other files called directories, which are analogous to folders in Windows Directory paths are separated by a forward slash: / Example: /homes/iws/robh/classes/cse326 The hierarchical structure of directories (the directory tree) begins at a special directory called the root, or / Absolute paths start at / Relative paths start in the current directory Example: classes/cse326 (if you’re currently in /homes/iws/robh) Your home directory “~” is where your personal files are located, and where you start when you log in. Example: /homes/iws/robh

Directories (cont’d) Handy directories to know / the root directory ls ~ Your home directory .. The parent directory . The current directory ls LiSts the contents of a specified files or directories (or the current directory if no files are specified) Syntax: ls [<args> … ] Example: ls backups/ pwd Print Working Directory

Directories (cont’d further) cd Change Directory (or your home directory if unspecified) Syntax: cd <directory> Examples: cd backups/unix-tutorial cd ../class-notes mkdir MaKe DIRectory Syntax: mkdir <directories> Example: mkdir backups class-notes rmdir ReMove DIRectory, which must be empty first Syntax: rmdir <directories> Example: rmdir backups class-notes

Files Unlike Windows, in Unix file types (e.g. “executable files, ” “data files,” “text files”) are not determined by file extension (e.g. “foo.exe”, “foo.dat”, “foo.txt”) Thus, the file-manipulation commands are few and simple … Many use only 2 letters rm ReMoves a file, without a possibility of “undelete!” Syntax: rm <file(s)> Example: rm tutorial.txt backups/old.txt

Files rm –r Directory - rm a directory and all the file inside it - Syntax: rm –r Directory name - Examples : rm –r 326-hw

Files (cont’d) cp mv CoPies a file, preserving the original Syntax: cp <sources> <destination> Example: cp tutorial.txt tutorial.txt.bak mv MoVes or renames a file, destroying the original Syntax: mv <sources> <destination> Examples: mv tutorial.txt tutorial.txt.bak mv tutorial.txt tutorial-slides.ppt backups/ Note: Both of these commands will over-write existing files without warning you!

Shell Shortcuts Tab completion Command history Wildcards Type part of a file/directory name, hit <tab>, and the shell will finish as much of the name as it can Works if you’re running tcsh or bash Command history Don’t re-type previous commands – use the up-arrow to access them Wildcards Special character(s) which can be expanded to match other file/directory names * Zero or more characters ? Zero or one character Examples: ls *.txt rm may-?-notes.txt

Programs and Compilation To compile a program: javac <options> <source files> Options: -classpath <path> Specify where to find user class files Example: javac –classpath . File.java To run the program java <options> <source files> ceylon:ehsu% javac HelloWorld.java ceylon:ehsu% java –classpath . HelloWorld.java

Next time…. Wildcards Environment Variables Process Management I/O redirection Permissions