Unix Basics. Systems Programming Concepts

Similar documents
Week 2 Lecture 3. Unix

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

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

Lab 1 Introduction to UNIX and C

A Brief Introduction to Unix

Perl and R Scripting for Biologists

CSCE 212H, Spring 2008, Matthews Lab Assignment 1: Representation of Integers Assigned: January 17 Due: January 22

Unix Tutorial Haverford Astronomy 2014/2015

Introduction to Linux

Introduction to the UNIX command line

CS Fundamentals of Programming II Fall Very Basic UNIX

INSE Lab 1 Introduction to UNIX Fall 2017

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.

Operating Systems. Copyleft 2005, Binnur Kurt

Unix tutorial. Thanks to Michael Wood-Vasey (UPitt) and Beth Willman (Haverford) for providing Unix tutorials on which this is based.

Operating Systems 3. Operating Systems. Content. What is an Operating System? What is an Operating System? Resource Abstraction and Sharing

Introduction to the Linux Command Line

Lab 2: Linux/Unix shell

Linux Survival Guide

Outline. Structure of a UNIX command

Getting started with Hugs on Linux

CSCI 2132 Software Development. Lecture 5: File Permissions

Mills HPC Tutorial Series. Linux Basics I

Introduction to UNIX. Introduction EECS l UNIX is an operating system (OS). l Our goals:

CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX

Read the relevant material in Sobell! If you want to follow along with the examples that follow, and you do, open a Linux terminal.

Lab Working with Linux Command Line

LOG ON TO LINUX AND LOG OFF

Introduction to the Linux Command Line January Presentation Topics

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

Introduction to Unix: Fundamental Commands

commandname flags arguments

Linux Essentials. Programming and Data Structures Lab M Tech CS First Year, First Semester

CS CS Tutorial 2 2 Winter 2018

The Directory Structure

The Unix Shell & Shell Scripts

CpSc 1111 Lab 1 Introduction to Unix Systems, Editors, and C

Linux Command Line Primer. By: Scott Marshall

Connecting to ICS Server, Shell, Vim CS238P Operating Systems fall 18

EECS Software Tools. Lab 2 Tutorial: Introduction to UNIX/Linux. Tilemachos Pechlivanoglou

Introduction to Linux

UNLV Computer Science Department CS 135 Lab Manual

Introduction to UNIX. Introduction. Processes. ps command. The File System. Directory Structure. UNIX is an operating system (OS).

Introduction to UNIX. CSE 2031 Fall November 5, 2012

Oregon State University School of Electrical Engineering and Computer Science. CS 261 Recitation 1. Spring 2011

Set 1 MCQ Which command is used to sort the lines of data in a file in reverse order A) sort B) sh C) st D) sort -r

Introduction to Linux

CS246 Spring14 Programming Paradigm Notes on Linux

CHAPTER 1 UNIX FOR NONPROGRAMMERS

An Introduction to Unix Power Tools

CISC 220 fall 2011, set 1: Linux basics

Linux File System and Basic Commands

CMSC 104 Lecture 2 by S Lupoli adapted by C Grasso

Introduction p. 1 Who Should Read This Book? p. 1 What You Need to Know Before Reading This Book p. 2 How This Book Is Organized p.

CSCI 2132 Software Development. Lecture 4: Files and Directories

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.

Getting started with Hugs on Linux

CS 307: UNIX PROGRAMMING ENVIRONMENT KATAS FOR EXAM 1

Introduction to UNIX. Logging in. Basic System Architecture 10/7/10. most systems have graphical login on Linux machines

Working with Basic Linux. Daniel Balagué

Using UNIX. -rwxr--r-- 1 root sys Sep 5 14:15 good_program

Introduction to Unix The Windows User perspective. Wes Frisby Kyle Horne Todd Johansen

Getting Started With UNIX Lab Exercises

MTU Computer Structure

Introduction to Linux Organizing Files

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 Basics. Benjamin S. Skrainka University College London. July 17, 2010

Linux Operating System Environment Computadors Grau en Ciència i Enginyeria de Dades Q2

You should see something like this, called the prompt :

Computer Systems and Architecture

Using the Unix system. UNIX Introduction

Unix File System. Class Meeting 2. * Notes adapted by Joy Mukherjee from previous work by other members of the CS faculty at Virginia Tech

SECTION -C. Getting Started with UNIX

Self-test Linux/UNIX fundamentals

AN INTRODUCTION TO UNIX

Lezione 8. Shell command language Introduction. Sommario. Bioinformatica. Mauro Ceccanti e Alberto Paoluzzi

THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering

CS 3410 Intro to Unix, shell commands, etc... (slides from Hussam Abu-Libdeh and David Slater)

Files and Directories

System Programming. Introduction to Unix

Unix/Linux Operating System. Introduction to Computational Statistics STAT 598G, Fall 2011

COSC UNIX. Textbook. Grading Scheme

Brief Linux Presentation. July 10th, 2006 Elan Borenstein

Introduction to Linux

Lezione 8. Shell command language Introduction. Sommario. Bioinformatica. Esercitazione Introduzione al linguaggio di shell

Unix L555. Dept. of Linguistics, Indiana University Fall Unix. Unix. Directories. Files. Useful Commands. Permissions. tar.

Linux Exercise. pwd answer: We call this directory (into which you get when you log in) your home directory.

Introduction to Linux. Fundamentals of Computer Science

Chapter 1 An Introduction to C++, Unix, SSH and Komodo Edit

Introduction of Linux

When talking about how to launch commands and other things that is to be typed into the terminal, the following syntax is used:

Basic UNIX commands. HORT Lab 2 Instructor: Kranthi Varala

The Unix Shell. Pipes and Filters

Unix Filesystem. January 26 th, 2004 Class Meeting 2

Unix Introduction to UNIX

Files

CENG 334 Computer Networks. Laboratory I Linux Tutorial

Getting your department account

1. What statistic did the wc -l command show? (do man wc to get the answer) A. The number of bytes B. The number of lines C. The number of words

Short Read Sequencing Analysis Workshop

Transcription:

Concepts

Unix directories Important Unix file commands man, pwd, ls, mkdir, cd, cp, mv File and directory access rights through permission settings Using chmod to change permissions Other important Unix commands emacs, cat, rm, ps, kill 2

Unix File Structure Hierarchical file system File System starts at root, denoted /. Abstraction is to navigate through the Unix directory structure relative to the current working directory. Slashes separate directory levels. File names cannot have blanks and lowercase is preferred {case-sensitive}. Extensions are just conventions to the file system, but NOT to compilers! 3

Unix File Notation. = the current directory.. = the parent directory ~ = my home directory (i.e., the current directory when I login) File name wild cards? = any one character * = any zero or more characters 4

Unix Commands Basic format: Command option parameters ls l labs* cp old.c new.c Unix commands can be cryptic and many are only two characters long, but an important exception is: man = manual page request man ls 5

Commands: pwd & ls pwd = print working directory ls = list file names and attributes. -l = long listing -d = list directory itself, not contents -a = all files (including starting with. ) ls [just file names] ls la [lots of info!] ls la labs* [only info on labs files] ls d [just directory names] 6

Commands: mkdir & cd mkdir = make a new directory mkdir newdir cd = change directory cd newdir cd../updir cd [change to home directory] 7

Commands: mv & cp cp = copy file cp source destination -p = preserve permissions cp p old.c new.c cp prog1.c prog_dir/ cp *.c prog_dir/ mv = move file mv source destination mv prog1.c distance.c mv prog1.c prog_dir/ For both commands if the destination is an existing directory, the file name stays the same. 8

File and Directory Permissions Each file or directory has three sets of permissions: User (i.e. owner) Note - Only the user can change permissions. Group (e.g., cs2303 ) Other (the world!) Each permission set has three permissions: Read Write Execute These are visible left to right via: ls la 9

File and Directory Permissions Read access = You can read the file contents. You can list the contents of the directory. Write access = You can write into this file. You can modify this directory. Execute access = You can run this file as a command. You can use this directory as part of a path. To access any file, you first need execute permission on all directories from the root to the file. 10

Command: chmod chmod = Change mode (permissions) chmod mode files mode: specify users: u, g, o and a (for all) specify attribute: r, w, or x connect with action: + = add - = delete = = set 11

Command: chmod Examples: chmod u+x prog4.cpp chmod o-r prog4.cpp chmod u=rwx prog4.cpp chmod o+r,g+r prog4.cpp You can also use octal numbers: chmod 700 prog2.c chmod 750 sample.c 12

Commands: emacs, cat, more command filename {generic format} emacs used to edit a file emacs lab1.c cat prints text file to stdout cat lab1.c more prints text file (only fill one screen) more lab1.c hit the space bar to see more or q to quit. 13

Commands: rm, ps, kill rm = delete a file rm olddat.txt ps = print currently active processes ps kill = stop one of your running processes kill -9 26814 14

Example: ps kill $emacs simple.c {inside edit of simple.c} ^z $ps PID TTY type % to resume TIME CMD 26792 pts/17 00:00:00 tcsh 26814 pts/17 00:00:00 emacs 26815 pts/17 00:00:00 ps $ kill -9 26814 $ [1] Killed emacs simple.c 15

Review of Unix directories Important Unix file commands man, pwd, ls, mkdir, cd, cp, mv File and Directory Access Rights through Permission Settings Using chmod to change permissions Other important commands emacs, cat, rm, ps, kill 16