Manish Jain
Beginning Modern Unix Learn to Live Comfortably in a Modern Unix Environment
Manish Jain
Jaipur, Rajasthan, India
Any source code or other supplementary material referenced by the author in this book is available to readers on GitHub via the book's product page, located at www.apress.com/9781484235270 . For more detailed information, please visit http://www.apress.com/source-code .
ISBN 978-1-4842-3527-0 e-ISBN 978-1-4842-3528-7
https://doi.org/10.1007/978-1-4842-3528-7
Library of Congress Control Number: 2018950445
Manish Jain 2018
This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of publication, neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made. The publisher makes no warranty, express or implied, with respect to the material contained herein.
Distributed to the book trade worldwide by Springer Science+Business Media New York, 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@springer-sbm.com, or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation.
This book is dedicated very humbly to the Regents of the University of California, Berkeley.
Preface
What is Unix? Its an evolving question that is as old as the Unix operating system itself. In the beginning, there was a clear answerUnix was what AT&T, its creator, shipped to customers and developers beginning around 1970. Its chief architects then were Ken Thompson and Dennis Ritchie.
One of the participating developers was the University of California, Berkeley. Early into its Unix journey, UCB introduced a number of fundamental improvements, which were made available open source to the rest of the world as BSD (Berkeley Software Distribution) Unix.
The AT&T line is now defunct. BSD Unix lives on as FreeBSD, and the question, "What is Unix?", lives on in its original form with not-so-clear answers.
The answer
de jure is an operating system that meets two criteria:
Largely complies in its behavior with the standards mandated by POSIX, an overseer committee
Has paid the POSIX committee for Unix certification
While the first stipulation is readily agreeable, the second one is not. Linux, quite rightly as well as righteously, refused to pay the token US$1 solicited by POSIX for formal certification. I am of the humble (but well-considered) opinion that the second norm must be this and this only:
An operating system, the base (kernel and essential binaries shipped by the operating systems maker) of which is fully open source.
Note that this norm permits vendors to provide closed-source drivers, which is what happens, for instance, with nVidia graphics cards and many Epson printers. If the operating system installer prepackages any such closed-source drivers, this must be transparent to the end user.
There are two principal operating systems today that are POSIX-compliant as well as open source at the base level:
Linux, which belongs to the GNU family.
FreeBSD, primarily a part of the BSD family, and secondarily of the GNU family. (The BSD family has more players: OpenBSD/NetBSD/DragonFly.)
So this is what Unix is per the definition this book considers relevant for the day: GNU/Linux and BSD/FreeBSD. Any POSIX-compliant system, Apples MacOS X for instance, that is not open source in its base qualifies as Unix-like.
Once you begin to agree with the proposed definition of Unix, you can readily appreciate why this book has been given its pithy title: Beginning Modern Unix. I do hope the book does justice to its title.
If you have any comments or suggestions for the books improvement, feel free to email me. I have an email address that no one else has.
Manish Jain
bourne.identity@hotmail.com
Table of Contents
Part 1: Preparing for Part I
Part 2: Preparing for Part II
Part 3: Preparing for Part III
Appendix: The Last Frontier
A.1 Solution to the Difficult Step in Chapter 1
A.2 Sources for the Shell Script tcase from Chapter 3
A.3 Sources for the Shell Script extract.sh from Chapter 3
A.4 Setting Up a Swap Partition Shared by FreeBSD and Linux from Chapter 5
A.5 Sources for halt.c from Chapter 8
A.6 GNUmakefile for Creating an Executable from Chapter 11
Index
About the Author and About the Technical Reviewer
About the Author
Manish Jain
studied Mechanical Engineering at the Indian Institute of Technology, Kharagpur, graduating in 1992. In 1998, he switched to computer programming of his own volition, and of his own education.
Following an intense period of learning, during which Manish acquired expertise in Unix and C/C++, he went on to work as a software programmer for some illustrious organizations: IBM, Pitney Bowes, and Cognizant. This was between 2002 and 2014.
Medical issues, some dating back to his childhood, then forced Manish to stay at home and do the other thing he loves: write. Between 2015 and 2017, he wrote for a variety of outlets on a freelance basis.
Beginning Modern Unix is Manish Jain's first book.
About the Technical Reviewer
Massimo Nardone
has more than 23 years of experience in security, web/mobile development, and cloud and IT architecture. His true IT passions are security and Android.
He has been programming and teaching others how to program with Android, Perl, PHP, Java, VB, Python, C/C++, and MySQL for more than 20 years.