Learning Unix for OS X, Second Edition

Total Page:16

File Type:pdf, Size:1020Kb

Learning Unix for OS X, Second Edition 2nd Edition Covers El Capitan Learning Unix for OS X GOING DEEP WITH THE TERMINAL AND SHELL Dave Taylor SECOND EDITION Learning Unix for OS X Dave Taylor Boston Learning Unix for OS X by Dave Taylor Copyright © 2016 Dave Taylor. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://safaribooksonline.com). For more information, contact our corporate/ institutional sales department: 800-998-9938 or [email protected]. Editor: Rachel Roumeliotis Indexer: Judy McConville Production Editor: Nicole Shelby Interior Designer: David Futato Copyeditor: Sonia Saruba Cover Designer: Randy Comer Proofreader: Rachel Head Illustrator: Rebecca Demarest January 2016: Second Edition September 2012: First Edition Revision History for the Second Edition 2016-01-19: First Release See http://oreilly.com/catalog/errata.csp?isbn=9781491939987 for release details. The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. Learning Unix for OS X, the cover image, and related trade dress are trademarks of O’Reilly Media, Inc. While the publisher and the author have used good faith efforts to ensure that the information and instructions contained in this work are accurate, the publisher and the author disclaim all responsibility for errors or omissions, including without limitation responsibility for damages resulting from the use of or reliance on this work. Use of the information and instructions contained in this work is at your own risk. If any code samples or other technology this work contains or describes is subject to open source licenses or the intellectual property rights of others, it is your responsibility to ensure that your use thereof complies with such licenses and/or rights. 978-1-491-93998-7 [LSI] Table of Contents Preface. ix 1. Why Use Unix?. 1 The Power of Unix 1 Batch Renames and Extracting File Lists 4 Finding Hidden Files 5 Folders or Directories? 6 Thousands of Free Applications 7 Power Internet Connections 7 Commands Included with Unix 9 Displaying All Unix Commands 9 The 10 Most Common Unix Commands 9 A Simple Guided (Unix) Tour 10 2. Using the Terminal. 13 Launching the Terminal 13 Syntax of a Unix Command 14 Exercise: Entering a Few Commands 16 Types of Commands 17 Changing the Terminal’s Preferences 18 Features of the Terminal 21 Customizing Your Terminal Session 23 Setting the Terminal’s Title 23 Using AppleScript to Manipulate the Terminal 24 Working with .terminal Files 24 Working with the Terminal 25 The Shell Prompt 27 Entering a Command 27 iii Recalling Previous Commands 28 Completing File and Directory Names 29 Running Multiple Commands on the Command Line 29 Correcting a Command 30 Ending Your Session 31 Problem Checklist 31 Customizing the Shell Environment 32 Picking a Login Shell 32 Changing the Command Prompt 33 Advanced Shell Customization 35 Shell Configuration Settings 35 Creating Aliases 38 The Unresponsive Terminal 39 3. Exploring the Filesystem. 41 The OS X Filesystem 41 Your Home Directory 42 Your Working Directory 42 The Directory Tree 43 Absolute Pathnames 44 Relative Pathnames 45 Changing Your Working Directory 47 Files in the Directory Tree 49 Listing Files and Directories 51 The All-Powerful ls Command 51 Trying Out the ls Command 52 Using the -l Option 55 File Permissions 57 Calculating File Size and Disk Space 59 Calculating Available Disk Space 62 Exercise: Exploring the Filesystem 63 Protecting and Sharing Files 64 File Access Permissions 66 Setting Permissions with chmod 67 Changing the Group and Owner 70 Changing Your Password 71 Superuser Privileges with sudo 72 Exploring External Volumes 73 4. File Management. 75 File and Directory Names 75 File and Directory Wildcards 78 iv | Table of Contents Looking Inside Files 80 cat 80 less 81 grep 83 Creating and Editing Files 85 Text Editors and Word Processors 85 The vi Text Editor 87 vi Basics 89 A Simpler vi Alternative: Pico 95 The More Complex Option: Emacs 95 Managing Files 96 Creating Directories with mkdir 97 Copying Files 98 Renaming and Moving Files with mv 100 Removing Files and Directories 101 Working with Links 103 Compressing and Archiving Files 105 Files on Other Operating Systems 107 5. Finding Files and Information. 109 Searching Inside Files with the grep Command 109 Useful grep Options 110 Working with Regular Expressions 112 Finding Files with locate 116 Fast Filename Search with locate 116 Using find to Explore Your Filesystem 117 Matching by File Size 118 Exploring find Permission Strings 121 Using find to Identify Recently Changed Files 122 find’s Faithful Sidekick: xargs 124 Further Refinements to find 126 Shining a Light on Spotlight 126 Listing Spotlight Metadata with mdls 127 Finding Files with mdfind 131 Making Spotlight Useful 132 6. Redirecting I/O. 135 Standard Input and Standard Output 135 Putting Text in a File 137 Pipes and Filters 141 wc 142 tr 143 Table of Contents | v grep 144 head and tail 145 sort 145 uniq 147 Piping Output to a Pager 148 Printing 149 The Unix Way 149 7. Multitasking. 153 Running a Command in the Background 154 Checking on a Process 155 ps 155 top 158 Canceling a Process 160 kill 161 killall 162 Launching GUI Applications 163 open 163 Useful Starting Options for Use with open 165 Making open More Useful 166 8. Taking Unix Online. 169 Remote Logins 169 Web Access 172 Remote Access to Other Unix Systems 173 Transferring Files 176 scp and rcp 176 FTP 177 Easy Shortcuts with New Remote Connection 183 9. Of Windows and X11. 187 X11 188 Using X11 189 Differences Between OS X and X11 192 Customizing X11 193 GIMP, the X11 Graphics Editor 195 10. Where to Go from Here. 197 Documentation 197 The man Command 197 Documentation on the Internet 200 Books 202 vi | Table of Contents Customizing Your Unix Experience 202 Shell Aliases and Functions 202 Programming 203 Perl, Python, and Ruby 205 C and C++ 205 Index. 207 Table of Contents | vii Preface Fifteen years ago, when Apple jumped from Mac OS 9 to Mac OS X (pronounce that “oh-ess ten” to sound cool), the entire experience of using a Mac system changed dra‐ matically. Heck, many of you reading this have never known a non–OS X Mac inter‐ face! There were a lot of interface changes, but the biggest update when Apple switched operating systems was that every machine gained multitasking and multi‐ user capabilities. Beneath the shiny graphical interface of OS X lies an operating system called Unix (pronounced “you-nicks”): specifically, UC Berkeley’s BSD Unix and the Mach ker‐ nel, a multiuser, multitasking operating system. Being multiuser means OS X allows multiple users to share the same system, each with their own settings, preferences, and separate areas in the filesystem, secured from other users’ prying eyes. Being multitasking means OS X can easily run many different applications at the same time, and if one of those applications crashes or hangs, the entire system doesn’t need to be rebooted. Instead, you just force quit the application that’s causing the “Spinning Beach Ball of Death” (you know, when the mouse pointer turns into a spinning color wheel that just won’t stop rotating) and either relaunch it or proceed with your work in other apps. Other than the aforementioned advantages, the fact that OS X has Unix under the hood doesn’t matter to users who simply want to use its slick graphical interface to run their applications or manage their files. But it opens up a world of possibilities for users who want to dig a little deeper. The Unix command-line interface, which is accessible through the Terminal application (you can find this app in /Applications/ Utilities), provides an enormous amount of power for intermediate and advanced users. What’s more, once you’ve learned to use Unix in OS X, you’ll also be able to use the command line in other versions of Unix, such as FreeBSD (from which OS X derives its Unix core) or even the hugely popular Linux. This book is designed to teach Mac users the basics of Unix. You’ll learn how to use the command line (which Unix users refer to as the shell) and the filesystem, as well ix as some of Unix’s most useful commands. I’ll also give you a tour of some useful Unix commands that Apple’s team has written and are included with every Mac system— utilities that let you really gain control over your system. Unix is a complex and powerful system, so I can only scratch the surface, but I’ll also tell you how to deepen your Unix knowledge once you’re ready for more. Who This Book Is For This book is for savvy Mac users who are comfortable in their current world (the Finder and other GUI applications) but also want to learn more about the “Power of Unix.” Here, you’ll learn all the basic commands you need to get started with Unix. Rather than weighing you down with lots of details, however, I want to help you get comfortable in the Unix environment as soon as possible. So, I cover each command’s most useful features instead of describing all its options in detail. And let me tell you, Unix has thousands of commands with millions of options. It’s very powerful! Fortu‐ nately, though, it’s just as powerful and helpful even if you just focus on a subset of commands and gradually learn more as you need additional power and capabilities.
Recommended publications
  • Connecting to Cat5 Via X2go from Macos Before Connecting to Cat5 the First Time, Please Follow the “First Time Only” Steps Below
    Brought to you by DES Computing Services Questions? [email protected] Connecting to Cat5 via X2Go from macOS Before connecting to Cat5 the first time, please follow the “First Time Only” steps below. Connecting to Cat5 1. From the Applications menu in Finder, run the “x2goclient” application. 2. Click on the white box on the right that says “cat5.” 3. Enter your Cat5 password as prompted and click OK. 4. The first time you connect, it will ask if you trust the host key. To verify the secure connection, check that the provided “hash” exactly matches one of these lines: • 5e:c1:1a:7a:3d:07:72:64:d3:fc:fe:0a:cc:c5:0f:c8:d1:92:aa:0a • 55:87:cd:ef:80:dc:9d:e8:1d:14:87:27:40:00:01:4a If it matches one of those, then click “Yes” to connect. If it doesn't match either of them, then please check Cat5 Host Key Fingerprints on the DES website for more possible hash values. Do not accept an unverified host key! Disconnecting from Cat5 1. To properly close your session, click on the “System” menu (within the Cat5 desktop) and then click “Log out <name>...” 2. If you just close the window, it will pause your session. You should be able to reconnect later to resume where you left off, but sometimes this might not work. To be safe, follow step 1. First Time Only Steps Install XQuartz You must have the “XQuartz” X-Window system installed before you install X2Go. You may have already installed it for another class.
    [Show full text]
  • Oracle Solaris: the Carrier-Grade Operating System Technical Brief
    An Oracle White Paper February 2011 Oracle Solaris: The Carrier-Grade Operating System Oracle White Paper—Oracle Solaris: The Carrier-Grade OS Executive Summary.............................................................................1 ® Powering Communication—The Oracle Solaris Ecosystem..............3 Integrated and Optimized Stack ......................................................5 End-to-End Security ........................................................................5 Unparalleled Performance and Scalability.......................................6 Increased Reliability ........................................................................7 Unmatched Flexibility ......................................................................7 SCOPE Alliance ..............................................................................7 Security................................................................................................8 Security Hardening and Monitoring .................................................8 Process and User Rights Management...........................................9 Network Security and Encrypted Communications .......................10 Virtualization ......................................................................................13 Oracle VM Server for SPARC .......................................................13 Oracle Solaris Zones .....................................................................14 Virtualized Networking...................................................................15
    [Show full text]
  • The Keys to Using SSH
    The Keys to Using SSH David Tomaschik RHCE, LPIC-1 System Administrator, Kennesaw State University MSCS Student, SPSU [email protected] http://systemoverlord.com Special ALE Central Edition! What is SSH? ● SSH = Secure Shell ● Originally intended as “Encrypted Telnet” ● Allows remote shell (command-line) access ● Connection Encrypted Using Public Key Cryptography ● SSH Version 1: Developed 1995, Now Insecure ● SSH Version 2: Standardized 2006 ● Only use SSH2! Why use SSH? ● Useful for remote system administration ● Transfer files securely ● Run remote applications ● Secure OTHER communications ● Requires Little Bandwidth ● Industry Standard SSH Clients ● Linux: OpenSSH; Usually Installed by Default ● OS X: OpenSSH; Installed by Default ● Windows: PuTTY, OpenSSH under Cygwin, Commercial SSH ● Android: ConnectBot + Others ● IOS: iSSH, Prompt, Others About the Presentation ● Assumes OpenSSH on Linux for both Client and Server ● Some features may require relatively recent versions of OpenSSH Basic Use ● ssh [email protected] Basic Use ● ssh [email protected] Verifying Who You're Connecting To ● The highlighted lines show you which host you are connecting to along with the key fingerprint. ● The key fingerprint is cryptographic proof that your connection is not being tampered with. ● Depending on your level of paranoia: ● Get the fingerprint from the system administrator ● Make your first connection from a 'trusted' network ● Just ignore it and hope its ok What You Can Do Now ● Run Commands Remotely ● Install packages/services ● Configure
    [Show full text]
  • Hyper-V Performance Comparison: Microsoft Windows Server 2008 SP2 and R2 with Intel Xeon Processor X5570
    TEST REPORT JULY 2009 Hyper-V performance comparison: Microsoft Windows Server 2008 SP2 and R2 with Intel Xeon processor X5570- and E5450-based servers Executive summary KEY FINDINGS Microsoft® Corporation (Microsoft) and Intel® Corporation (Intel) commissioned Principled z The Intel Xeon processor X5570-based server with Technologies® (PT) to measure Hyper-V R2 the optimum number of CSUs delivered 37.1 percent virtualization performance improvements using more vConsolidate performance when running vConsolidate on the following Microsoft operating Microsoft Windows Server 2008 Enterprise Edition systems and Intel processors: R2 than when runningTEST Microsoft REPORT Windows Server 2008 EnterpriseFEBRUARY Edition SP2. (See 2006 Figure 1.) • Microsoft Windows Server® 2008 z Microsoft Windows Server 2008 Enterprise Edition Enterprise Edition SP2 with Hyper-V on SP2 running on the Intel Xeon processor X5570- Intel® Xeon® processor E5450 based server with the optimum number of CSUs • Microsoft Windows Server 2008 Enterprise delivered 98.7 percent more vConsolidate Edition SP2 with Hyper-V on Intel Xeon performance than it did running on the Intel Xeon processor X5570 processor E5450-based server with the optimum • Microsoft Windows Server 2008 Enterprise number of CSUs. (See Figure 1.) Edition R2 with Hyper-V on Intel Xeon processor X5570 Figure 1 shows the vConsolidate results for all three configurations with the optimum number of vConsolidate work units, consolidation stack units (CSUs). The Intel Xeon processor X5570-based server with the optimum number of CSUs (eight) delivered 37.1 percent more vConsolidate performance when running Microsoft Windows Server 2008 Enterprise Edition R2 than when running Microsoft Windows Server 2008 Enterprise Edition SP2.
    [Show full text]
  • UKUI: a Lightweight Desktop Environment Based on Pluggable
    2016 International Conference on Artificial Intelligence and Computer Science (AICS 2016) ISBN: 978-1-60595-411-0 UKUI: A Lightweight Desktop Environment Based on Pluggable Framework for Linux Distribution Jie YU1, Lu SI1,*, Jun MA1, Lei LUO1, Xiao-dong LIU1, Ya-ting KUANG2, Huan PENG2, Rui LI1, Jin-zhu KONG2 and Qing-bo WU1 1College of Computer, National University of Defense Technology, Changsha, China 2Tianjin KYLIN Information Technology Co., Ltd, Tianjin, China *[email protected] *Corresponding author Keywords: Desktop environment, Ubuntu, User interface. Abstract. Ubuntu is an operating system with Linux kernel based on Debian and distributed as free and open-source software. It uses Unity as its default desktop environment, which results in more difficulties of usage for Microsoft Windows users. In this paper, we present a lightweight desktop environment named UKUI based on UbuntuKylin, the official Chinese version of Ubuntu, for Linux distribution. It is designed as a pluggable framework and provides better user experience during human-computer interaction. In order to evaluate the performance of UKUI, a set of testing bench suits were performed on a personal computer. Overall, the results showed that UKUI has better performance compared with Unity. Introduction Linux is a freely available operating system (OS) originated by Linux Torvalds and further developed by thousands of others. Typically, Linux is packaged in a form known as a Linux distribution for both desktop and server use. Some of the most popular mainstream Linux distributions are Red Hat [1], Ubuntu [2], Arch [3], openSUSY [4], Gentoo [5], etc. There are several desktop environments available for nowadays modern Linux distributions, such as XFCE [6], GNOME [7], KDE [8] and LXDE [9].
    [Show full text]
  • File Formats
    man pages section 4: File Formats Sun Microsystems, Inc. 4150 Network Circle Santa Clara, CA 95054 U.S.A. Part No: 817–3945–10 September 2004 Copyright 2004 Sun Microsystems, Inc. 4150 Network Circle, Santa Clara, CA 95054 U.S.A. All rights reserved. This product or document is protected by copyright and distributed under licenses restricting its use, copying, distribution, and decompilation. No part of this product or document may be reproduced in any form by any means without prior written authorization of Sun and its licensors, if any. Third-party software, including font technology, is copyrighted and licensed from Sun suppliers. Parts of the product may be derived from Berkeley BSD systems, licensed from the University of California. UNIX is a registered trademark in the U.S. and other countries, exclusively licensed through X/Open Company, Ltd. Sun, Sun Microsystems, the Sun logo, docs.sun.com, AnswerBook, AnswerBook2, and Solaris are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. in the U.S. and other countries. Products bearing SPARC trademarks are based upon an architecture developed by Sun Microsystems, Inc. The OPEN LOOK and Sun™ Graphical User Interface was developed by Sun Microsystems, Inc. for its users and licensees. Sun acknowledges the pioneering efforts of Xerox in researching and developing the concept of visual or graphical user interfaces for the computer industry. Sun holds a non-exclusive license from Xerox to the Xerox Graphical User Interface, which license also covers Sun’s licensees who implement OPEN LOOK GUIs and otherwise comply with Sun’s written license agreements.
    [Show full text]
  • Introduction to Unix
    Introduction to Unix Rob Funk <[email protected]> University Technology Services Workstation Support http://wks.uts.ohio-state.edu/ University Technology Services Course Objectives • basic background in Unix structure • knowledge of getting started • directory navigation and control • file maintenance and display commands • shells • Unix features • text processing University Technology Services Course Objectives Useful commands • working with files • system resources • printing • vi editor University Technology Services In the Introduction to UNIX document 3 • shell programming • Unix command summary tables • short Unix bibliography (also see web site) We will not, however, be covering these topics in the lecture. Numbers on slides indicate page number in book. University Technology Services History of Unix 7–8 1960s multics project (MIT, GE, AT&T) 1970s AT&T Bell Labs 1970s/80s UC Berkeley 1980s DOS imitated many Unix ideas Commercial Unix fragmentation GNU Project 1990s Linux now Unix is widespread and available from many sources, both free and commercial University Technology Services Unix Systems 7–8 SunOS/Solaris Sun Microsystems Digital Unix (Tru64) Digital/Compaq HP-UX Hewlett Packard Irix SGI UNICOS Cray NetBSD, FreeBSD UC Berkeley / the Net Linux Linus Torvalds / the Net University Technology Services Unix Philosophy • Multiuser / Multitasking • Toolbox approach • Flexibility / Freedom • Conciseness • Everything is a file • File system has places, processes have life • Designed by programmers for programmers University Technology Services
    [Show full text]
  • Shell Script & Advance Features of Shell Programming
    Kirti Kaushik et al, International Journal of Computer Science and Mobile Computing, Vol.4 Issue.4, April- 2015, pg. 458-462 Available Online at www.ijcsmc.com International Journal of Computer Science and Mobile Computing A Monthly Journal of Computer Science and Information Technology ISSN 2320–088X IJCSMC, Vol. 4, Issue. 4, April 2015, pg.458 – 462 RESEARCH ARTICLE Shell Script & Advance Features of Shell Programming Kirti Kaushik* Roll No.15903, CS, Department of Computer science, Dronacharya College of Engineering, Gurgaon-123506, India Email: [email protected] Jyoti Yadav Roll No. 15040, CS, Department of Applied Computer science, Dronacharya College of Engineering, Gurgaon-123506, India Email: [email protected] Kriti Bhatia Roll No. 15048, CS, Department of Applied Computer science, Dronacharya College of Engineering, Gurgaon-123506, India Email: [email protected] Abstract-- In this research paper, the idea of shell scripting and writing computer programs is examined and different parts of shell programming are likewise contemplated. A shell script is a PC system intended to be controlled by the UNIX shell which is a charge line translator. The different tongues of shell scripts are thought to be scripting dialects. Regular operations performed by shell scripts incorporate document control, program execution, and printing content. A shell script can give an advantageous variety ofa framework order where unique environment settings, charge alternatives, or post-transforming apply naturally, yet in a manner that permits the new script to still go about as a completely typical UNIX summon. The real ideas like Programming in the Borne and C-shell, in which it would be clarified that how shell programming could be possible in Borne and C-shell.
    [Show full text]
  • Chapter 1. Origins of Mac OS X
    1 Chapter 1. Origins of Mac OS X "Most ideas come from previous ideas." Alan Curtis Kay The Mac OS X operating system represents a rather successful coming together of paradigms, ideologies, and technologies that have often resisted each other in the past. A good example is the cordial relationship that exists between the command-line and graphical interfaces in Mac OS X. The system is a result of the trials and tribulations of Apple and NeXT, as well as their user and developer communities. Mac OS X exemplifies how a capable system can result from the direct or indirect efforts of corporations, academic and research communities, the Open Source and Free Software movements, and, of course, individuals. Apple has been around since 1976, and many accounts of its history have been told. If the story of Apple as a company is fascinating, so is the technical history of Apple's operating systems. In this chapter,[1] we will trace the history of Mac OS X, discussing several technologies whose confluence eventually led to the modern-day Apple operating system. [1] This book's accompanying web site (www.osxbook.com) provides a more detailed technical history of all of Apple's operating systems. 1 2 2 1 1.1. Apple's Quest for the[2] Operating System [2] Whereas the word "the" is used here to designate prominence and desirability, it is an interesting coincidence that "THE" was the name of a multiprogramming system described by Edsger W. Dijkstra in a 1968 paper. It was March 1988. The Macintosh had been around for four years.
    [Show full text]
  • Introduction to Unix (PDF)
    Introduction to… UNIX Bob Booth December 2004 AP-UNIX2 © University of Sheffield Contents 1. INTRODUCTION....................................................................................................................................... 3 1.1 THE SHELL ........................................................................................................................................... 3 1.2 FORMAT OF COMMANDS ...................................................................................................................... 4 1.3 ENTERING COMMANDS ......................................................................................................................... 4 2. ACCESSING UNIX MACHINES ............................................................................................................. 5 2.1 TERMINAL EMULATION SOFTWARE...................................................................................................... 5 2.2 LOGGING IN.......................................................................................................................................... 6 2.3 LOGGING OUT ...................................................................................................................................... 6 2.4 CHANGING YOUR PASSWORD............................................................................................................... 8 3. BASIC UNIX COMMANDS...................................................................................................................... 9 3.1 FILENAMES..........................................................................................................................................
    [Show full text]
  • UNIX Text Processing Tools—Programs for Sorting, Compar- Ing, and in Various Ways Examining the Contents of Text Files
    UNIX® TEXT PROCESSING DALE DOUGHERTY AND TIM O’REILLY and the staffofO’Reilly & Associates, Inc. CONSULTING EDITORS: Stephen G. Kochan and PatrickH.Wood HAYDEN BOOKS ADivision of HowardW.Sams & Company 4300 West 62nd Street Indianapolis, Indiana 46268 USA Copyright © 1987 Dale Dougherty and Tim O’Reilly FIRST EDITION SECOND PRINTING — 1988 INTERNET "UTP Revival" RELEASE — 2004 The UTP RevivalRelease is distributed according to the terms of the Creative Commons Attribution License. A copyofthe license is available at http://creativecommons.org/licenses/by/1.0 International Standard Book Number: 0-672-46291-5 Library of Congress Catalog Card Number: 87-60537 Trademark Acknowledgements All terms mentioned in this book that are known to be trademarks or service marks are listed below. Nei- ther the authors nor the UTP Revivalmembers can attest to the accuracyofthis information. Use of a term in this book should not be regarded as affecting the validity of anytrademark or service mark. Apple is a registered trademark and Apple LaserWriter is a trademark of Apple Computer,Inc. devps is a trademark of Pipeline Associates, Inc. Merge/286 and Merge/386 are trademarks of Locus Computing Corp. DDL is a trademark of Imagen Corp. Helvetica and Times Roman are registered trademarks of Allied Corp. IBM is a registered trademark of International Business Machines Corp. Interpress is a trademark of Xerox Corp. LaserJet is a trademark of Hewlett-Packard Corp. Linotronic is a trademark of Allied Corp. Macintosh is a trademark licensed to Apple Computer,Inc. Microsoft is a registered trademark of Microsoft Corp. MKS Toolkit is a trademark of Mortice Kern Systems, Inc.
    [Show full text]
  • Converting ASCII Files
    Converting Data from ASCII to SPSS System Files Some data files, especially older ones, will not be available as SPSS system files, but instead will be provided with a fixed-format ASCII (American Standard Code for Information Interchange) file and an SPSS syntax file. Once you have downloaded your files and, if necessary, unzipped them: • Start SPSS and open the syntax file (the one with the “.sps” extension). • Find the “FILE HANDLE” command and replace “data-filename” with the path to your data file (the one ending in “.txt”). For example, if you download ICPSR Study 4131 (ABC News Pennsylvania Poll, Sept. 2004) in a directory on your “C” drive called “Temp,” the path created will be "C:\Temp\5268001\ICPSR_04131\DS0001_ABC_News_Pennsylvania_Poll,_Sept ember_2004__\04131-0001-Data.txt." (This is admittedly pretty unwieldy, and it might be a good idea to move and rename the file before proceeding). The FILE HANDLE: FILE HANDLE DATA / NAME="data-filename" LRECL=225. would become: FILE HANDLE DATA / NAME="C:\Temp\5268001\ICPSR_04131\DS0001_ABC_News_Pennsylvania_P oll,_September_2004__\04131-0001-Data.txt " LRECL=225. • Find the “SAVE OUTFILE” command (probably the last one in the file), and replace “spss-filename.sav” with the name and path of the SPSS system file you wish to create. If the command is preceded by an asterisk, remove the asterisk. For example, SAVE OUTFILE="spss-filename.sav". would become: SAVE OUTFILE="C:\Temp\5268001\ICPSR_04131\DS0001_ABC_News_Pennsylvania _Poll,_September_2004__\04131-0001-Data.sav". From the menu bar, click on “Run” and “All.” If no "SAVE OUTFILE" command exits, create one from scratch.
    [Show full text]