(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands1 Faisal Akkawi Department of Computer Science Illinois Institute of Technology.

Slides:



Advertisements
Similar presentations
LINUX System : Lecture 3 (English-Only Lecture) Bong-Soo Sohn Assistant Professor School of Computer Science and Engineering Chung-Ang University Acknowledgement.
Advertisements

1 Introduction to UNIX Ke Liu
ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Jan. 27 th, 2009 Essential Unix Commands.
Introducing the Command Line CMSC 121 Introduction to UNIX Much of the material in these slides was taken from Dan Hood’s CMSC 121 Lecture Notes.
Linux+ Guide to Linux Certification, Second Edition
The Unix Shell. Operating System shell The shell is a command interpreter It forms the interface between a user and the operating system When you log.
T UTORIAL OF U NIX C OMMAND & SHELL SCRIPT S 5027 Professor: Dr. Shu-Ching Chen TA: Samira Pouyanfar Spring 2015.
1 Basics of Linux On linux machine: Login at your home directory Open a “shell” or “terminal” or “xterm” workspace (4) On windows machine Intall linux.
UNIX Overview. 2 UNIX UNIX is a multi-user and multi-tasking operating system. Multi-tasking: Multiple processes can run concurrently. Multi-user: different.
UNIX. find command ● The find command is used to locate files on a Unix or Linux system. find will search any set of directories you specify for files.
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.
7/17/2009 rwjBROOKDALE COMMUNITY COLLEGE1 Unix Comp-145 C HAPTER 2.
Linux Commands LINUX COMMANDS.
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.
COMP1070/2002/lec4/H.Melikian COMP1070 Lecture #5  Files and directories in UNIX  Various types of files  File attributes  Notion of pathname  Commands.
Brief introduction to UNIX A. Emerson CINECA, High Performance Systems.
1 THE UNIX FILE SYSTEM By Chokechai Chuensukanant ID COSC 513 Operating System.
Help session: Unix basics Keith 9/9/2011. Login in Unix lab  User name: ug0xx Password: ece321 (initial)  The password will not be displayed on the.
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.
Offline File Storage. Module 12 Offline File Storage ♦ Introduction Backup is usually done by first collecting all the data in a single archive file,
1 File Management Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung Institute of Technology
CHAPTER 1 UNIX FOR NONPROGRAMMERS By U ğ ur Halıcı.
Linux environment ● Graphical interface – X-window + window manager ● Text interface – terminal + shell.
1 Lecture 2 Working with Files and Directories COP 3344 Introduction to UNIX.
Agenda User Profile File (.profile) –Keyword Shell Variables Linux (Unix) filters –Purpose –Commands: grep, sort, awk cut, tr, wc, spell.
Unix Basics Chapter 4.
File Permissions. What are the three categories of users that apply to file permissions? Owner (or user) Group All others (public, world, others)
Linux+ Guide to Linux Certification, Second Edition
LINUX Tuesday, 5 July :00 pm. Remote Login l Use Secure Shell (ssh) l Machine name/IP address E.g. ssh hydra.sma.nus.edu.sg Or ssh
CS240 Computer Science II Introduction the Unix File System and File Related Utilities Based on “UNIX for Programmers and Users” by G.Class and K. Ables.
Find Find basics. find ~ -name myfile –print find directory criteria This will search the home directory (~) looking for files.
INTRODUCTION TO LINUX Jacob Chan. GNU/Linux Consists of Linux kernel, GNU utilities, and open source and commercial applications Works like Unix –Multi-user.
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.
L&T Infotech1 UNIX – Getting Started - Aneesh Ramani.
Welcome to CS323 Operating System lab 1 TA: Nouf Al-Harbi NoufNaief.net.
Basic Unix Commands CGS 3460, Lecture 6 Jan 23, 2006 Zhen Yang.
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification, Third Edition
Introduction to Programming Using C An Introduction to Operating Systems.
CSC414 “Introduction to UNIX/ Linux” Lecture 5. Schedule 1. Introduction to Unix/ Linux 2. Kernel Structure and Device Drivers. 3. System and Storage.
Basic of UNIX For fresh members of SPARCS
CSE 374 Programming Concepts & Tools Hal Perkins Fall 2015 Lecture 2a – A Unix Command Sampler (Courtesy of David Notkin, CSE 303)
Linux Commands C151 Multi-User Operating Systems.
1 Lecture 2 Working with Files and Directories COP 3353 Introduction to UNIX.
A Brief Overview of Unix Brandon Bohrer. Topics What is Unix? – Quick introduction Documentation – Where to get it, how to use it Text Editors – Know.
Lecture 1: Introduction, Basic UNIX Advanced Programming Techniques.
Learning basic Unix command It 325 operating system.
File Management commands cat Cat command cat cal.txt cat command displays the contents of a file here cal.txt on screen (or standard out).
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.
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.
Tutorial of Unix Command & shell scriptS 5027
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.
C151 Multi-User Operating Systems
CSE 374 Programming Concepts & Tools
Linux Basic Commands Visit to more Learning Resources.
INTRODUCTION TO UNIX: The Shell Command Interface
Tutorial of Unix Command & shell scriptS 5027
Introduction to UNIX.
Tutorial of Unix Command & shell scriptS 5027
Tutorial of Unix Command & shell scriptS 5027
Introduction Paul Flynn
Andy Wang Object Oriented Programming in C++ COP 3330
Linux Commands LINUX COMMANDS.
LPI Linux Certification
Presentation transcript:

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands1 Faisal Akkawi Department of Computer Science Illinois Institute of Technology Chicago, IL 60616

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands2 Topics Handling Files and Directories Text Editors Compiling and Linking Handling Processes Archiving and Compressing Files Other Useful Commands

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands3 Handling Files and Directories ls : list files cp : copy files mv : move files rm : remove files mkdir : make directories cd : change directories rmdir : remove directories pwd : print working directory chmod : change permission mode umask : set file-creation mode mask

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands4 ls command Syntax ls [-Options] [name...] Description Lists contents of directory. Frequently Used Options -aList all entries, including. and.. -dDo not list contents of directories -lLong listing -FMark directories with a '/', etc. Examples ls -alF

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands5 cp command Syntax cp [-Options] file1 [file2...] target Description File1 is copied to target. Frequently Used Options -fForce remove existing file -iAsk before removing existing file -rCopy directory trees Examples cp p1.c p2.c cp p1.c p2.c mydir

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands6 mv command Syntax mv [-Options] file1 [file2...] target Description File1 is moved to target. Frequently Used Options -f Removes existing files without prompting the user -i Asks before removing existing file Examples mv p*.c mydir

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands7 rm command Syntax rm [-f] [-i] file... rm -r [-f] [-i] dirname... [file...] Description Removes files or directories. Frequently Used Options -fRemoval of files without prompting the user -iInteractive removal -rRecursive removal Examples rm -f p*.o rm -r mydir

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands8 mkdir command Syntax mkdir [-m mode] [-p] dirname... Description Creates the specified directories. Options -mSpecifies the mode to be used -pCreate missing intermediate directories Examples mkdir -m 700 letter mkdir abc mkdir -p./abc/def/ghi

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands9 cd command Syntax cd [directory] Description Change working directory. If directory is not specified, the value of shell parameter $HOME is used as the new working directory. Examples cd cd./abc/def/ghi cd..

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands10 rmdir command Syntax rmdir [-p] [-s] dirname... Description Removes directories. Options -pRemove the directory dirname and its parent directories which become empty. -sSuppress the message when –p is in effect Examples rmdir letter

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands11 pwd command Syntax pwd Description Prints the path name of the working (current) directory. Examples pwd

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands12 chmod command Syntax chmod [-R] mode file... chmod [-R] [ugoa]{+|-|=}[rwxXstl] file... Description Changes the permissions mode of a file or directory. Examples chmod 444 file1 chmod ugo+rw p*.c chmod 700 mydir

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands13 umask command – I Syntax umask [ooo] Description Sets file-creation mode mask to ooo. The three octal digits refer to read/write/execute permissions for owner, group, and others, respectively. The value of each specified digit is subtracted from the corresponding ‘digit’ specified by the system for the creation of a file. If ooo is omitted, the current value of the mask is printed.

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands14 umask command – II Examples umask 022 removes group and others write permission (files normally created with mode 777 become mode 755; files created with mode 666 become mode 644).

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands15 Text Editors pico - Simple, easy-to-use text editor vi - Text editor based on an underlying line editor ex emacs - Powerful and extensible - Hard to learn

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands16 pico Layout is very similar to the pine mailer

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands17 vi vi Modes: Command mode : Normal and initial mode. Other modes return to command mode upon completion. ESC (escape) is used to cancel a partial command. Input mode : Entered by setting any of the following options: a A i I o O c C s S R. Arbitrary text may then be entered. Input mode is normally terminated with ESC character. Last line mode : Reading input for : / ? or !.Terminates by typing a carriage return

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands18 Compiling and Linking cc - C compiler - Default behavior is ANSI/ISO C make - Allows programmer to maintain, update, and regenerate groups of computer programs.

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands19 cc command – I Syntax cc [-Options]... file... Description *.c are assumed to be C source programs. *.o are compiled object files. a.out is the default output program name. Frequently Used Options -cProduce an object file -OInvoke optimizer

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands20 cc command – II -o outName the final output file out. -Dname Define the name to the C macro processor -IdirSeek dir for include files Examples cc p1.c

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands21 make command Syntax make [-f makefile] [-eiknpqrsStuwdDPBNMOg] [names] Frequently Used Options -f makefile Description file is makefile -nPrint commands, but do not execute them. -uBuild all targets regardless of whether they are up-to-date or not. Examples make make –f Project1.mak

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands22 Handling Processes ps : Prints information about active processes kill : Sends a signal to a process ipcs : Reports IPC facilities status ipcrm : Removes IPC resource id

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands23 ps command Syntax ps [-Options] Description Prints information about active processes. Frequently Used Options -A Every process now running -e Same as -A -f Full listing -l Long listing Examples ps -ef

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands24 kill command Syntax kill [-signal] pid... kill –l (the letter ‘L’ in lowercase) Description Sends a signal to the specified processes. The value of signal may be numeric or symbolic. Signal 15 is the default signal. kill –l lists the defined signals. Examples kill 389 kill – kill -HUP 99999

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands25 ipcs command Syntax ipcs [-Options] Description Prints information about active IPC facilities. Without options, information is printed for message queues, shared memory, and semaphores that are currently active in the system. Frequently Used Options -qMessage queues -mShared memory segments -sSemaphores Examples ipcs -q

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands26 ipcrm command Syntax ipcrm [-Options] Description Removes messages, semaphore or shared memory identifiers. Frequently Used Options -q msqid Removes the message queue id -m shmid Removes the shared memory segment id -s semid Removes the semaphore id Examples ipcrm -q 231

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands27 Archiving and Compressing tar : Tape archiver compress, uncompress, zcat : Compresses and expands data using adaptive Lempel-Ziv coding gzip : Compresses data using Lempel-Ziv coding gunzip, gzcat : Decompresses files created by gzip, zip, compress, or pack pack, unpack, pcat : Compresses and expands files using Huffman codes

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands28 tar command - I Syntax tar key [arguments] [name...] Description Saves and restores multiple files on a single file. The key argument controls tar's actions. Frequently Used Functions cCreate xExtract from the tape tList files on the tape

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands29 tar command - II Frequently Used Modifiers vVerbose fNext argument is the name of the archive Examples tar cvf my.tar./mydir1./mydir2 tar tvf my.tar tar xvf my.tar

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands30 compress command Syntax compress [ -f ] [ -v ] [ -c ] [ -V ] [ -d ] [ -b bits ] [ name... ] Description Compresses and expands data Compressed file name is *.Z Frequently Used Options -cWrite output on standard output -dUncompress -vVerbose Examples compress my.tar compress -d my.tar.Z

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands31 uncompress command Syntax uncompress [ -f ] [ -v ] [ -c ] [ -V ] [ name... ] Description Uncompresses files Same as compress –d Frequently Used Options -cWrite output on standard output -vVerbose Examples uncompress my.tar.Z

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands32 zcat command Syntax zcat [ name... ] Description Uncompresses files Same as uncompress –c Writes the uncompressed data on standard output Examples zcat my.tar.Z > my.tar

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands33 gzip command Syntax gzip [ -acdfhlLnNrtvV19 ] [-S suffix] [ name... ] Description Compresses and expands data Suffix.gz Frequently Used Options -cWrite output on standard output -dUncompress -hHelp -rRecursive -vVerbose

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands34 gunzip command Syntax gunzip [ -acfhlLnNrtvV ] [-S suffix] [ name... ] Description Uncompresses files (Same as gzip –d ) Automatically detects input format Frequently Used Options -cWrite output on standard output -hHelp -rRecursive -vVerbose

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands35 gzcat command Syntax gzcat [ -fhLV ] [ name... ] Description Uncompresses files (Same as gunzip –c) Writes the uncompressed data on standard output Examples gzcat myfile.gz > myfile

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands36 pack command Syntax pack [ - ] [ -f ] name... Description Compresses files Suffix.z Directories cannot be compressed Options -fForce packing Examples pack myfile

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands37 unpack command Syntax unpack name... Description Expands files created by pack Each.z files is replaced by its expanded version The new file has the.z suffix stripped from its name Examples unpack myfile.z

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands38 pcat command Syntax pcat name... Description Uncompresses files created by pack Files are unpacked and written to the standard output Examples pcat myfile.z pcat myfile pcat myfile.z > myfile

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands39 Other Useful Commands grep : search files for a pattern man : on-line reference manuals wc : word, line and byte or character count

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands40 grep command - I Syntax grep [-E| -F] [-c| -l| -q] [-insvx] pattern_list [file...] Description Searches the input files, selecting lines matching oneor more patterns Frequently Used Options -iCase-insensitive search -lWrite file names only -nDisplay line number

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands41 grep command - II Examples grep -i unix p1.c grep -n UNIX *.c *.h ps –ef | grep mary

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands42 man command Syntax man [-Options] [-M path] [-T macropackage] [ -s section] name... man [-M path] -k keyword... Description On-line reference manuals Frequently Used Sections 1User commands and application programs 2System calls 3Library functions Examples man -s 1 mkdir man mkdir man -k pipe

(c) Faisal Akkawi & Munki Lee 2001Basic UNIX Commands43 wc command Syntax wc [ -c|-m ] [ -lw ] [ file... ] Description Counts lines, words, and characters Options -cCount the number of bytes -mCount the number of characters -lCount the number of newline characters -wCount the number of words Examples wc -l *.h *.c