Unix : Introduction and Commands Fundamental of information technology
Objectives Introduce Operating Systems concepts Provide a brief history of the Unix operating system. Provide a brief overview of the Unix system Introduce the Unix command structure Introduce a simple Unix session including: Logging on Changing Passwords (passwd) cal [mon [year]] date man Unixcommand Logging off (exit)
Unix A Brief History Developed for AT&T at Bell Labs by Ken Thompson in 1969. Rewritten in C by Dennis Ritchie Developed by programmers for programmers Became widely available in 1975. University of California, Berkeley created the Berkeley Software Distribution (BSD) version. AT&T combined their version with BSD, XENIX, and SunOS to create System V
Unix: What’s in a name? Unix may be shown as UNIX ®, Unix, Unix® UNIX® is a register trademark of The Open Group (as of 2007) the certifying body of the UNIX trademark
What Unix does Control program for computers managing: Processes Multi users Memory Files Provides support utilities called commands for: Executing programs File management File editing Process management
Unix Overview H/W Kernel Shell interfaces User Unix
Overview of Unix System Kernel & Shell Unix/Linux is operating system (OS). Unix system is described as kernel & shell. Kernel is a main program of Unix system. it controls hard wares, CPU, memory, hard disk, network card etc. Shell is an interface between user and kernel. Shell interprets your input as commands and pass them to kernel. User input Shell Kernel
Unix Overview (cont.) Multi-user & Multi-process Many people can use one machine at the same time. File & Process Data, directory, process, hard disk etc (almost everything) are expressed as a file. Process is an running program identified by a unique id (PID).
Unix Components Kernel Filesystem Shell Utilities
Unix Operating System Runs on virtually every manufacturer's hardware Works the same way on every computer
Relation of Files & Directories Root is like a file cabinet. A directory is like a file drawer A subdirectory is like a folder within a drawer. A path is a list of directories & subdirectories from root to a specific file or subdirectory. / Root Directories Files UNIX File System
UNIX Directory Structure At login, you are in your home directory. This is your current working directory. All files and directories below your home directory usually belong to you. You change your working directory by changing to another directory (cd). UNIX File System
Pathnames Absolute Pathname: shows the absolute position of a file or directory in the hierarchy; /home/user2/bif/docs begins with a slash (/); and describes how to get to the file from the root. UNIX File System
Filesystems A file is identified by Combining directory pathnames To the filename /usr/local/meeting / root usr files local meeting UNIX File System
Basic Commands Commands ls show files in current position cd change directory cp copy file or directory mv move file or directory rm remove file or directory pwd show current position mkdir create directory rmdir remove directory less, more, cat display file contents man display online manual “ls” stands for list. Pwd stands for present working directory
Basic Commands Commands su switch user passwd change password useradd create new user account userdel delete user account mount mount file system umount unmount file system df show disk space usage shutdown reboot or turn off machine “su” means switch user. When you have several user account on one machine.
Directory Commands mkdir making a directory cd changing your working directory pwd printing your working directory ls listing the contents of a directory rmdir removing a directory UNIX File System
Directory Commands - mkdir Make directory under current working directory host% mkdir docs Make directory under subdirectory host% mkdir docs/index Make directory and subdirectory host% mkdir docs docs/index Make directory using absolute path host% mkdir /usr/tmp/abc User1 (cwd) docs User1 (cwd) docs index UNIX File System
Common Error Messages: mkdir: dirname: File exists mkdir: dirname: Permission denied UNIX File System
Directory Commands - cd userx host% cd docs host% cd /usr/tmp/abc/docs host% cd ~abc/docs host% cd host% cd .. docs /usr tmp abc docs ~abc docs UNIX File System
Common Error Messages: pathname: No such file or directory pathname: Permission denied UNIX File System
Directory Commands - pwd Determining the current working directory: host% pwd /scc/users/chitspit/bif where: / root scc/ file system followed by the delimiter (/) users/ subdirectory of scc chitspit/ directory followed by the delimiter (/) bif current working directory UNIX File System
Directory Commands - ls host% ls bin mbox remodel complex.f outdis test host% ls -sF (Multiple options may be specified) 15 bin/ 256 mbox 3 remodel/ 34 complex.f 6 outdis@ 1 test* host% ls ~chitspit/bin au clst prod show xref cwd UNIX File System
Process Management commands Process is a unit of running program. Each process has some information, like process ID, owner, priority, etc. Commands kill Stop a program. The program is specified by process ID. ps Show process status
Some Unix Shells Bourne Shell (sh) Bourne Again Shell (bash) Korn Shell (ksh) C Shell (csh) many others… 25