1 / 26

CO004 Projects on Operating Systems

CO004 Projects on Operating Systems. UNIX - Basics. Outline. Introduction to UNIX UNIX file systems How to connect to UNIX UNIX Access Control on files UNIX Commands - Handling Files and Directories. What is Unix?.

hiero
Download Presentation

CO004 Projects on Operating Systems

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CO004 Projects on Operating Systems UNIX - Basics

  2. Outline • Introduction to UNIX • UNIX file systems • How to connect to UNIX • UNIX Access Control on files • UNIX Commands - Handling Files and Directories

  3. What is Unix? • Unix is just an operating system. It provides the same functionality as the operating systems we all know. • What makes Unix slightly more challenging, is it’s lack of the clickable graphical user interface we are all so accustomed to. • Don’t worry, it’s really not as difficult as it may seem at first! You’ll be a Unix expert in no time.

  4. Structure of UNIX • Hardware • Kernel • Utilities • Shell Hardware Kernel Utilities Shell

  5. File System Structure • To start out, you need to have an understanding of how Unix arranges it’s files. So let’s call the file system a tree. • Think about hanging the tree upside down. All branches (directories) come from the trunk (root), or from other branches (directories). • So if the branches are file folders (directories), then the leaves must be the files contained in the directories!

  6. File System Structure • The trunk is the root directory. • Branches are directories. • Leaves are files.

  7. Example of UNIX file system • Filenames case sensitive • Physical devices can be mounted anywhere / tmp dev etc home usr chris mary lib include bin local lib include bin hello.c test.cpp

  8. File System Structure • So does the file system structure of Unix look similar to another operating system? • It should! It’s very similar to any windows, mac, or linux operating system! • A path to a file from the root could look something like this: /home/chris/hello.c • So you should already know how things work. You just need to know the Unix commands to get around! Note that Unix uses the forward slash! (Opposite of windows)

  9. Connection to LINUX server • Use SSH client: • Any clients supporting SSH connection • Putty • SSH Client • How to access • Server’s ip: 10.4.40.198 • Account (see next slide)

  10. Your account • Your account: • Your student ID: 1009853X-I011-YYYY • s10XYYY • If X denotes a digit, then keep it. • If X denotes an upper-case letter, then keep itunchanged. • YYY shall be the last three digits. • Password • 123456

  11. Login the system • Display like this: • s10XYYY@:~$ • You can change your password later:

  12. UNIX Commands • [s10XYYY@~] $ command [-options] parameter1 parameter2 • command: name of executed programs • options: optional • parameters: optional • Note: most of commands are case sensitive

  13. Basic Unix Commands • Clear – clears the screen • “clear” will give you a blank screen. You can still scroll up to see your text again in putty. • Cat – displays a file (all at once) • “cat myfile” will print out myfile to the screen. • Man – Displays a manual for any command • “man pwd” will give you the manual for the pwd command. • Exit – exits Unix • “exit” will log you out and close putty.

  14. Identifying UNIX Users • The who command identifies current users who are logged on: host% who rbarrett ttyp0 Apr 03 13:46 (spam.lanl.gov) ahg ttyp1 Apr 02 08:27 (penning.lanl.gov) jbp ttyp2 Apr 02 08:58 (telemachus.lanl.) jimm ttyp3 Apr 02 08:52 (ts800-1-tig.lanl) operator ttyp6 Apr 02 09:20 (ibm-op) cadams ttyp7 Apr 15 10:28 (maccda2.mst.lanl)

  15. 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

  16. ls command • Syntax • ls [-Options] [name ...] • Description • Lists contents of directory. • Frequently Used Options • -a List all entries, including . and .. • -d Do not list contents of directories • -lLong listing • -F Mark directories with a '/', etc. • Examples • ls -alF

  17. UNIX access control • File access – regulated by three sets of permissions • Permissions: read (R), write (W), execute (X) • Subjects: owner, group, all

  18. cp command • Syntax • cp [-Options] file1 [file2 ...] target • Description • File1is copied to target. • Frequently Used Options • -f Force remove existing file • -i Ask before removing existing file • -r Copy directory trees • Examples • cp p1.c p2.c • cp p1.c p2.c mydir

  19. mv command • Syntax • mv [-Options] file1 [file2 ...] target • Description • File1 is moved to target. • Frequently Used Options • -fRemoves existing files without prompting the user • -i Asks before removing existing file • Examples • mv p*.c mydir

  20. rm command • Syntax • rm [-f] [-i] file . . . • rm -r [-f] [-i] dirname . . . [file . . .] • Description • Removes files or directories. • Frequently Used Options • -f Removal of files without prompting the user • -i Interactive removal • -r Recursive removal • Examples • rm -f p*.o • rm -r mydir

  21. mkdir command • Syntax • mkdir [-m mode] [-p] dirname . . . • Description • Creates the specified directories. • Options • -m Specifies the mode to be used • -p Create missing intermediate directories • Examples • mkdir -m 700 letter • mkdir abc • mkdir -p ./abc/def/ghi

  22. 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 ..

  23. rmdir command • Syntax • rmdir [-p] [-s] dirname . . . • Description • Removes directories. • Options • -p Remove the directory dirname and its parent directories which become empty. • -s Suppress the message when –p is in effect • Examples • rmdir letter

  24. pwd command • Syntax • pwd • Description • Prints the path name of the working (current) directory. • Examples • pwd

  25. 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

  26. Change password • You can change your password by this command: • s10XYYY@ubuntu:~$ passwd Changing password for s10XYYY. (current) UNIX password: … • Principles of your password: • Not the same as your account • Longer password, at least 8 characters • Not your personal information • Not dictionary words • Good with combination of letters, digital numbers and special characters ($,@, & etc.)

More Related