|
Learning Essential Command and Files |
|
By Augie Hansen This month we will learn about commands, which are the tools you use to get a UNIX system to do you bidding. You interact with UNIX by typing commands. Your commands are read and interpreted by a user-interface program called a shell. The UNIX shell tells you that it is waiting for a command by
printing a prompt. The AT&T version of UNIX running the standard
Bourne shell or the newer Korn shell uses a dollar sign
( When you press a key on your terminal, a numeric code that represents that character is generated and sent to the host computer. When a number is sent to your terminal, the character that it represents is displayed. Several codes stand for control characters that have an action, such as moving to the beginning of the current line (carriage return), but no graphic representation. In general, when you type a character at the keyboard, a copy is echoed immediately back to you so you can see what you just typed. The other copy, which is destined for a UNIX program, is buffered into a line. A buffer is an electronic equivalent of a reservoir. It collects characters you type, but doesn't release them until told to do so. The Return key is the command to pass the input buffer's contents to the shell or other running program waiting for your input. This is why you have to type Return after you type your log-in name and password when you log in. Note that the system echoed back your log-in name as you typed it, but not your password. Some Simple CommandsHere are a few commands that produce output without requiring
much input from you. If you make a typing mistake when entering
commands, you can use Backspace key to back up and correct the
error. The If you want to know what day of the week Christmas will fall
on this year, use the If you want to know about the hardware and software system you
are working on, perhaps to check on software compatibility for
some new program you have obtained, use the UNIX commands, for the most part, have been designed to operate reasonably when issued without optional arguments, but most let you change their default behavior by typing options. Always type a space after the command name and between each element (word) that you type on the command line. An option consists of an option flag (usually a dash) followed
by an option character or word. The Some command options require additional information following the option character or word, as we'll see later. File and Directory CommandsUNIX maintains information as a collections files and directories. So what are files and directories? A file is a collection of characters, and each file has a name by which you access it. The names of files are kept in directories. A directory serves the same purpose as the table of contents of a book. An entry in a directory points to the information related to file name, which gives you ready access to the file's contents while relieving you of any concern about where the information is actually stored. A directory is really just a file, but one that has a specific form for each of its entries. This design results in what is described as a directory hierarchy in which each each directory can contain the names of ordinary files and the names of other directories. Each boxed item is the name of a directory, and each unboxed item is a file. The highest level of the UNIX directory hierarchy is called root, which is symbolized by the forward slash (/) character.
Extending downward from the root is a set of system
directories. On each UNIX system, at least one of those
directories is allocated to users. On an AT&T 3B1, the user file
space, as it is called, is usually Different Naming ConventionsOther systems may use different naming conventions. But when
you log in, you will be automatically placed in the correct
directory, which is called your home directory. In my
case, that's Here are a few of the simple commands that deal with files and
directories. You use the If you don't know the name of the directory you are working in, type ``pwd'' then return to find out. The command prints the name of the working directory, which is usual called the current directory. Use the Elementary EditingYou'll spend much of your time creating and editing files. The primary tool you use for this work is a text editor, or possibly a word processor. To get you started, we will look at the standard UNIX line-oriented editor, Ed. The Ed editor was designed to be small and fast. It was not designed with ease of use in mind, at least not when judged by today's standards. Listing 3 shows the major
elements of a dialog between the user and Ed during the creation
of a file called To switch back to command mode, type a ``.'' (dot) on a line by itself and press Return. The Ed program worked in a temporary editing buffer as you
input and edit text. You must write the buffer to a disk file to
maintain a nonvolatile copy of it. Once back in the command
mode, you can save the file on disk by giving the write
( To view what you have written, use the print ( Next month we will continue exploring the UNIX editors by looking more closely at the Ed editor and by introducing Vi, the UNIX full-screen visual editor. |
Print This Page Send as e-mail |
Best of the Web
Data deduplication: Declawing the clones
Data deduplication is emerging as a critically important new arrow in the storage administrator's quiver to answer hard questions about the increasing problem in storage growth costs.
Compression, Encryption, Deduplication, and Replication: Strange Bedfellows
One of the great ironies of storage technology is the inverse relationship between efficiency and security: Adding performance or reducing storage requirements almost always results in reducing the confidentiality, integrity, or availability of a system.
WAN Optimization Whitelists and Blacklists
Optimization is a fantastic way of saving money and creating really happy customers at the same time, but it doesn't work flawlessly for all applications.
WAN Optimization as a Managed Service: It's Not About the Cost
This insight examines how organizations outsourcing their WAN optimization initiatives to a third-party go about achieving their goals for application performance, reducing operational costs, and streamlining enterprise infrastructure.





