<><><><><><><><><><><><><><><><><><><>!<><><><><><><><><><><><><><><><><><><><> #% ..uXu.. 1992 %# %# Underground eXperts United #% #% presents... %# %# -=*=- #% #% The European Digest Series Vol.2 Issue #1 %# %# 1992 By THE CHIEF ..uXu.. #% <><><><><><><><><><><><><><><><><><><>!<><><><><><><><><><><><><><><><><><><><> SPECIAL MANUAL ISSUE - SCO XENIX System V TUTORIAL CHAPTER #4 PT.1 Contents... 01.............Introduction 02.............Contents In Chapter Four (part 1) 03.............Xenix Tutorial Chapter Four (part 1) 04.............Recommended 05.............End Comments 1. INTRODUCTION --------------- Welcome to TED Vol.2 Issue #1 - The uXu File #69! Well, I know it has been some time since the last TED, but what can you do when your life crashes in on you like a car through the front porch? Ok, we're back, and we're mean. No, seriously, this is Chapter 4 of the XENIX Tutorial series, but only Part 1 (of 2) because of the length of this special chapter. The second part will be released in Release #7, and you can take that to the bank. Enjoy. 2. CONTENTS IN CHAPTER FOUR (part 1) ------------------------------------ CHAPTER 4 (part 1) Working With Files and Directories _________________________________________________________________________ SCO XENIX System V TUTORIAL 4.1 Introduction 4.2 Working With Directories 4.2.1 Printing the Name of Your Working Directory 4.2.2 Listing Directory Contents 4.2.3 Changing Your Working Directory 4.2.4 Creating Directories 4.2.5 Removing Directories 4.2.6 Renaming Directories 4.2.7 Copying Directories 4.3 Editing Files with vi 4.3.1 Entering Text 4.3.2 Moving the Cursor 4.3.3 Deleting Text 4.3.4 Inserting Text 4.3.5 Leaving vi 4.4 Printing Files 4.4.1 Using lp 3. XENIX TUTORIAL CHAPTER FOUR ------------------------------ _______________________________________________________________________________ 4.1 INTRODUCTION 4.1 _______________________________________________________________________________ This chapter explains how to perform the following tasks on a XENIX system: * Print the name of the current directory, * List directory contents, * Change to another directory, * Create, remove, rename and copy directories, * Use the full-screen text editor to create files, * Print files, * Display the contents of files, * Delete, combine, rename, move, copy and search for files, * Compare and sort files, * Search for patterns in a file, * Count words, lines and characters in a file, * Use file and directory permissions. This chapter is designed as a tutorial. The best way to use this chapter is to read it at your terminal, entering commands as instructed in the examples. None of the commands described in this chapter is described in great detail. For a complete explanation of each command, refer to the XENIX User's Reference. _______________________________________________________________________________ 4.2 WORKING WITH DIRECTORIES 4.2 _______________________________________________________________________________ Because of the hierarchical structure of the XENIX filesystem, any XENIX system has many directories and subdirectories. XENIX includes several commands that simplify working in directories. These commands are described in the following sections. _______________________________________________________________________________ 4.2.1 PRINTING THE NAME OF YOUR WORKING DIRECTORY 4.2.1 _______________________________________________________________________________ The directory you are "in" at any given time is your "working" directory. All commands are executed relative to the working directory. The name of this directory is given by the command, which stands for "print working directory." To find out what your current working directory is, enter the following command: When you first log in to the system, you are placed in your home directory. _______________________________________________________________________________ 4.2.2 LISTING DIRECTORY CONTENTS 4.2.2 _______________________________________________________________________________ Several related commands are used to list the contents of directories: This command is a variation of the command. The command alphabetizes and displays directory contents. The command alphabetizes directory contents and displays them them in columnar format. This command does the same as , and it also marks directories with a slash (/) and executable files (computer programs) with an asterisk (*). Enter the following command to list the contents of /usr/bin: This directory contains many of the executable files with which you work in the XENIX environment. Entering with no directory name lists the contents of the current directory. The command is also useful. It is equivalent to the command, which produces a "long" listing of a directory's contents. The output of this command looks like the following listing: ------------------------------------------------------------- total 338 -rw-rw-r-- 1 markt pub 4448 Mar 1 09:16 1.intro.00 -rw-rw-r-- 1 markt pub 4457 Mar 1 09:29 1.intro.s -rw-rw-r-- 1 markt pub 33836 Mar 1 09:30 2.concepts.00 -rw-rw-r-- 1 markt pub 35096 Mar 1 12:49 2.concepts.s -rw-rw-r-- 1 markt pub 52197 Mar 1 15:09 3.basic.s -rw-rw-rw- 1 markt pub 39835 Feb 16 11:02 4.advan.s ------------------------------------------------------------- Reading from left to right, the information given for each file or directory by the command includes: * Permissions * Number of links * Owner * Group * Size in bytes * Time of last modification * Filename The figure at the top lists the total number of "blocks" used on the disk to store these files. A single block is 512 bytes. 338 blocks, or 173056 bytes, are needed to store the files listed above. _______________________________________________________________________________ 4.2.3 CHANGING YOUR CURRENT DIRECTORY 4.2.3 _______________________________________________________________________________ Your working directory represents your location in the filesystem. To move to a new location in the XENIX filesystem, use the command. Entering with no arguments places you in your home directory. Try it. Enter . To be sure you are now in your home directory, enter . To move to a directory other than your home directory, you must specify that directory as an argument to the command. For example, enter the following command to move to /usr/bin: Verify that you are in /usr/bin by entering . Change to the "root" directory by entering the following command: The root director is at the "top" of the filesystem. All other directories are "below" it. Enter to examine the files and directories in the root directory. Then enter to return to your home directory. (For more information on the root directory, refer to Chapter 2 of this tutorial.) Some shorthand notation is available to help you move quickly through the filesystem. To move up one directory from your current directory, enter: Enter the following command to move up two directories: If you entered this latter command from your home directory, you are probably in the root directory. Verify this by entering . _______________________________________________________________________________ 4.2.4 CREATING DIRECTORIES 4.2.4 _______________________________________________________________________________ To create a subdirectory in your working directory, use the command. Enter to move to your home directory and then enter the following command to create a subdirectory named 'tempdir': Verify that 'tempdir' exists with the command. Change to 'tempdir' with the command and verify that 'tempdir' is empty with another command. Finally, use the command to create two empty files in 'tempdir': Enter one more time to verify that 'tempfile1' and 'tempfile2' were created. You can only create subdirectories in a directory if you have write permission in that directory. If you do not have write permission and you use to create a subdirectory, you see the following message: [mkdir: cannot access 'directory_name'] In this message, 'directory_name' refers to the directory in which you attempted to create a subdirectory. Verify this by trying to create a subdirectory in the /etc directory, a directory in which you probably do not have write permission: _______________________________________________________________________________ 4.2.5 REMOVING DIRECTORIES 4.2.5 _______________________________________________________________________________ Use the command to remove a directory. This command will not work if the directory has files or subdirectories in it. Verify this by moving to your home directory with the command and then entering the following command to remove 'tempdir', the directory created in section 4.2.4: You should see the following message: [rmdir: tempdir not empty] You must remove 'tempfile1' and 'tempfile2' from 'tempdir' before deletes 'tempdir'. But don't remove these files just yet. They are used in another example later in this chapter. _______________________________________________________________________________ 4.2.6 RENAMING DIRECTORIES 4.2.6 _______________________________________________________________________________ To rename a directory, use the command. For example, to your home directory and then enter the following command to rename 'tempdir', the directory created in section 4.2.4, to 'newdir': Verify the name change by entering . Note that the files in 'newdir' are unaffected by the change. Verify this by entering the following command: _______________________________________________________________________________ 4.2.7 COPYING DIRECTORIES 4.2.7 _______________________________________________________________________________ The command copies directories. Of course, before you can copy the contents of one directory into another, you must have write permission on the second directory. To copy the /newdir directory created in section 4.2.6, and all of the files in it, to /tmp/newdir, enter the following command: In this command, "$HOME" is shorthand for the pathname of your home directory. You can use it wherever you would enter the pathname of your home directory. To verify that the files in $HOME/newdir were copied to /tmp/newdir, enter the following command: Remove /tmp/newdir by entering the following commands: The first command removes the files in /tmp/newdir, the second command removes /tmp/newdir. Verify that /tmp/newdir is removed by entering the following command: Remove $HOME/newdir by entering the following commands: _______________________________________________________________________________ 4.3 EDITING FILES WITH vi 4.3 _______________________________________________________________________________ The text editor is a full-screen editor that is included in the XENIX operating system package. The sections that follow briefly explain how to use . For a more complete discussion, see the XENIX User's Guide. _______________________________________________________________________________ 4.3.1 ENTERING TEXT 4.3.1 _______________________________________________________________________________ Change to your home directory with the command and enter the following command to create a file called 'tempfile': A message appears indicating that you are creating a new file. You are then placed in . There are two modes in : INSERT MODE and COMMAND MODE. Use Insert Mode to add text to a file. User Command Mode to edit existing text in a file. Since 'tempfile' is empty, press to enter Insert Mode. Enter the following lines of text, pressing [RETURN] after each line. If you make a mistake typing, use the [BKSP] key to erase the mistake and continue typing: This tutorial is very, very helpful. It makes learning to use the XENIX system easy. I'm glad I have this tutorial, courtesy of uXu. After you enter the last line, press the ESC key. It takes you out of Insert Mode and places you in Command Mode. _______________________________________________________________________________ 4.3.2 MOVING THE CURSOR 4.3.2 _______________________________________________________________________________ Although many cursor-movement commands are available in , only the four basic ones are discussed here: h When you are in Command mode, pressing the [h] key moves the cursor one character to the left. l When you are in Command mode, pressing the [l] key moves the cursor one character to the right. k When you are in Command mode, pressing the [k] key moves the cursor up one line. j When you are in Command mode, pressing the [j] key moves the cursor down one line. Experiment with these cursor-movement keys on the text you entered. Note that, if your keyboard has arrow keys, these usually perform in the manner of [h],[l],[k] and [j]. _______________________________________________________________________________ 4.3.3 DELETING TEXT 4.3.3 _______________________________________________________________________________ Deleting text with is very easy. Different commands allow you to delete characters, words and entire lines. To delete a single character, place the cursor on that character with the cursor-movement keys and press the [x] key. Experiment with the [x] key by deleting the comma in the first line. To delete a word, place the cursor on the first character of the word and press [d][w] (press [d], release it, and press [w]). Experiment with this by placing the cursor on the first character of 'very' in the first line and pressing [d][w]. To delete an entire line, place the cursor anywhere on that line and press [d][d] (press [d], release it, and press [d] again). Experiment with this by placing the cursor on the second line and pressing [d][d]. Your file should now contain the following text: --------------------------------------------------- This tutorial is very helpful. I'm glad I have this tutorial, courtesy of uXu. --------------------------------------------------- _______________________________________________________________________________ 4.3.4 INSERTING TEXT 4.3.4 _______________________________________________________________________________ The [i] and [o] keys can be used to insert text. We have already used the [i] key to enter text in an empty file. To enter additional text on an existing line, move the cursor to the point where you want the new text to begin, press [i] to enter Insert mode, enter the text, and press [ESC] to return to Command mode. For example, move the cursor to the "g" in "glad" in the second line, press [i], enter the word 'very', press the [SPACEBAR], and press [ESC] to return to Command mode. The second line should now be: ---------------------------------------------------- I'm very glad I have this tutorial, courtesy of uXu. ---------------------------------------------------- The [o] key can be used to insert a new line. To use it, move the cursor to the line directly above the place in the file where the new line is to be inserted and press [o]. A new line is inserted, with the cursor placed at the beginning. You are also automatically placed in Insert mode. Try this by moving the cursor to the second line of 'tempfile' and press [o]. Now enter more text. Press [ESC] when you are finished. _______________________________________________________________________________ 4.3.5 LEAVING vi 4.3.5 _______________________________________________________________________________ Most of the time, you will want to save your file before leaving . To do this, enter Command mode and type <:x>. This command saves the file you are editing and returns you to the XENIX prompt. In some cases, you will want to leave without saving your work. To do this, enter Command mode and type <:q!>. This command returns you to the XENIX prompt, without saving the changes that you made to your file. Leave 'tempfile' by pressing <:x>. Re-enter 'tempfile' by entering the following command: Insert some text using either the [i] or the [o] key, press [ESC] and then enter to quit without saving your changes. Display 'tempfile' by entering the following command: You will notice that the last set of changes you made do not appear. Remove 'tempfile' by entering the following command: _______________________________________________________________________________ 4.4 PRINTING FILES 4.4 _______________________________________________________________________________ To print files, use the command. This is one of a group of commands known as the "lineprinter" commands. The lineprinter commands are easy to use and very flexible. With a few simple commands, you can print multiple copies of a file, cancel a print request, or ask for a special option on a particular printer. Check with your system administrator to find out what lineprinters and printer options are available on your system. _______________________________________________________________________________ 4.4.1 USING lp 4.4.1 _______________________________________________________________________________ Use to change to your home directory and enter the following command to create a file with which you can experiment: This command places a copy of /etc/motd in your home directory, naming it 'printfile'. The file /etc/motd is the "message of the day file." Its contents are displayed every time you log in to the XENIX system. A directory must be "publicly executable" before you can use to print any of the files in that directory. This means that other users must have execute permissions on the directory. Enter the following command to make your home directory publicly executable: (See "Using File and Directory Permissions" later in this chapter for more information on .) Enter the following command to print 'printfile': This command causes one copy of 'printfile' to print on the default printer on your system. A banner page might be printed along with the file. Note that you can print several files at once by putting more than one name on the command line. When you print with , a "request ID" is displayed on your screen. A request ID might look like the following: pr4-532 The first part (pr4) is the name of the printer on which your file is printed. The second part (532) identifies your job number. Should you later wish to cancel your print request or check its status, you will need to remember your request ID. (Cancelling and checking on print requests are discussed below.) You can also use with pipes. For example, enter the following command to sort and then print a copy of /etc/passwd, the file that contains system account information: (For more information on , see "Sorting Files" later in this chapter.) _______________________________________________________________________________ 4. RECOMMENDED -------------- This section is included in every issue of The European Digest and will contain recommended stuff/boards/reading and so on. For this file, currently active newsletters (+ those we want back): 1. PHRACK - Top rated, with Issue 37 as the latest one, and the best since the early days of Phrack. Dispater as the editor doing a fantastic job. 2. CUD - Currently out with Vol.4 Issue 17 still rules the computer underground news-scene, with hot topics and good discussions, although they seem to cover stories more briefly and with shorter 'life-length' and few follow- ups than before. 3. NIA - Yes, Network Information Access is still alive, though not very active. I recently got Issue 73 which had a couple of interesting sections. Hope you guys keep publishing this one more often though. These are the ones we wish still were active: 1. TSR - The Syndicate Report.. Yes, what a great publication it was. Always covering the top-stories, from far away and near, from others reporting the news to The Sensei, and from The Sensei himself. We miss it. 2. ATI - Activist Times Inc. Though file 57 was published 'quite' recently, there's no indication for a 58. It was great because of it's amazingly different contents. I'd call it 'the anarchy magazine' if speaking of the layout and contents. 3. LOD/H TJ - The Technical Journals of LOD/H were something special. Not far from Phrack and yet more .. technical, as the name tells you. It's so sad there were only a few issues. 5. END COMMENTS --------------- Okay, let's hope Dispater gets the 38th Phrack out with some international news-reports as well as the American ones. If you, Dispater, read this, please contact me on one of the boards mentioned below. I have some extras for you which you wouldn't want to miss. I hope TED will be out more often after this "re-birth", but I can't give you any promises. If everything goes wrong, TED will cover the European Hack/Phreak/Telecom news (in english) instead of what is mentioned below. The European Digest will not feature Hacking techniques, Phreaking, Carding, information about government systems or the basic underground rap. It will be different. It IS different. Manuals, The Underground Scene, Deep Deep whatever, and so on. Less 'general rag stuff' and More Miscellaneous stuff. Swedish Hacker News will be presented through the 'uXu - Swedish News' series, but ONLY in Swedish. English translations will however be published in future issues of the well-known underground rag, Phrack Inc. Check out the Next TED for something special! You can reach me on the following boards for comments, contributions, questions or whatever: Ripco ][ [312-528-5020] Condemned Reality [618-397-7702] Demon Roach Underground [806-794-4362] Solsbury Hill [301-428-3268] The Stash [+46-13-175042] Sedes Diaboli [+46-586-43766] You can't reach me on the following boards anymore. Reason(s) stated below. Balanced pH [818] Down Land Of Karrus [215] Down Lunatic Labs [213] Always Busy The Chief 1992 %&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%& % % & "Congress shall make no law respecting an establishment of religion, or & % prohibiting the free exercise thereof; or abridging the freedom of % & speech or of the press; or of the right of the people peaceably to & % assemble, and to petition the Government for a redress of grievances." % & & % This work is released according to the above Constitutional rights % & for INFORMATIONAL PURPOSES ONLY. & % % &%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&% ____________________________________________________________________________ ____________________________________________________________________________