Using UNIX Charles Duan FAS Computer Services June 12, 2016
FAS Computer Services What’s a Unix? Unix is an Operating System Designed for high-traffic usage Many variants –Linux, BSD: free versions Spelled either Unix or UNIX
June 12, 2016FAS Computer Services Using UNIX Basic Concepts Common Commands Multi-User Functions File System –Structure –Commands –Security UNIX>_
June 12, 2016FAS Computer Services Using UNIX Basic Concepts Common Commands Multi-User Functions File System –Structure –Commands –Security UNIX>_
June 12, 2016FAS Computer Services Multi-Computer, Multi-User Servers Clients
June 12, 2016FAS Computer Services The Shell Person Operating System SHELL User types commands into shell Run program Shell translates commands to machine code
June 12, 2016FAS Computer Services Starting a UNIX Shell Run through an SSH client –PuTTY, SecureCRT, NiftyTelnet Try it! –date, cal [ [month] year] Special Keys –Ctrl-C, Ctrl-D, Ctrl-Q, Ctrl-Z
June 12, 2016FAS Computer Services Using UNIX Basic Concepts Common Commands Multi-User Functions File System –Structure –Commands –Security UNIX>_
June 12, 2016FAS Computer Services Interesting Commands Fun –weather –fortune Useful –man –apropos –date –cal Printing –lpr –enscript Network –ping –traceroute –nslookup –hostname
June 12, 2016FAS Computer Services Commands pine: read mail forwardmail: forward mail blockmail: block mail procmail: proc[ess] mail
June 12, 2016FAS Computer Services FAS/UA Commands fixfinger, fixdotfiles, fixwebfiles: when your account’s acting funny nofinger: keep people from finding you quota: how much disk space do I have left? usage: how much printing budget do I have left? sudo: special UA tools
June 12, 2016FAS Computer Services Using UNIX Basic Concepts Common Commands Multi-User Functions File System –Structure –Commands –Security UNIX>_
June 12, 2016FAS Computer Services What’s on your server? List users online –users –who –last [user] –finger [user] FAS-specific –ph [full name] –rwho [user] What are people doing? –w –ps [aux] Managing your own processes –fg/bg –kill [process #]
June 12, 2016FAS Computer Services Communicating on UNIX write send a one- way message talk have a conversation mesg [y | n]: let people talk to you
June 12, 2016FAS Computer Services Using UNIX Basic Concepts Common Commands Multi-User Functions File System –Structure –Commands –Security UNIX>_
June 12, 2016FAS Computer Services Hierarchical File System /home/c/d/cduan
June 12, 2016FAS Computer Services Remote Home Directories home05 home06 home07 is01 is02 smtp webmail
June 12, 2016FAS Computer Services Using UNIX Basic Concepts Common Commands Multi-User Functions File System –Structure –Commands –Security UNIX>_
June 12, 2016FAS Computer Services File System Commands Browsing commands File Manipulation Commands File Viewing/Editing Commands
June 12, 2016FAS Computer Services File Browsing pwd print working directory % pwd /home15/c/d/cduan cd change directory cd.. up 1 directory % cd /usr/bin % pwd /usr/bin ls list files ll “long” listing % ls file1 file2 file3 file4 file5 file6
June 12, 2016FAS Computer Services File Manipulation mv: move file(s) –mv file1 file2 rename file1 to file2 –mv [file…] dir move files to directory cp: copy file(s) rm: remove file(s) mkdir: create a directory rmdir: remove a directory
June 12, 2016FAS Computer Services File Viewing/Editing cat, more, less, head, tail: view (parts of) files grep word [file…]: find words in files vim: edit files (see tutorial) –Or use that pico program
June 12, 2016FAS Computer Services Using UNIX Basic Concepts Common Commands Multi-User Functions File System –Structure –Commands –Security UNIX>_
June 12, 2016FAS Computer Services File System Security Problem: multiple users, one machine 1.How do we keep data private? 2.How do we make data public? 3.How do we make data partially public?
June 12, 2016FAS Computer Services File System Security Solution: UNIX permissions scheme Three levels of people –Self, group, others Three levels of protection –read, write, execute
June 12, 2016FAS Computer Services File Permission Types LevelFor FilesFor Directories readAble to read file contents Able to list files in directory writeAble to modify file contents Able to create/ remove files executeAble to run file as a program Able to use files in directory
June 12, 2016FAS Computer Services User Permission Levels Self: yourself Group: members of pre-defined system groups (student, ua, etc.) –Generally not treated specially World: every user on the system Root can read/write everything!
June 12, 2016FAS Computer Services Viewing File Permissions: ll -rwxr-xr-x 1 cduan ua... self group worldownergroup read write execute No write permission for world
June 12, 2016FAS Computer Services Changing Permissions: chmod LevelSelfGroupWorld read444 write222 execute111 + chmod 755 [file…]
June 12, 2016FAS Computer Services Common chmod Values Private file Private directory Public file Public directory Public directory, no listing files
June 12, 2016FAS Computer Services Setting Up a Web Page ~cduan/ public_html/ index.html cgi-bin/ script.cgi ! Remember: to read a file, you must be able to execute all higher directories!
June 12, 2016FAS Computer Services Using UNIX: Final Remarks Where to get help –man pages –Internet –UAs, full-time staff, UNIX Group Be safe, be secure, be careful Have fun using UNIX!
June 12, 2016FAS Computer Services