<><><><><><><><><><><><><><><><><><><>!<><><><><><><><><><><><><><><><><><><><> #% ..uXu.. 1992 %# %# Underground eXperts United #% #% presents... %# %# -=*=- #% #% The European Digest Series Vol.2 Issue #3 %# %# 1992 By THE CHIEF ..uXu.. #% <><><><><><><><><><><><><><><><><><><>!<><><><><><><><><><><><><><><><><><><><> P U B L I C SPECIAL MANUAL ISSUE - SCO XENIX System V TUTORIAL CHAPTER #4 PT.2 Contents... 01.............Introduction 02.............Contents In Chapter Four (part 2) 03.............Xenix Tutorial Chapter Four (part 2) 04.............Recommended 05.............End Comments 1. INTRODUCTION --------------- Welcome to TED Vol.2 Issue #3 - The uXu File #80! This is Chapter 4 of the XENIX Tutorial series, Part 2, which concludes chapter 4, and we're only two chapters from covering the complete manual. Alongside with this series, we're covering Digital's VMS version 5, but we will NOT publish the complete manual-package, only those sections we get requests about, so if you don't request it, we will not publish it, and you can take that to the bank. Enjoy. 2. CONTENTS IN CHAPTER FOUR (part 2) ------------------------------------ CHAPTER 4 (part 2) Working With Files and Directories _________________________________________________________________________ SCO XENIX System V TUTORIAL 4.4 Printing Files 4.4.1 Using lp [covered in the previous part] 4.4.2 Using lp Options 4.4.3 Cancelling a Print Request 4.4.4 Finding Out the Status of a Print Request 4.5 Working With Files 4.5.1 Displaying File Contents 4.5.2 Deleting Files 4.5.3 Combining Files 4.5.4 Renaming Files 4.5.5 Moving Files 4.5.6 Copying Files 4.5.7 Finding Files 4.6 Processing Text Files 4.6.1 Comparing Files 4.6.2 Sorting Files 4.6.3 Searching for Patterns in a File 4.6.4 Counting Words, Lines and Characters 4.7 Using File and Directory Permissions 4.7.1 Changing File Permissions 4.7.2 Changing Directory Permissions 3. XENIX TUTORIAL CHAPTER FOUR ------------------------------ _______________________________________________________________________________ 4.4.2 USING LP OPTIONS 4.4.2 _______________________________________________________________________________ The command has several options that help you control the printed output. You can specify the number of copies you want printed by using the number option, <-n>. For example, to print two copies of [printfile], enter: P U Several different printers are often attached to a single XENIX system. B With the <-d> option, you can specify the printer on which your file is to L be printed. To print two copies of [printfile] on a printer named [laser], I enter: C Check with your system administrator for the names of the printers available on your system. _______________________________________________________________________________ 4.4.3 CANCELLING A PRINT REQUEST 4.4.3 _______________________________________________________________________________ Use the command to cancel a print request. The command takes as its argument the request ID. For example, to stop printing a file with a request ID of [laser-245], you would enter: Experiment with by using to print [printfile] and then using to cancel the print request. When you are finished, enter the following command to remove [printfile]: You can also use the command to stop whatever is currently printing on a particular printer. For example, to cancel whatever file is currently printing on the printer [laser], you would enter the following command: If you cancel a file that does not belong to you, mail reporting that the print request was canceled is automatically sent to the file's owner. _______________________________________________________________________________ 4.4.4 FINDING OUT THE STATUS OF A PRINT REQUEST 4.4.4 _______________________________________________________________________________ Use the command to check on the status of your print request. To use it, simply enter the following: The command produces output like the following: -------------------------------------------- prt1-121 cindym 450 Dec 15 09:30 laser-450 cindym 4968 Dec 15 09:46 -------------------------------------------- Note that entering with no options displays information on your files only, not those of other users. To generate a report for all users on your computer, use with the <-o> option. Nothing is displayed by the command if the print job is complete. The first column of the output shows the request ID for each of your files being printed. The second column is your login name. In the third column, the number of characters to be printed is shown, and the fourth column lists the dates and times the print requests were made. To learn the status of a particular file, use the command with the file's request ID. For example, to find out the status of a file with the request ID of [laser-256], you would enter the follwing command: The status of that file only is displayed. You can also request the status of various printers on your system by using the <-p> option or by giving the name of the particular printer you are interested in. Enter the following command to find out the status of all the printers on your system: To find out the status of a printer named [laser], you would enter the following: The request ID and status information for each file currently waiting to be printed on [laser] is displayed. _______________________________________________________________________________ 4.5 WORKING WITH FILES 4.5 _______________________________________________________________________________ File manipulation (creating, deleting, displaying, combining, renaming, moving, and copying) is one of the most important capabilities an operating system provides. The XENIX commands that perform these functions are described in the following sections. _______________________________________________________________________________ 4.5.1 DISPLAYING FILE CONTENTS 4.5.1 _______________________________________________________________________________ The command displays the contents of a file, one screenful at a time. It cannot be used to edit files. If the file contains more than one screenful of data, you see the following prompt after each screen of text is displayed: --More--(XX%) XX% represents the percentage of the file displayed. Press the RETURN key to display another line. Press the SPACEBAR to display another screen. Try the follwing command: P U B L I C This causes the contents of [/etc/rc] to display on the screen. To quit before [/etc/rc] is finished displaying, press [q] for quit. The command does not allow you to scroll backward, towards the beginning of the file. However, you can search forward for patterns with by using the slash (/) command. For example, enter the following commands to search for a line containing "process" in [/etc/rc]: You see the following message at the top of the screen: -------------------------------- ...skipping -------------------------------- If the pattern is found, it is displayed two lines below this message. If the pattern is not found, "Pattern not found" is displayed. If you are looking at a file with and decide that you want to edit the file, you can invoke the editor by pressing [v]. Of course, you must have write permission on a file before you can edit it with or any other text editor. To display the file's contents, you only need read permission. You will often use in pipes. For example, is useful when you want to list the contents of a directory in long format. Enter the following command to display a long listing of the contents of [/bin], one screenful at a time: (For more information on pipes, refer to Chapter 2 of this tutorial) The and commands, display the beginning and the end of a file, respectively. With no options, they display the first or last 10 lines. Enter the following command to display the last 10 lines of [/etc/rc]: You can specify exactly how many lines you want displayed. Enter the following command to display the first 20 lines of [/etc/rc]: Enter the following command to display the last 20 lines of [/etc/rc]: The command also displays the contents of a file. Unlike , continuously scrolls the file until you stop the scroll with CTRL-S. CTRL-Q continues scrolling. Scrolling stops automatically when the end of the file is reached. To stop scrolling before the end of the file, press INTERRUPT, which is the DEL key on most keyboards. Enter the following command to display the contents of [/etc/termcap]. Use CTRL-S and CTRL-Q to stop and start the scrolling and INTERRUPT to halt the scrolling before the end of the file is reached: _______________________________________________________________________________ 4.5.2 DELETING FILES 4.5.2 _______________________________________________________________________________ The command is used to delete files. We have used it throughout this chapter to delete various files. Use to change to your home directory and enter the following command to create three new files: Delete [tempfile3] by entering the following command: The <-i> option allows you to remove files interactively by asking you if you really want to delete each of the files specified on the command line. If you press [y] followed by a RETURN, the given file is removed. If you press [n], the file is left untouched. This option is useful when removing files from a directory that contains many files. It helps you avoid erasing files accidentally that you really want to keep. Experiment with the <-i> option by entering the following command: Note that you can place several filenames on the command line. This is true for most XENIX commands. You can also use wildcard characters. For example, instead of entering the above command, you could enter the following: (The use of wildcard characters on the XENIX command line is discussed in Chapter 2 of this tutorial.) _______________________________________________________________________________ 4.5.3 COMBINING FILES 4.5.3 _______________________________________________________________________________ In addition to displaying files, the command can be used to combine several existing files into a single new file. This is done by redirecting the output of into a new file. The greater-than sign (>) is used for redirection. If the new file does not exist, it is created automatically. (If you are not familiar with redirection, see Chapter 2 of this tutorial.) Use to move to your home directory and enter the following command to combine [/etc/motd] and [/etc/rc] into a file named [catfile]: catfile> Now display the contents of the new file [catfile] with the command: The symbol >> can be used with to append one file to the end of another file. For example, to append the contents of [/etc/motd] to [catfile], enter the following command: > catfile> The contents of [/etc/motd] should now be placed at the beginning and at the end of [catfile]. Verify this with the following and commands: _______________________________________________________________________________ 4.5.4 RENAMING FILES 4.5.4 _______________________________________________________________________________ The command is used to move files around the XENIX filesystem and also to rename files. Use to move to your home directory. Rename [catfile], created in section 4.5.3, to [catfile2], by entering the following command: After this move is completed, [catfile] no longer exists. The file [catfile2] exists in its place. Verify this by entering the following command: _______________________________________________________________________________ 4.5.5 MOVING FILES 4.5.5 _______________________________________________________________________________ To move a file into another directory, give the name of the destination directory as the final name on the command. You do not need to specify the destination filename. For example, enter the following command to move [catfile2], created in section 4.5.4, to the [/tmp] directory: To be sure that [catfile2] is in [/tmp] and not in the current directory, enter the following command: (Remember that you can enter more than one argument on most XENIX command lines, and that the dot (.) stands for the current directory.) Finally, move [catfile2] back to the current directory by entering the following command: The command always checks to see if the last argument is the name of a directory. If it is, all files designated by filename arguments are moved into that directory. However, if you do not have write permission on the directory to which you are attempting to move files, the move fails. _______________________________________________________________________________ 4.5.6 COPYING FILES 4.5.6 _______________________________________________________________________________ The command is used to copy files. There are two forms of the command, one in which files are copied into a directory and another in which a file is copied to another file. Use to change to your home directory. Then enter the following command to copy the contents of [catfile2], created in section 4.5.4, to [catfile3]: You now have two files with identical contents. To copy [catfile2] and [catfile3] to the [/tmp] directory, enter the following command: This last command can be simplified by using a wildcard character: Like the command, always checks to see if the last argument is the name of a directory, and, if so, all files designated by filename arguments are copied into that directory. However, unlike the command, leaves the original file untouched. There should now be two copies of [catfile2] and [catfile3] on the system, one copy of each in the current directory and one copy of each in [/tmp]. _______________________________________________________________________________ 4.5.7 FINDING FILES 4.5.7 _______________________________________________________________________________ A XENIX filesystem can contain thousands of files. Because of this, files can often get lost. The command is used to search the file- system for files. The command has the form: The pathname is the pathname of the directory that you want to search. The search is recursive; it starts at the directory named and searches downward through all files and subdirectories under the named directory. The <-name> option indicates that you are searching for files that have a specific filename. The <-print> option indicates that you want to print that pathnames of all the files that match [filename] on your screen. Enter the following command to search all directories and subdirectories for [catfile2], the file created in section 4.5.4: It may take a few minutes for this command to finish executing. The output of this command should indicate that there are at least two occurrences of [catfile2], one in [/tmp] and one in your home directory. Remove [catfile2] and [catfile3] from [/tmp] and from your home directory by entering the following command: _______________________________________________________________________________ 4.6 PROCESSING TEXT FILES 4.6 _______________________________________________________________________________ XENIX includes a set of utilities that let you process information in text files. These utilities enable you to compare the contents of two files, sort files, search for patterns in files, and count the characters, words, and lines in files. These utilities are described below. _______________________________________________________________________________ 4.6.1 COMPARING FILES 4.6.1 _______________________________________________________________________________ The command allows you to compare the contents of two files and to print out those lines that differ between the files. To experiment with , use to create two files to compare. The files will me [men] and [women]. First to your home directory. Then enter the following command at the XENIX prompt: When you are placed in , press the [i] key to enter Insert Mode, and then type the following lines: Now is the time for all good men to Come to the aid of their party. Press ESC to return to Command mode and save [men] by entering [:w]. While still in Command mode, enter the following command to create [women]: <:n women> You see the following message: --------------------------------- "women" No such file or directory --------------------------------- You are then placed in [women]. Press [i] to enter Insert mode and then enter the following lines: Now is the time for all good women to Come to the aid of their party. Press ESC to return to Command mode, then [:x] to save [women] and leave . You have now created [men] and [women]. Enter the following command to compare the the contents of these two files: This command should produce the following output: ------------------------------------- 1c1 Now is the time for all good women to -------------------------------------- The lines displayed are the lines that differ from one another in the two files. P U B L I C _______________________________________________________________________________ 4.6.2 SORTING FILES 4.6.2 _______________________________________________________________________________ One of the most useful file processing commands is . When used without options, alphabetizes lines in a file, starting with the leftmost character of each line. These sorted lines are then output to the screen, or to a file if redirection is used on the command line. This command does not affect the contents of the actual file. Enter the following command to display an alphabetized list of all users who have system accounts: The command is useful in pipes. Enter the following command to display an alphabetized list of users who are currently using the system: _______________________________________________________________________________ 4.6.3 SEARCHING FOR PATTERNS IN A FILE 4.6.3 _______________________________________________________________________________ The command selects and extracts lines from a file, printing only those lines that match a given pattern. Enter the following command to print out the lines in [/etc/passwd] that contain your login information. There will probably be only one such line: Be sure to replace [login] in this command with your login name. Your output should be similar to the following: ----------------------------------------------------------------- markt:0V/wE/utnUkpc:6005:104:Mark Taub, Docland:/u/markt:/bin/csh ----------------------------------------------------------------- Note that whenever wildcard characters are used to specify a search pattern, the pattern should be enclosed in single quotation marks ('). Note also that the search pattern is case sensitive. Searching for "joe" will not yield lines containing "Joe". As another example, assume that you have a file named [phonelist] that contains a name followed by a phone number on each line. Assume also that there are several thousand lines in this list. You can use to find the phone number of someone named Joe, whose phone number prefix is 822, by entering the following command: joes.number> The utility first finds all occurrences of lines containing the word "Joe" in the file [phonelist]. The output from this command is then filtered through another command, which searches for an "822-" prefix, thus removing any unwanted "Joes." Finally, assuming that a unique phone number for Joe exists with the "822-" prefix, that name and number are placed in a the file [joes.number]. Two other pattern searching utilities are available with XENIX. These are and . Refer to in the XENIX User's Reference for more information on these utilities. _______________________________________________________________________________ 4.6.4 COUNTING WORDS, LINES, AND CHARACTERS 4.6.4 _______________________________________________________________________________ The utility is used to count words in a file. Words are presumed to be separated by punctuation, spaces, tabs, or newlines. In addition to counting words, counts characters and lines. Use to change to your home directory. Then enter the following command to count the lines, words, and characters in the file [men], created in section 4.6.1: The output from this command should be the following: ------------------------- 2 16 68 men ------------------------- The first number is the number of lines in [men], the second number is the number of words and the third number is the number of characters. Remove [men] and [women] by entering the following command: To specify a count of characters, words, or lines only, you must use the <-c>, <-w>, or <-l> option, respectively. For example, enter the following command to count the number of users currently logged onto the system: The command reports on who is using the system, one user per line. The command counts the number of lines reported by the command. This is the number of users currently on the system. _______________________________________________________________________________ 4.7 USING FILE AND DIRECTORY PERMISSIONS 4.7 _______________________________________________________________________________ The XENIX system allows the owner of a file or directory to restrict access to that file or directory. This is done with permission settings. Permissions on a file limit who can read, write and/or execute the files. Permissions on a directory limit who can to the directory, list the contents of the directory, and create and delete files in the directory. To determine the permissions associated with a given file or directory, use the command. Use to change to your home directory and then enter to get a long listing of the files in this directory. Permissions are indicated by the first 10 characters of the output of the command. The first character indicates the type of file and must be one of the following: - Indicates an ordinary file. b Indicates a block special device such as a hard or floppy disk. Hard and floppy disks can be treated as both block and character special devices. P c Indicates a character special device such as U a lineprinter or terminal. B L d Indicates a directory. I C m Indicates a shared data file. n Indicates a name special file. p Indicates a named pipe. s Indicates a semaphore. From left to right, the next nine characters are interpreted as three sets of three permissions. Each set of three indicates the following permissions: * Owner permissions, * Group permissions, and * All other user permissions. Within each set, the three characters indicate permission to read, to write, and to execute the file as a command, respectively. For a directory, "execute" permission means permission to search the directory for any files or directories. Ordinary file permissions have the following meanings: r The file is readable. w The file is writable. x The file is executable. - The permission is not granted. For directories, permissions have the following meanings: r Files can be listed in the directory; the directory must also have "x" permission. w Files can be created or deleted in the directory. As with "r", the directory itself must also have "x" permission. x The directory can be searched. A directory must have "x" permission before you can move to it with the command, access a file within it, or list the files in it. Remember that a user must have "x" permission to do anything useful to the directory. The following are some typical directory permission combinations: d-------- No access at all. This is the mode that denies access to the directory to all users but the superuser. drwx----- Limits access to the owner. The owner can list the contents of this directory and the files in it (if they have appropriate permissions), to the directory, and add files to, and delete files from, the directory. This is the typical permission for the owner of a directory. drwxr-x--- In addition to allowing the owner all of the above access permissions, this setting allows group members to list the contents of this directory and files within it and to to this directory. However, group members cannot create files in, or delete files from, this directory. This is the typical permission an owner gives to others who need access to files in his or her directory. drwxr-x--x In addition to allowing the owner and the group all of the above access permissions, this setting allows users other than the owner or members of the group to to this directory. However, because the is not set for others, other users cannot list the contents of this directory with any of the commands. This mode is rarely used, but it can be useful if you want to give someone access to a specific file in a directory without revealing the presence of other files in the directory. The [/etc] directory contains files whose permissions vary. Examine the permissions of the files in this directory by entering the following command: _______________________________________________________________________________ 4.7.1 CHANGING FILE PERMISSIONS 4.7.1 _______________________________________________________________________________ The command changes the read, write, execute, and search permis- sions of a file or directory. It has the form: The instruction argument indicates which permissions you want to change for which class of users. There are three classes of users, and three levels of permissions. The users are specified as follows: u User, the owner of the file or directory. g Group, the group the owner of the file belongs to. o Other, all users of the system who are not in u or g. a All users of the system. The permissions are specified as follows: r Read, which allows permitted users to look at but not change or delete the file. w Write, which allows permitted users to change or even delete the file. x Execute, which allows permitted users to execute the file as a command. Use to move to your home directory. Then enter the following command to create [tempfile]: The permissions on [tempfile] are probably: -rw-r--r-- Verify this by entering the following command: Enter the following command to give yourself (the file's owner) execute permissions on [tempfile]: Verify the premissions change with the command. (Of course, since [tempfile] is neither a binary nor a script, having execute permission on it is meaningless.) Enter the following command to give the group and other users write permission on [tempfile]: Verify the permissions change with the command. The command also allows you to remove permissions. For example, enter the following command to prohibit others from writing to [tempfile]: Remove [tempfile] with the following command: _______________________________________________________________________________ 4.7.2 CHANGING DIRECTORY PERMISSIONS 4.7.2 _______________________________________________________________________________ Directories also have an execute permission, even though they cannot be executed in the same way that a script or binary file can. For directories, the execute attribute is needed in order to do any useful work in a directory. Users who do not have execute permission for a directory cannot to the directory, list the names of files in the directory, or copy files to or from the directory. The permissions on your home directory are probably set to the following: drwxr-xr-x Verify this by entering the following command: You probably see output like the following: -------------------------------------------------------- drwxr-xr-x 4 markt pub 240 Feb 10 09:09 /u/markt -------------------------------------------------------- This setting allows you, the directory's owner, to to the directory, to list the contents of the directory and of the files within it (if the file permissions also allow), and to create and delete files in the directory. This setting also allows members of the group and other users to to the directory, to list the directory's contents and also the contents of files within the directory, if file permissions allow. To deny any useful access to others, enter the following command: Verify that the permissions were changed with the following command: Your output should look like the following: -------------------------------------------------------- drwxr-xr-- 4 markt pub 240 Feb 10 09:09 /u/markt -------------------------------------------------------- Now, only you and the members of the group have access to your directory. If you want to restore access to your home directory to other users, enter the following command: _______________________________________________________________________________ 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, some currently popular drinks; B-52 ---------- 1/3 Kahlua 1/3 Bailey's 1/3 Grand Marnier Burning B-52 ---------- (set the above on fire) Brain ---------- 1/2 Bailey's 1/2 Shnapps (in a shot-glass) Orgasm ---------- 1 1/2 oz Vodka 1 1/2 oz Triple sec Splash of Rose's Lime Juice Fill up with Soda Water, 7-Up or Sprite Screaming Orgasm ---------- Pour as much Galliano as possible in a spoon, and add to the above. Woo-Woo ---------- Ice 2 oz Vodka 1 oz Peachshnapps Fill up with Cranberry Juice 5. END COMMENTS --------------- The European Digest will NOT cover european news. We have started a new series in Swedish, with such news, which will be released on the last day every month. So, we'll stick to this format. 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 another public issue! (no kiddin'?) You can reach me on the following boards for comments, contributions, questions or whatever: Ripco ][ [###]-###-#### Condemned Reality [###]-###-#### Demon Roach Underground [###]-###-#### Solsbury Hill [###]-###-#### Anonymous [###]-###-##### The Stash [###]-###-##### Sedes Diaboli [###]-###-##### You can't reach me on the following boards anymore. Reason(s) stated below. Balanced pH [###] Down Land Of Karrus [###] Down Lunatic Labs [###] (Well, sometimes) The Chief 1992 %&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%& % % & "Congress shall make no law respecting an establishment of religion, or & % prohibitting the free excercise thereof; or abbridging the freedom of % & speech or of the press; or of the right of the people peaceably to & % assemble, and to petition the Goverment for a redress of grievances." % & & % This work is released according to the above Constitutional rights % & for INFORMATIONAL PURPOSES ONLY. & % % &%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&% ____________________________________________________________________________ ____________________________________________________________________________