CHAPTER 1 UNIX FOR NONPROGRAMMERS

Similar documents
CSCI 2132 Software Development. Lecture 4: Files and Directories

Getting Started. Running Utilities. Shells. Special Characters. Special Characters. Chapter 2 Unix Utilities for non-programmers

Mills HPC Tutorial Series. Linux Basics I

Introduction to the Linux Command Line

AN INTRODUCTION TO UNIX

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

Files and Directories

Files

Introduction: What is Unix?

SECTION -C. Getting Started with UNIX

Unix Filesystem. January 26 th, 2004 Class Meeting 2

commandname flags arguments

Outline. Structure of a UNIX command

Working with Basic Linux. Daniel Balagué

A Brief Introduction to Unix

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

Chapter-3. Introduction to Unix: Fundamental Commands

Unix Introduction to UNIX

CS4350 Unix Programming. Outline

Introduction to Linux

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Operating Systems. Copyleft 2005, Binnur Kurt

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

The Unix Shell & Shell Scripts

Introduction to Linux Basics

Week 2 Lecture 3. Unix

CSCI 2132 Software Development. Lecture 5: File Permissions

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

UNIX File Hierarchy: Structure and Commands

Introduction to the UNIX command line

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

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

Linux Command Line Primer. By: Scott Marshall

Essential Linux Shell Commands

Operating Systems. Engr. Abdul-Rahman Mahmood MS, PMP, MCP, QMR(ISO9001:2000) alphapeeler.sf.net/pubkeys/pkey.htm

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

Practical Session 0 Introduction to Linux

Introduction to Unix: Fundamental Commands

Unix File System. Learning command-line navigation of the file system is essential for efficient system usage

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

Unix background. COMP9021, Session 2, Using the Terminal application, open an x-term window. You type your commands in an x-term window.

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

UNIX Quick Reference

Basic UNIX Commands BASIC UNIX COMMANDS. 1. cat command. This command is used to create a file in unix. Syntax: $ cat filename

Week Overview. Unix file system File types and file naming Basic file system commands: pwd,cd,ls,mkdir,rmdir,mv,cp,rm man pages

CISC 220 fall 2011, set 1: Linux basics

Oxford University Computing Services. Getting Started with Unix

Introduction to Linux Basics Part I. Georgia Advanced Computing Resource Center University of Georgia Suchitra Pakala

genome[phd14]:/home/people/phd14/alignment >

CS Unix Tools. Lecture 2 Fall Hussam Abu-Libdeh based on slides by David Slater. September 10, 2010

Chapter 2 Unix Utilities for non-programmers

CSN08101 Digital Forensics. Module Leader: Dr Gordon Russell Lecturers: Robert Ludwiniak

Permission and Ownership

Lab Working with Linux Command Line

2) clear :- It clears the terminal screen. Syntax :- clear

Operating Systems, Unix Files and Commands SEEM

This lab exercise is to be submitted at the end of the lab session! passwd [That is the command to change your current password to a new one]

Treebeard's Unix Cheat Sheet

acmteam/unix.pdf How to manage your account (user ID, password, shell); How to compile C, C++, and Java programs;

FREEENGINEER.ORG. 1 of 6 11/5/15 8:31 PM. Learn UNIX in 10 minutes. Version 1.3. Preface

Unix Basics. Systems Programming Concepts

Quick Start Guide. by Burak Himmetoglu. Supercomputing Consultant. Enterprise Technology Services & Center for Scientific Computing

Basic Unix Commands. CGS 3460, Lecture 6 Jan 23, 2006 Zhen Yang

Linux Training. for New Users of Cluster. Georgia Advanced Computing Resource Center University of Georgia Suchitra Pakala

Unix Workshop Aug 2014

: the User (owner) for this file (your cruzid, when you do it) Position: directory flag. read Group.

The Directory Structure

CS Fundamentals of Programming II Fall Very Basic UNIX

CENG 334 Computer Networks. Laboratory I Linux Tutorial

UNIX Quick Reference

Linux Shell Script. J. K. Mandal

Crash Course in Unix. For more info check out the Unix man pages -orhttp:// -or- Unix in a Nutshell (an O Reilly book).

Basic UNIX Commands BASIC UNIX COMMANDS. 1. cat command. This command is used to create a file in unix. Syntax: $ cat filename

Introduction to Linux

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

User Guide Version 2.0

CHAPTER - 1

Introduction to Linux Workshop 1

Table Of Contents. 1. Zoo Information a. Logging in b. Transferring files 2. Unix Basics 3. Homework Commands

CSE II-Sem)

12/7/10 ATSC 212 UNIX ATSC 212 ATSC 212 UNIX

CS246 Spring14 Programming Paradigm Notes on Linux

UNIX. Basic UNIX Command

THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering

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

The Linux Command Line & Shell Scripting

Introduction to Linux

INSE Lab 1 Introduction to UNIX Fall 2017

Unix Tutorial. Beginner. CS Help Desk: Marc Jarvis (in spirit), Monica Ung, Corey Antoniuk 2015

A Big Step. Shell Scripts, I/O Redirection, Ownership and Permission Concepts, and Binary Numbers

Practical 4. Linux Commands: Working with Directories

The Unix Shell. Permissions

Introduction to Linux

CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX

INTRODUCTION TO BIOINFORMATICS

Scripting. Shell Scripts, I/O Redirection, Ownership and Permission Concepts, and Binary Numbers

Brief Linux Presentation. July 10th, 2006 Elan Borenstein

Std: XI CHAPTER-3 LINUX

d. 1 e. test: $a: integer expression expected

Unix Handouts. Shantanu N Kulkarni

Transcription:

CHAPTER 1 UNIX FOR NONPROGRAMMERS The man command is used to display the manual entry associated with word entered as argument. The -k option is used displays a list of manual entries that contain entered keyword man [chapter] word #displays the manual entry associated with word man -k keyword #displays a list of manual entries that contain keyword Note that in a command line all characters that follow up # to a new line are comment is comment CREATING A FILE Use editors vi, emacs, pico or the cat command cat >myfile # is system prompt ^D note: ^D is end of file LISTING THE CONTENTS OF A DIRECTOTY : ls ls adglsr {filename}* {diectory name}* note: * means zero or more, + means one or more options a : list also hidden files, i.e. the filenames starting with. d : directories g: include info about file group l: long listing R: recursively list the contents of subdirectories 1

ls myfile ls l myfile - r w - r - - r - - 1 halici 14 April 15 11:41 myfile file type and permissions - r w - r - - r - - file type permissions for owner permissions for group # of links owner length date time filename permissions for others LISTING A FILE: cat/more/page/head/tail cat: concatanate more, page: to display in parts without scroll head: first n lines, for default n=10 tail: last n lines, for default n=10 cat myfile head -2 tail -2 RENAMING A FILE : mv mv i oldfile newfile # renames oldfile as newfile mv i {file name}* directoryname # moves collection files to directory mv i olddirect newdirect # moves files in olddirect to newdirect Note: -i prompts confirmation if newfilename already exists mv myfile ls cat 2

MAKING A DIRECTORY: mkdir mkdir newdirectoryname mkdir ls l -rw-r--r-- 1 halici 14 April 15 11:41 drwxr-xr-x 2 halici 512 April 15 11:50 / mv ls ls ls R : MOVING TO A DIRECTORY: cd, chdir pwd # print working directory /home122/halici cd pwd / home122/halici/ COPYING A FILE : cp cp i oldfilename newfilename cp ir {file name}* directoryname options: i: confirm r: recursively copy subdirectories cp mysecondfile ls mysecondfile DELETING A DIRECTORY: rmdir pwd / home122/halici/ cd.. # change to parent directory pwd / home122/halici ls 3

rmdir rmdir: : directory not empty An error message by the system is displayed. The directory is not deleted since it is not empty. DELETING A FILE : rm rm fir {filename}* f: inhibit error messages i: inform each time r: recursivey (if filename is a directory) ls ls mysecondfile rm /* #remove all files in directory ls All the files under the directory are deleted, nothing remains to list by ls PRINTING A FILE : lpr cat >my Amet ^D ls my cat my Amet lpr my # send the content of the file to printer COUTING WORDS IN FILE: wc wc -lwc {filename}* options: l: lines, w:words, c: characters 4

wc l my 3 wc w my 3 wc c my 14 wc my #no option is used, this is equivalent to lwc all together 3 3 14 l w c FILE TYPES - regular file d directory file b buffered special file (such as disk drive) c unbuffered special file (such as disk terminal) l symbolic link p pipe s socket FILE PERMISSIONS r w - r - - r - - user group others r read w write x execute regular file directory special file The process can read the directory (i.e. list the names of the files that it contains) system call The process may read the contents The process may change the contents The process may execute the file (which only makes sense if it is a program) The process may add or remove files to/from the directory The process may access files in the directory or any of its subdirectories The process may read from the file using the read( ) The process may write to the file using the write( ) system call No meaning 5

CHANGING FILE S PERMISSIONS: chmod chmod R change{,change}* filename+ R: recursively change modes if filename is a directory change : cluster selection operation new permission u (user) + (add) r (read) g (group) - (remove) w (write) o (others) = (assign) x (execute) a (all) Examples for change{,change}* g+w u-wx o+x u+w,g-r g=r add group write permission remove user write and execute permissions add others execute permission add write permission for user and remove read permission from group give group just read permission ls l my -rw-r--r-- 1 halici 14 April 15 12:05 my chmod o-r my # remove read permission from others -rw-r----- 1 halici 14 April 15 12:05 my The chmod utility allows you to specify the new permission setting of a file as an octal number user group others rwx rwx rwx setting rwx r-x --- binary 111 101 000 octal 7 5 0 chmod 750 my ls l my -rwxr-x--- 1 halici 14 April 15 12:05 my Permission is set as desired 6

cat >a aaa ^D chmod u-w a # remove write permission from user ls l a #see that it is removed -r--r--r-- 1 halici 4 April 15 12:10 a rm a #delete the file a ls The file is removed! Deleting a file depends on not on the file s write permission but the write permission of the directory that contains it (ie udating the content of the directory) GROUPS Suppose that I am a member of the group ee ls lg myfile # option g stands for listing also file s group -rw-r--r-- 1 halici 14 ee April 15 12:20 myfile groups #list my group ee If I want to be added to a new group, say named cls, I should request the system administrator to do it. CHANGING FILE S GROUP : chgrp chgrp R groupid {filename}* R: recursively changes the group of the files in a directory ls lg myfile -rw-r--r-- 1 halici 14 ee April 15 12:20 myfile chgrp cls myfile ls lg myfile -rw-r--r-- 1 halici 14 cls April 15 12:20 myfile 7