Note: I'll make up an active learning exercise about 10 minutes before the end Warm-up (not really review): Which set of notes was longest? What processors are on systems I can ssh into? We talked about the file tree a bit, on a couple different occasions But now a tour! Slash direction is opposite DOS/Windows Case matters! /tmp /etc /home /dev and /proc /root (and who is root?) /bin, /usr, /opt, /sbin, /sys, /lib, /lib64 /var and /var/log /usr/share/doc Special characters in filenames: Spaces / - (not special) . (not special) Linux does not require file extensions They are commonly omitted on regular text files ~ (your home directory, if it is first) Standard Input, Standard Output, and Standard Error Redirection operators on the command line Ok, time to look at the inside By understanding the inside, you will understand the outside too When you get a new car, don't you take it to bits first thing? C brief intro Came before C++ It's the language Linux is written in Standard programming language for *nix I'll assume you know the first 3 chapters of the C++ text Differences from C++: header files end with .h No namespaces No classes (including cin and cout) And string No standard template library Nested functions are ok C++ is nearly a proper superset of C No nested functions, unless you use lambda Struct initialization is more verbose Casting rules produce more warnings C++ has become very popular for *nix programming K desktop environment, for example It's like C, but has more features I'll use actual C for all examples in this class In CS430, you will too, because the kernel is not in C++ You're welcome to use C++ in this class if you like! Less confusing if you're in CS211 at the same time I'll also try to make sure the examples all work in C++ File descriptors, and read/write write system call (what is a system call?) We'll open a file and write to it How about just using 1 as the file descriptor? 0, 1, and 2, and write How about changing the file descriptor a program writes to? >, and file redirection 2> redirects standard error Parallel for standard in: It's file descriptor 0 We can use the read system call to read from it Let's make a program that just passes things through, and then redirect a file into it! Infinite loop, read, then write cat can do this. Maybe do something trivial, like capitalize all letters A very useful program: grep Searches through standard input or files Permissions User, Group, Other All, which is different from other All is used with letters for chmod setuid root for programs Demo, with c program and system sticky bit and /tmp Undo sticky and see what happens!