180 likes | 304 Views
ITR3 lecture 7: more introduction to UNIX. Thomas Krichel 2002-11-05. ze olde UNIX Philosophy. Make each program do one thing well. These programs are sometimes called tools. Expect the output of every program to be the input to another yet unknown program.
E N D
ITR3 lecture 7:more introduction to UNIX Thomas Krichel 2002-11-05
ze olde UNIX Philosophy • Make each program do one thing well. • These programs are sometimes called tools. • Expect the output of every program to be the input to another yet unknown program. • Simple tools can be connected to accomplish a complex task • Do not hesitate to build new tools • The UNIX tool library keeps growing
Layers in the UNIX System User Interface Users Library Interface Standard Utility Programs (shell, editors, compilers, etc.) System Interface calls User Mode Standard Library (open, close read, write, etc.) UNIX Operating System (process management, memory management, the file system, I/O, etc.) Kernel Mode Hardware (cpu, memory, disks, terminals, etc.)
UNIX Structure • Thekernel is the core of the UNIX system, controlling the system hardware and performing various low-level functions. The other parts of the UNIX system, as well as user programs, call on the kernel to perform services for them. • The shell is the command interpreter for the UNIX system. The shell accepts user commands and is responsible for seeing that they are carried out.
Famous shells • The Bourne shell /bin/sh (default) • The Korn shell /bin/ksh • The C shell /bin/csh • The Bourne Again Shell /bin/bash • The Z shell /bin/zsh • In linux, /bin/sh is usually /bin/bash
stdin, stdout, stderr • Stand for standard input, output and error, • Normally keyboard, screen, screen • Can redirect • > file redirect output to a file • >> file redirect output to append a file • < file use input from file • 2> file redirect error to a file • 2>> file redirect error to append a file
pipe • The vertical bar takes the output and makes it the input of another program. • Example: how many files do I have? ls | grep –c ^ • What is the most recent files? ls –t | tail -1
Machine access • Console access • Network access • Need to know the IP number • That number may be changed by the LIU network. • Run a scheduled job to report the number to wotan, which itself has a static number and name.
cron • cron is a daemon that runs scheduled jobs. • crontab file set a file file to be the schedule. Changing the file does not change the crontab. • The schedule file has a list of times and a list of command that are being executed. • crontab –l lists the crontab • crontab –r removes it.
Contab structure • “Minute” “hour” “day of month” “month” “day of the week” • Day of the week goes 0 to 6, 0 is Sunday. • * means any • Followed by the command, for example • 46 5 * * * rsync --delete -qa /home/krichel krichel@wotan.liu.edu:rsync/arcano/home > /dev/null 2> /dev/null
Internet configuration • You request an IP address using dhcp from your provider with dhclient. There are many ways in which the client can be configured. • You get a report of the configuration of the Internet access with /sbin/ifconfig. • You need to put this in a file • /sbin/ifconfig > host.if where “host” is your host name • Copy this file to wotan account • scp host.if @wotan.liu.edu • Put this is the crontab, every hour, say.
UNIX Structure • Hundreds of applications are supplied with the UNIX system. They support a variety of tasks • copying files • editing text • performing calculations • developing software • Serving web pages etc
naming • DNS attaches names to machines on the Internet. This allows us to keep names • Names are used in collections called domains. Domains must be registered. • Thomas has a DNS server for the domain openlib.org • Thomas can write an application that will take the different *.if files, and collect them on fafner, and create a file will provide with a zone that will name in the itr3.openlib.org domain, as host.itr3.openlib.org
Name calling • Not officially allowed. The University only wants .liu.edu names for machines in the University network. And of course they own the domain and operate the server. • Nevertheless, I could demonstrate how this could work. • Probably next week .
dselect • Is the main tool to add and remove software. • You have to do this as “root”. • Set the distribution to be the “testing”. • Set the apt method for getting package files. • You can also add non-official sources: • http://www.braincells.com/debian sid/ for pine for example
Package conflicts • When you install packages that require others that are not there yet, or when you remove packages that others depend on, the system will prompt you. • Typing “R” at this stage will get you back. • It pays to look at the keystrokes that you can do in dselect and learn the most important ones / search \ repeat search + select - deselect
Dselect • Update updates the package list, gets you the latest version of all packages. • Install does the installation • Configure seems no longer being used • Remove seems no longer being used, removals are done by Install
http://openlib.org/home/krichel Thank you for your attention!