<><><><><><><><><><><><><><><><><><><>!<><><><><><><><><><><><><><><><><><><><> #% ..uXu.. 1991 %# %# Underground eXperts United #% #% presents... %# %# -=*=- #% #% The European Digest Series Vol.1 Issue #5 %# %# 1991 By THE CHIEF ..uXu.. #% <><><><><><><><><><><><><><><><><><><>!<><><><><><><><><><><><><><><><><><><><> SPECIAL MANUAL ISSUE - SCO XENIX System V TUTORIAL CHAPTER #2 Contents... 01.............Introduction 02.............Contents In Chapter Two 03.............Xenix Tutorial Chapter Two 04.............Recommended 05.............End Comments 1. INTRODUCTION --------------- Welcome to TED Vol.1 Issue #5 - The uXu File #14! The second part of the SCO XENIX V Tutorial manual is ready for TED, and here it is for you. This section will cover the Basic concepts in XENIX like some usual commands, some names/directories to know, and things the beginner must know, for starters. Like before, if you're an unix/xenix guru, or just if you have some basic knowledge of unix/xenix, you can skip this chapter, and just keep it as a reference. This is, still, for the beginner. The next chapter in the Xenix Tutorial Manual will cover how to login to the system, some security tips, and more commands. 2. CONTENTS IN CHAPTER TWO -------------------------- 2.0 BASIC CONCEPTS 2.1...Introduction 2.2...Accounts 2.2.1.....User Accounts 2.2.2.....Super User Account 2.3...Files 2.3.1.....Ordinary Files 2.3.2.....Special Device Files 2.3.3.....Directory Files 2.3.4.....Directory Structure 2.4...Naming Conventions 2.4.1.....Filenames 2.4.2.....Pathnames 2.4.3.....Sample Names 2.4.4.....Special Characters 2.5...Commands 2.5.1.....Command Line 2.5.2.....Syntax 2.6...Input And Output 2.6.1.....Redirection 2.6.2.....Pipes 3. XENIX TUTORIAL CHAPTER TWO ----------------------------- 2.0 BASIC CONCEPTS 2.0 =============================================================================== 2.1 Introduction 2.1 Introduction =============================================================================== This chapter explains the basic concepts that you need to understand to work effectively in the XENIX environment. After reading this chapter, you should understand the fundamentals of user accounts, as well as how the system's files and directories are organized and named, how commands are entered, and how a command's input and output can be redirected. It is important to read this chapter before proceeding to the tutorial chapters that follow. 2.2 ACCOUNTS 2.2 =============================================================================== 2.2.1 User Accounts 2.2.1 User Accounts =============================================================================== An account must be created for you before you can log on to a XENIX system. Your account contains the following information: * Your login name. This is the name by which you are known in the system. It is the name you enter at the login prompt. * Your password. To increase system security, each user may be given a password. This password is entered when you log on to the system. * Your group identification. Each user is known to the system as an individual and as a member of a group. Group membership is important for system security reasons. As a member of a group, you may be permitted to access files and directories that you cannot access as an individual. * Your "home directory." This is the place in the filesystem where you can keep personal files. When you first log on in to the system, you are placed in your home directory. * Your "login shell." This is the program that reads and executes the XENIX commands you input. In most cases, your login shell will be the "Bourne Shell." The Bourne Shell uses the dollar sign ($) as a prompt. However, you may be configured to use the "C-Shell," which uses the percent sign (%) as a prompt, or the "Visual Shell," which is a menu- driven interface. Throughout this tutorial, the expression "XENIX prompt" is used to refer to your shell prompt, wether it is the percent sign or the dollar sign. Once an account has been established for you, you can manipulate the files, directories, and commands that make up the XENIX system. =============================================================================== 2.2.2 Super User Account 2.2.2 Super User Account =============================================================================== In addition to each user's individual account, every XENIX system has a "super user" account. (The super user is also referred to as "root.") In order to perform certain system administration tasks, the system administrator must log in as the super user. The super user has free rein over the system. The super user can read and edit any file on the system, as well as execute any program. =============================================================================== 2.3 Files 2.3 Files =============================================================================== The file is the fundamental unit of the XENIX filesystem. There are three different types of XENIX files: ordinary files (what we usually mean when we say "file"), special device files, and directories. Each of these is described in the sections that follow. =============================================================================== 2.3.1 Ordinary Files 2.3.1 Ordinary Files =============================================================================== An ordinary file is simply a collection of 8-bit bytes. Ordinary files are usually documents, program source code, or program data. Executable binary files, or computer programs, are also considered ordinary files. The bytes of an ordinary file are interpreted as text characters, binary instructions, or program statements, by the programs that examine them. Every ordinary file has the following attributes: * a filename (not necessarily unique), * a unique filesystem number called an inode number, * a size in bytes, * a time of last change, * a set of access permissions, * an owner and a group. File Protection On a multi-user system, it is often necessary to "protect" certain files, denying some users access to the files while allowing access to others. Files are protected by assigning appropriate "access permissions" to them. XENIX provides three levels of access permissions: read Having read permission on a file allows a user to view the contents of the file with such commands as and . A user with read-only permission cannot edit a file. write Having write permission on a file allows a user to edit the file. execute If the file is a program, having execute permission on the file allows a user to run the program. You cannot run a program for which you do not have execute permission. Access permissions are assigned by a file's owner. (By default, the owner of a file is its creator.) Any combination of the three levels is permitted. This allows the file's owner to determine which users can read, write and/or execute the file. Note that the super user has @readm write and execute permissions on all files on the system. The file security mechanism implemented under XENIX is very flexible. It allows separate access permissions to be set for a file's owner, a file's group, and for all other users. In a typical case the, owner of a file might have read and write permissions, the group read-only permission, and all other users no access permissions at all. =============================================================================== 2.3.2 Special Device Files 2.3.2 Special Device Files =============================================================================== Each physical device on the system, such as hard and floppy disks, line- printers, terminals, and system memory, is assigned to a "special file." These files are also called "special device files." Special device files are not discussed in this tutorial. (For more information on special device files, see the XENIX System Administrator's Guide, also published by Swedish Hackers Association.) =============================================================================== 2.3.3 Directory Files 2.3.3 Directory Files =============================================================================== Directory files are more like file drawers than files. They are places where files are stored (conceptually, not physically). Directory files are usually referred to as "directories." A directory contains the names and inode numbers of the files "within it." These inode numbers point to "inodes." XENIX uses inodes internally to organize filesystems. There is one inode per file. Inodes contain information about files. This information includes the file type, the number of links to the file, the location of the file on the disk, the size of the file, the identity of the file's owner and group, the file's access permissions, and the time the file was last modified. Like ordinary files, directories can be protected by assigning appropriate access permissions. These are read, write and execute. In order to do anything useful in a @directorym a user must have execute permission on that directory, Execute and write permissions determine whether files can be added to or removed from a directory. Execute and read permissions determine whether the contents of a directory can be listed. Access permissions are assigned to a directory by its owner. By default, the owner of a directory is its creator. =============================================================================== 2.3.4 Directory Structure 2.3.4 Directory Structure =============================================================================== With multiple users working on multiple projects, the number of files in a filesystem can proliferate rapidly, creating an organizational nightmare. The inverted "tree-structured" directory hierarchy that is a feature of the XENIX system allows users to organize large numbers of files efficiently. Related files, a directory can contain other directories, sometimes called "subdirectories." Subdirectories themselves can contain ordinary files and more subdirectories, and so on. The command is used to move from one directory to another. In this typical tree of files, the root of the tree is at the top and the branches of the tree grow downward. Directories correspond to "nodes" in the tree, while ordinary files correspond to "leaves." Figure 2-1 represent this inverted tree-structured directory hierarchy. / (root) | --------------------------------------- | | | bin usr dev | | | | -------------- | | | | | chmod gwenl markt tty1a | | -------------- ------------- | | | | mail news text data FIGURE 2-1 A Typical Filesystem In figure 2-1, the names [bin], [usr], [dev], [gwenl], and [markt] all represent directories, and are all nodes in the tree. At the top of the tree is the root directory, which is given the name slash (/). The names [mail], [news], [text], and [data] all represent ordinary files, and they are all "leaves" of the tree. The file [chmod] is the name of a command that can be executed. The name [tty1a] is a special device file. It represents a terminal and is also represented in the tree. If a directory contains a downward branch to other files or directories, those files and directories are "contained" in the given directory, All directories and files on the system are contained in the root directory. In Figure 2-1, the files [mail] and [news] are contained in the directory [gwenl], which itself is contained in the directory [usr]. The directory [usr], in turn, is contained in the root directory. It is possible to name any file in the system by starting at the root and traveling down any of the branches to the desired file. Files can also be named relative to any directory. XENIX naming conventions are discussed later in this chapter. THE USER DIRECTORY Each XENIX user is given a personal or "home" directory. This is a place where you can keep files that no other user is likely to need. Within the home directory, you may have other subdirectories that you own and control. All of the home directories on a XENIX system are often placed in the [usr] directory, as illustrated by Figure 2-2. usr | -------------------------------------------------- | | | adam eve mary | | | | ----------------- | | | | | text text temp text FIGURE 2-2 A Typical User Directory In Figure 2-2, the [usr] directory contains each user's home directory. There are three users on this system, [adam], [eve], and [mary]. =============================================================================== 2.4 Naming Conventions 2.4 Naming Conventions =============================================================================== Every single file, directory, and device in XENIX has both a filename and a pathname. Filenames and pathnames are discussed in the following two sections. =============================================================================== 2.4.1 Filenames 2.4.1 Filenames =============================================================================== A filename is a sequence of 1 to 14 characters consisting of letters, digits and other special characters such as the underbar (_). Every single file, directory, and device in the system has a filename, it is best to confine filenames to the alphanumeric characters and the period. Other characters, especially control characters, are discouraged for use in filenames. Filenames should be indicative of a file's contents. For example, a file containing purchase orders should have a name like [orders], rather than [file1]. Note that filenames must be unique only within directories and need not be unique system-wide. Different directories can contain different files that have the same name. For example, there can be several files named [text] on a single system, as long as those files are each in separate directories. When a filename contains an initial period, it is "hidden," and is not displayed by the command. System configuration files are often hidden. However the command does display hidden files. The dash (-) is used in specifying command options and should be avoided when naming files. In addition, the question mark (?), the asterisk (*), brackets ([ and ]), and all quotation marks should Never be used in filenames, because they have special meaning to the XENIX shell. (For more information on these characters, see "Special Characters" later in this chapter.) =============================================================================== 2.4.2 Pathnames 2.4.2 Pathnames =============================================================================== A pathname is a sequence of directory names followed by a simple filename, each separated from the previous name by a slash. If a pathname begins with a slash, it specifies a file that can be found by beginning a search at the root of the entire tree. Otherwise, files are found by beginning the search at the user's Current Directory (also known as the Working Directory). The command is used to print the name of the working directory on the screen. A pathname beginning with a slash is called a "full" or "absolute pathname". The absolute pathname is a map of of a file's location in the system. Absolute pathnames are unique: no two files, directories or devices have the exact same absolute pathname. A pathname Not beginning with a slash is called a "relative pathname", because it specifies a path relative to the current directory. =============================================================================== 2.4.3 Sample Names 2.4.3 Sample Names =============================================================================== Among the directory and file names commonly found on XENIX systems are: / The name of the root directory. /bin The directory containing most of the frequently used XENIX commands. /usr The directory containing each user's personal directory. The subdirectory, [/usr/bin] contains frequently used XENIX commands not in [/bin]. /dev The directory containing special device files. /dev/console The special device file associated with the system console. /dev/ttyXX The names of special device files associated with system ports. XX represents a number, such as 1A or 006. Most ports are assigned to terminals. /lib The directory containing files of "libraries" used for system development. /usr/lib The directory containing directories with XENIX applications. /tmp The directory for temporary files. /usr/joe/run A typical full pathname. It is the pathname of a file named [run] belonging to a user named [joe]. bin/script A relative pathname. It names the file [script] in subdirectory [bin] of the current working directory. If the current directory is the root directory (/), it names [/bin/script]. If the current directory is [/usr/joe], it names [/usr/joe/bin/script]. file1 Name of an ordinary file in the current directory. All files and directories, with the exception of the root directory, have a "parent" directory. This directory is located immediately above the given file or directory. The XENIX filesystem provides special shorthand notations for the parent directory and for the current directory: . The shorthand name of the current directory. For example, [./filexxx] names the same file as [filexxx], in the current directory. .. The shorthand name of the current directory's parent directory. For example, the shorthand name [../..] refers to the directory that is two levels "above" the current directory. =============================================================================== 2.4.4 Special Characters 2.4.4 Special Characters =============================================================================== XENIX provides a facility for specifying sets of filenames that match particular patterns. Suppose, for example, you are working on a large book. The different chapters of the book might be kept in separate files, whose names might be [chpt1], [chpt2], [chpt3], and so on. You might even break each chapter into separate files. For example, you might have files named [chpt1.1], [chpt1.2], [chpt1.3], and so on. If you want to print the whole book on the lineprinter, you could enter the following command: Entering so many filenames in a command quickly becomes tedious, and will probably lead to mistakes. Fortunately, there is a shortcut. A sequence of names containing a common pattern can be specified with the use of special "wildcard" characters. The wildcard characters discussed in this chapter are: * Matches zero or more characters. [] Matches any character inside the brackets. ? Matches any single character. For example, you can enter: The asterisk (*) means "zero or more characters of any type," so this command translates into "send all files whose names begin with the word [chap] to the lineprinter." This is a quick and effective way of printing all the files that make up your book. This shorthand notation is not a unique property of the command. It can be used with any command. For example, you can list the names of the files in the book by typing: The asterisk is not limited to the last position in a filename. It can be used anywhere in a filename and can occur several times. An asterisk bu itself matches all filenames not containing slashes or beginning with periods: This command displays all files in the current directory on your terminal screen. The asterisk is not the only pattern-matching feature available. Suppose you want to print only chapters 1 through 4, and 9. You can enter: The brackets ([ and ]) mean "match any of the characters inside the brackets." A Range of consecutive letters or digits can be abbreviated, so you can also do this with the following command: (Note that this does Not try to match [chap1*] through [chap49*], but rather [chap1*] through [chap4*] and [chap9*].) Letters can also be used within brackets: "[a-z]" matches any character in the range "a" through "z". The question mark (?) matches any single character: This command lists all files that have single-character names. The fol- lowing command lists information about the first file of each chapter (i.e., [chap1.1], [chap2.1], ...): If you need to turn off the special meaning of any of the wildcard characters (*, ?, and [ ... ]) enclose the entire argument in single quotation marks. For example, the following command lists only a file named "?" rather than all one-character filenames: Pattern-matching features are discussed further in "The Shell" chapter of the XENIX User's Guide. =============================================================================== 2.5 Commands 2.5 Commands =============================================================================== You have already been introduced to three useful XENIX commands, , , and . The command is used to display directory contents, the command to print files and the command to display file contents. Commands are executable programs. When you enter the name of a command, XENIX looks for a program with that name and executes the program, if it can be found. Command lines can also contain arguments that specify options or files that the program needs. The command line and command syntax are discussed in the next two sections. =============================================================================== 2.5.1 Command Line 2.5.1 Command Line =============================================================================== XENIX always reads commands from the "command line." The command line is a line of characters that is read by the shell to determine what actions to perform. (XENIX offers three shells, the Bourne Shell, the C-Shell and the Visual Shell.) The shell reads the names of commands from the command line, finds the executable program corresponding to the name of the command, then execute that program. When the program finishes executing, the shell resumes reading the command line. When you enter commands at a terminal, you are actually editing a line of text called the "command-line buffer." The command-line buffer becomes a command line only when you press RETURN. The command-line buffer can be edited with the BKSP and Ctrl-u keys. If the INTERRUPT key is pressed before RETURN, the command-line buffer is erased. (On most keyboards, DEL key is the INTERRUPT key.) Multiple commands can be entered on a single command line, provided they are separated by a semicolon (;). For example, the following command line prints out the current date and the name of the current working directory: Commands can be submitted for processing in the "background" by appending an ampersand (&) to the command line. This mode of execution is similar to "batch" processing on other systems. The main advantage of placing commands in the background is that you can execute other commands from your terminal in the "foreground" while the background commands execute. For example, the following command outputs disk usage statistics in the directory [/usr], a fairly time-consuming operation, without tying up your terminal: diskuse &> The output of this command is placed in the file [diskuse], by redirecting output with the greater-than symbol <>>. (Redirection of input and output is discussed in "Input and Output" below. Background processing is discussed in "Advanced Tasks.") =============================================================================== 2.5.2 Syntax 2.5.2 Syntax =============================================================================== The general syntax for commands is: [options][arguments][filename][...] By convention, command names are lowercase. Options are always preceded by a dash (-) and are not required. They are used to modify the command. For example, the command lists, in columnar format, the contents of a directory. The same command with the <-l> option produces a long listing of a directory's contents. In some cases, options can be grouped to form a single option argument, as in the following command: This command is really a combination of two options, where the <-rl> option selects the option that lists all files in the directory in both reverse alphabetical order and with the long format. Sometimes multiple options must be given separately, as in the following command: Here, the <-a> option tells the command to ask the user for confirmation before copying to . The <-v> option specifies "verbose", which causes to list the names if the files that are copied, as they are copied. Other arguments, such as search strings, can also be given, as in the following command: The 'string of text' in this example is a single argument, and is the string for which the command searches in the file . =============================================================================== 2.6 Input and Output 2.6 Input and Output =============================================================================== By default, XENIX assumes that input comes from the terminal keyboard and that output goes to the terminal screen. To illustrate typical command input and output, enter: This command now expects input from your keyboard. It accepts as many lines of input as you enter, until you press Ctrl-d, which is the "end-of- file" or "end-of-transmission" indicator. For example, enter: this is two lines RETURN of input RETURN Ctrl-d The command immediately outputs each line as you enter it. Since output is sent to the terminal screen by default, that is where the lines are sent. Thus, the complete session will look like this on your terminal screen: $ cat this is two lines this is two lines of input of input $ The flow of command input and output can be "redirected" so that input comes from a file instead of from the terminal keyboard and output goes to a file or lineprinter, instead of to the terminal screen. In addition, you can create "pipes" to use the output of one command as the input of another. (Redirection and pipes are discussed in the next two subsections.) =============================================================================== 2.6.1 Redirection 2.6.1 Redirection =============================================================================== In XENIX, a file can replace the terminal for either input or output. For example, the following command displays a list of files on your terminal screen: But if you enter the following command, a list of your files is placed in the file [filelist] (which is created if it does not already exist), rather than sent to the screen: filelist> The symbol for output redirection, the greater-than sign (>), means "put the output from the command into the following file, rather than display it on the terminal screen." The following command is another way of using the output redirection mechanism: temp> This command places copies of several files in the file [temp] by redirecting the output of to that file. The output append symbol (>>) works very much like the output redirection symbol, except that it means "add to the end of." The following command means "concatenate [file1], [file2], and [file3] to the end of whatever is already in [temp], instead of overwriting and destroying the existing contents." > temp> As with normal output redirection, if [temp] doesn't already exist, it is created for you. In a similar way, the input redirection symbol (<> means "take the input for a program from the following file, instead of from the terminal." As an example, you could enter the following command to send a file named [letter.txt] to several people using the XENIX facility: (See Chapter 6 of this tutorial for information on .) =============================================================================== 2.6.2 Pipes 2.6.2 Pipes =============================================================================== One of the major innovations of the XENIX system is the concept of a "pipe." A pipe is simply a way to use the output of one command as the input of another, so that the two run as a sequence of commands called a "pipeline". For example, suppose that you want to find all unique lines in [frank.txt], [george.txt], and [hank.txt] and view the result. You could enter the following sequence of commands: temp1> temp2> But this is more work than necessary. What you want is to take the out- put of and connect it to the input of , then take the output of and connect it to . You would use the following pipe: The vertical bar character (|) is used between the and commands to indicate that the output from , which would normally have been sent to the terminal, is to be used as the input of the command, which in turn sends its output to the command for viewing. The following command is another example of a pipe. The command counts the number of lines, words, and characters in its input. The command prints a list of users currently logged on, one per line. Thus, the following pipeline tells you the number of users who are logged in by counting the number of lines that come from the command: Notice the difference in output between and . By default, tells you how many lines, words, and characters there are in the input. How- ever, tells you only how many lines. Any program that accepts input from the keyboard can accept input from a pipe instead. Any program that displays output to the terminal screen can send input to a pipe. You can have as many elements in a pipeline as you wish. _____________________________________________________________________________ 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, TV series. SERIE/NAME WHY? ------------------------------------ -------------------------------------- Parker Lewis Can't Lose Real Cool. The only minus is the moral at the end of each episode (as with ALL American series). TOTAL COOLNESS! Wiseguy Tough Drama/Action series with a lot of political stuff. Like any Cop- series, only higher up the ladder. Murphy Brown Candice Bergen's Comedy Success. TV station comedy, always with some great intro-music, and with the Youngest producer, Miles. (laughter) 21 Jump Street Young cops, infiltrating clubs, gangs, and so on. A lot of action and moral. Still a good 'Cop' series. Hardball Well.. Just started here in Sweden, and so far, not so good. It's the basic odd-pair cop-show really. The Simpsons The Cult (still) series. I give 10 points out of ten to the first 20 episodes. Since then I'll give it a 7. Kid-Anarchy type-o. --------------------------------------------------------------------------- 5. END COMMENTS --------------- Rumors say that the European Amiga-Warez Scene's Blue Boxing is finally dead. I guess some of them found out 'the hard way'. Ok, this doesn't belong in this issue of TED, but it's news now, and not when the next TED in released. 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 other well-known underground rags, as contributions. Check out the Next TED for something Completely different! You can reach me on the following boards for comments, contributions, questions or whatever: Condemned Reality [618-397-7702] Land Of Karrus [215-948-2132] Demon Roach Underground [806-794-4362] Balanced pH [818-783-5320] Info Addict [+46-###-####] The Chief 1991 %&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%& % % & "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. & % % &%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&% ____________________________________________________________________________ ____________________________________________________________________________