The Linux Environment - cs.montana.eduagata.gruza/slides/02-Linux.pdfThe Linux Environment...

10
The Linux Environment Programming with C CSCI 112, Spring 2015 Patrick Donnelly Montana State University

Transcript of The Linux Environment - cs.montana.eduagata.gruza/slides/02-Linux.pdfThe Linux Environment...

The Linux Environment

Programming with C

CSCI 112, Spring 2015

Patrick Donnelly

Montana State University

Linux Flavors

There are many different distributions of the Linux operatingsystems. Some of the most popular are as follows:

• Ubuntu

• Fedora

• CentOS

• Mint

• Debian

The distro used in the lab here on campus is Fedora.

Programming with C (CSCI 112) Spring 2015 2 / 10

A Brief History of Unix

1964

1969

1970

1971

1972

1975

1979

MIT, GE, and Bell Labs develop Multics (“MultiplexedInformation and Computing Service”), an influential earlytime-sharing operating system.

Thompson, Ritchie, Canaday developed a hiercrachical filesystem at Bell Labs.

Peter Neumann coined the project name UNICS (UNiplexedInformation and Computing Service), a pun on Multics.

The UNIX Programmer’s Manual was published on 3November 1971.

Unix was rewritten in the (new) C programming language.

Sixth edition; Bourne shell is introduced.

Seventh edition of Unix released.

Programming with C (CSCI 112) Spring 2015 3 / 10

Ken Thompson (sitting) and Dennis Ritchieworking together at a PDP-11.

Programming with C (CSCI 112) Spring 2015 4 / 10

A Brief History of Unix

1983

1987

1990

1991

1994

1996

2003

2004

AT&T licenses System V - first commercial version of UNIX.

Justice Department mandates breakup of the Bell System.

GNU project is announced by Richard Stallman.

Sun and AT&T cooperated to develop Unix System V R4.

Open Software Foundation released OSF/1.

Sun unveils Solaris 2 operating environment.

Linux is introduced by Linus Torvalds, a student in Finland.

Red Hat Linux is introduced.

KDE development began by Matthias Ettrich.

Fedora, Debian released.

First release of Ubuntu

Programming with C (CSCI 112) Spring 2015 5 / 10

Vision for Unix

What we wanted to preserve was not just a good environment inwhich to do programming, but a system around which a fellowshipcould form. We knew from experience that the essence ofcommunal computing, as supplied by remote-access, time-sharedmachines, is not just to type programs into a terminal instead of akeypunch, but to encourage close communication.

Dennis Ritchie, 1979

Programming with C (CSCI 112) Spring 2015 6 / 10

Shell

Each Linux distribution has it’s own unique software and changesto the visual style.

In the end however, they all share a virtually identical shell thatruns “under the hood”.

• The shell prompt is a text-based interface

• With it you can perform most all tasks you would with a GUI

• It is similar to Windows’ command line, but more robust

In this course, we will do most of our work using the shell.

Programming with C (CSCI 112) Spring 2015 7 / 10

File System

• The Linux file system works like it does on Windows or Mac

• Each directory can contain files or other directories

• When browsing through these directories, the currentdirectory you have open is called the “working directory”

• With shell, contents of your working directory are not shownby default, you must explicitly request that they be listed

• To list directories, use the ls command

• To change directories (i.e. open another folder), use the cdcommand, followed by the target directory

• Note that in any directory, “.” is the name of the currentdirectory, “..” is the name of the parent directory, and “-” isthe name of the previously visited directory

Programming with C (CSCI 112) Spring 2015 8 / 10

Creating Files and Directories

• To create a file, use the touch command followed by the nameof the file to create.

• To create a directory, use the mkdir commmand followed bythe name of the directory you wish to create.

• To quickly view the contents of a file, use the cat commandfollowed by the name of the file you wish to view.

Programming with C (CSCI 112) Spring 2015 9 / 10

Text Editors

The following is a list of text editors in order of learning difficulty.

Nano

• Usage: nano filename.txt

• Nano is a minimalistic text editor, but is easy to learn forfirst-time Linux users.

Emacs

• Usage: emacs filename.txt

• Emacs has a steeper learning curve, but has many excellentfeatures for programming.

Vim

• Usage: vim filename.txt

• Similar to Emacs, Vim has many nice features but it is moredifficult to learn.

Programming with C (CSCI 112) Spring 2015 10 / 10