- 1 UNIX
- 2 Beginnings of Unix
- 3 Features of UNIX
- 4 Distribution of UNIX
- 5 Source code
- 6 Modifications & Distribution
- 7 Reading List
- 8 Raspberry Pi
- 9 Manipulating text
Beginnings of Unix
After being withdrawn from project Multics Ken Thompson and Dennis Richie started writing UNIX in 1969 at AT&T Bell Labs.
Ken Thompson and Dennis Richie found themselves at the Bell Labs without much hardware or funding.
Having to resort to discarded hardware and influenced by their experience of Multics, they start developing UNIX, a super slim operating system, that could run in hardware available and yet include some of appealing features of Multics.
Features of UNIX
Some of the features of UNIX were influenced from Multics,
- it was time-sharing system, allowing for mutiples users to login to the machine
- included the shell: a program which performs command line interpretation **
pwdprint working directory - where am I?
usersprint the user names of users currently logged in to the current host
- tree-structured file system
tree ~/list contents of home (~ == /home/username ) in a tree-like format
ls ~list files and directories in your user home ( ~ == /home/username )
ls .list files and directories in current directory ( . == current dir )
ls ../list files and directories in parent directory ( . == current dir )
ls foo/list files and directories in child foo/ directory
ls /list files and directories in root ( / == root )
- every thing is a file
ls -R / > /dev/dspfile-system as sound
Others emerged from the development and use of the system and crystallized into the Unix Philosophy:
- Write programs that do one thing and one thing well
lslists files in a directory
catoutputs content of file
wccounts number of words in file
- Write programs that work together
echo "hello UNIX world" | sed 's/o/0/g' | sed 's/e/3/g' | sed 's/l/1/g' | figlet
- Write programs that handle text streams, because that is a universal interface
man -a intro | espeakLinux introduction to user commands.
Arguments are like option and or switch of a command-line program.
Some times they have values to them other times they don't.
Some times indicate with one "-" sometimes with two "--"
man -a intro
-a is an argument.
cowsay --e '@@' -T 'jj' 'What are the arguments doing?'
Figure out what each argument does in these two commands?
Distribution of UNIX
Although UNIX was property of Bell Labs and AT&T it was not commercialized.
As AT&T was a state owned monopoly that controlled the US phone service it was legally forbidden to get into the software market.
Instead of making into a market, UNIX remained more of non-commercial. For a low price UNIX could be installed and changed to create derivatives. Yet UNIX's and its derivatives could only be distributed by AT&T. (How was Minix distributed???)
Rather than distributing UNIX and its tools only as binary files, its source code was an integral part of distribution.
Given the lack of documentation in its early years, the availability of source code made possible for users to study and understand undocumented parts of the system.
In Linux distributions download the source code is also possible, by instructing the package manager apt-get to --download-only the source code for cowsay program or any other program
sudo apt-get --download-only source cowsay
_______________________________________ ( apt-get --download-only source cowsay ) --------------------------------------- o ,-^-. o !oYo! o /./=\.\______ ## )\/\ ||-----w|| || || Cowth Vader
Modifications & Distribution
The availability of the source code also allowed users to modify, fix and improve parts of the system, by changing its source code.
These changes constituted a significant development contribution to official distribution of UNIX, and Thompson and Richie eagerly integrated them into the official distribution.
What constituted a technical development brought unclarity to the ownership of UNIX. With code written by several users mingling with code written at Bell Labs was UNIX still the property of AT&T?
To go with the unclear ownership informal distribution where a tape with changes was circulated informally outside AT&T control.
Man(ual) pages - online documentation found on a Unix or Unix-like operating system - began to be written in 1971.
Combined with the availability of the source code, the documentation of the system and its tools made UNIX a popular teaching tool.
Currently, nearly all applications come with a man page, which can be called with
But also components of the operating system have man pages, such as files, system overview.
An extensive list Linux of man pages can be found in https://www.kernel.org/doc/man-pages/
Forking UNIX: Minix
Given its success and possible commercial viability UNIX Version 7 (1979) was released with a license that prohibited its source code from being studied.
UNIX had been for years a learning tool in computer science departments, as it allowed students to first hand study, modify and get to understand the inner-workings of the operating system.
University were now being asked to drop UNIX.
Andrew Tanenbaum who was teaching and using UNIX as a teaching tool at the Vrije Universiteit in Amsterdam, instead of complying decide to write a new UNIX like operating system called Minix. He did so without using a single line from the UNIX source code, but writing it from scratch, so that he and his students could continuing using it a learning tool.
Although conceptually close to UNIX, Minix was a different legal object, outside the control of AT&T.
Forking Minix: Linux
Like UNIX had spread through computer science departments, so did Minix.
In 1991 a Helsinki computer science student named Linus Troval sent an email to the comp.os.minix user group
From: torvalds@klaava.Helsinki.FI (Linus Benedict Torvalds) Newsgroups: comp.os.minix Subject: What would you like to see most in minix? Summary: small poll for my new operating system Message-ID: <1991Aug25.205708.9541@klaava.Helsinki.FI> Date: 25 Aug 91 20:57:08 GMT Organization: University of Helsinki Hello everybody out there using minix – I’m doing a (free) operating system (just a hobby, won’t be big and professional like gnu) for 386(486) AT clones. This has been brewing since april, and is starting to get ready. I’d like any feedback on things people like/dislike in minix, as my OS resembles it somewhat (same physical layout of the file-system (due to practical reasons) among other things). I’ve currently ported bash(1.08) and gcc(1.40), and things seem to work. This implies that I’ll get something practical within a few months, and I’d like to know what features most people would want. Any suggestions are welcome, but I won’t promise I’ll implement them 🙂 Linus (email@example.com) PS. Yes – it’s free of any minix code, and it has a multi-threaded fs. It is NOT protable (uses 386 task switching etc), and it probably never will support anything other than AT-harddisks, as that’s all I have :-(.
Yet again another fork of Unix: basing his design on Minix.
The result was the development of the Linux Kernel
Across the Atlantic, Richard Stallman, was working on the GNU(Not Unix) project - an free Unix like operating system. and license a copyright license, the GNU General Public License, that would guarantee its freedoms.
According to Stallman's Free Software definition:
- The freedom to run the program as you wish, for any purpose (freedom 0).
- The freedom to study how the program works, and change it so it does your computing as you wish (freedom 1). Access to the source code is a precondition for this.
- The freedom to redistribute copies so you can help your neighbor (freedom 2).
- The freedom to distribute copies of your modified versions to others (freedom 3). By doing this you can give the whole community a chance to benefit from your changes. Access to the source code is a precondition for this.
Stallman began writing
- a C compiler: gcc
- a shell: bash
- a text editor: emacs
And a number of other tools.
However a working kernel was a major missing piece in Stallman's effort to create free Unix-like operating system.
Linus decided to release his kernel Linux under the GPL license, since the compiler - gcc - which he has been using and porting was was released under the GPL license.
Stallman and his colleagues sized the opportunity and integrated Linux as the kernel of this new Unix-like operating system, that became known as GNU/Linux. Although for Stallman annoyance Linux became the popular.
Unix and Unix-like operating systems
- apt-get (lower level)
- synaptic (graphic)
- Mac OsX
- homebrew http://brew.sh/
- Brian W. Kernighan & Rob Pike, The Unix Programming Environment, Prentice-Hall, 1984
- Peek, Jerry D., Tim Reilly, and Michael K. Loukides. UNIX Power Tools. Sebastopol, CA: Published in the United States by O'Reilly & Associates, 1997.
- Stephenson, Neal. In the beginning ... was the command line. New York: Avon Books, 1999. PDF
How do you think the artybollocks generator produces it is output?
How could you make a artybollocks like generator for you Bio/CV?
- echo - echo what text is in front of the command
- cat - concatonate (aka) print the content of a file
- wget - network downloader
- sed - to read specific file lines: sed -n LINENUMBERp e.g sed -n 4p sed -n 5,10p
- wc - word/line/character counter
- dadadodo - markov-chain based text generator
cat myfile.txt | dadadodo -
- install it: sudo apt-get install jp2a
- jpg image
- do the conversion
- text-to-speech: espeak
- write username - chat with the users
- wall - message to all users
chaining programs aka piping
echo HI WORLD | figlet -f /home/pi/figlet-fonts/ticksslant.flf > /dev/ttyUSB0 echo "yolo" | figlet -f /home/pi/figlet-fonts/weird.flf > /dev/ttyUSB0 echo "yolo" | figlet -f /home/pi/figlet-fonts/madrid.flf
- sed - stream editor for replacing terms/character. e.g. where e is replaced by 3: sed 's/e/3/g'
cat mona.txt | sed 's/0/?/g' cat mona.txt | sed 's/e/3/g'| sed 's/o/0/g'| sed 's/a/4/g'
- sort - sort (alphabetically) lines of text files
sort --random-sort userlist.txt | head -n 1
cat silvio.txt | dadadodo -c 1 - | espeak