{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Lectures7-UNIX - UNIX 163 Operating systems An operating...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
UNIX 163
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Operating systems An operating system (OS) is a piece of software that controls the hardware and other pieces of software on your computer. The most popular OS today, Microsoft Windows, uses a graphical user interface (GUI) for you to interact with the OS. This is easy to learn but not very powerful. UNIX, on the other hand, is hard at first to learn, but it allows you vastly more control over what your computer can do. There area actually many different “flavors” of UNIX, but what we’ll cover applies to almost all of them. 164
Background image of page 2
Aside: Mac OS is actually built on top of the UNIX kernel, so everything we’ll do here you can also do on the lab computers. To get to a window with a UNIX command line (called a terminal), go to Applications > Utilities > Terminal. If you’re on a Windows machine, there are programs to “emulate” what a UNIX machine would do, such as Cygwin and VirtualBox. Another option would be to connect remotely to one of the lab machines, which we’ll discuss how to do. 165
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
The differences between, say, Windows and UNIX stem from an underlying philosophy about what software should do. Windows: Programs are large, multi-functional. Example: Microsoft Word. UNIX: Many small programs, which can be combined to get the job done. A “toolbox approach.” Example: stop all my (cgk’s) processes whose name begins with cat and a space: ps -u cgk | grep “[0-9] cat” | awk ‘{print$2}’ | xargs kill 166
Background image of page 4
The UNIX kernel is the part of the OS that actually carries out basic tasks. The UNIX shell is the user interface to the kernel. Like flavors of UNIX, there are also many different shells. For this course, it doesn’t matter which one you use. The default on the lab computers is called tcsh . the prompt - yours will differ 167
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
The first thing you need to know about UNIX are how to work with directories and files . Technically, everything in UNIX is a file, but it’s easier to think of directories as you would folders on Windows or Mac OS. 168
Background image of page 6
Directories are organized in an inverted tree structure . To see the directory you’re currently in, type the command pwd (“present working directory”). There are two “special” directories: The top level directory, named “/”, is called the root directory . Your home directory , named “~”, contains all your files. For Mary, “~” and “/users/mary” mean the same thing. 169
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
To create a new directory, use the command mkdir . Then to move into it, use cd . $ pwd /Users/cgk $ mkdir unixexamples $ cd unixexamples $ ls $ ls -a . .. ls -a means to show all files, including the hidden files starting with a dot (“.”). The two hidden files here are special and exist in every directory. “.” refers to the current directory, and “..” refers to the directory above it. 170
Background image of page 8
This brings us to the distinction between relative and absolute path names . (Think of a path like an address in UNIX, telling you where you are in the directory tree.) You may have noticed that I typed cd unixexamples , rather than cd /Users/cgk/unixexamples .
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}