|
Top Document: comp.unix.user-friendly Frequently Asked Questions (FAQ) Previous Document: 1.2 What books are available for learning Unix? Next Document: 1.4 What Internet resources are available for learning Unix? See reader questions & answers on this topic! - Help others by sharing your knowledge Another novice question which should be directed to the newsgroup comp.unix.questions. But novices can't know these things, so we should help them at least briefly: Basic commands and concepts, originally submitted by haley@husc.harvard.edu. Unix is an operating system, similar to MS-DOS, only much more powerful. Some versions have over 300 commands in the basic system, not including specialized applications. Command Primer -------------- These commands are meant for use in a program called a "shell", which is the user interface to the underlying programs that make up Unix. There are several different shells which are widely used, so the prompts you see on your screen, and the responses you see may vary slightly. However, the commands here should work in all of the shells. Note that users with Graphical User Interfaces (X Windows, Openview, etc) may have to use the "shelltool" or "command window" to use these commands. When you enter Unix commands, you will usually enter two or three words: the "command" itself, "modifier(s)" which change the way the command works, and "argument(s)" which provide the command with additional information. Each word in the command is separated by a space, and modifiers are preceded by a hyphen (-). Here is an example of the "ls" command with a modified and argument: Example: command modifier argument | | | ls -CF newdir Typing this command will print a directory listing on your screen of the directory "newdir". The modifiers "-CF" tell the ls command to list other directories listed with a / after them, and to list programs with a * after them, and logical links with a @ after them. The unix system uses a "hierarchical directory structure; to store files on its disks. This type of structure is like an upside-down tree, with one "root" directory (like the root and trunk of a tree), and many sub-directories (like branches) to store files in. Here is a small example of what one might look like: _______________(/)______________________________ / / \ \ \ bin lib etc home_____________ usr / / \ \ sys headcheese \ headcheese3 \ headcheese2 / student / yourdir The directories you must go through to find a particular file in "yourdir" are "/" then "home" then "headcheese2" then "student" then "yourdir". In Unix you call the directories you must go through to acces a file the "path", and you type in the above path like this: /home/headcheese2/student/yourdir/filename We call this "filename"'s "full path". The first "/" must be there for it to be a full path. If you leave it off then the shell will assume it is a "relative path" and look for the path to start in the directory you are currently in, called the "current working directory". This is useful, as always having to refer to files by their full path would get tedious. If you were in "student" and wanted to refer to "filename" in "yourdir" you could call it: yourdir/filename Or, if you are already in "yourdir", just filename O.K. That ought to be enough to get you interested and started... Note to MS-DOS users: Unix has a hierarchical directory structure, like MS-DOS, but uses a / to separate parts of a file path instead of a \ (Back-slash). Playing around -------------- After you understand these things, the thing to do is *PLAY*. Look around in the directories which store commands, and when you see something, do a "man" on it. When you think you want to know more, a trip to a math library is in order, or maybe a good bookstore. A good publisher is O'reilly (Nutshell). Addison Wesley is also good, but I think they are better for advanced stuff. Directories to look in: /bin /usr/bin /usr/local /usr/local/bin and just about any other "*bin" directory. Note that this method is not time efficient at first. It is however MUCH better for retention. I went from knowing nothing about Unix to having the professor who got me started asking *me* for advice. There is a small hand-full of commands that you will use many times, and here they are... man Print out a manual page on the screen. If you know the name of a command, you can read the manual by typing "man command". For example, typing "man ls" will display the manual for the ls command. If you want to search all of the man pages for a certain word (on some systems), you can type "man -k word". For example, typing "man -k mail" would list the names of all of the man pages pertaining to mail. man intro passwd Change your account password. This should be done the first time you log on, especially if you have no password. You must know your old password to change it. To change you password, type "passwd". Then enter your old (current) password, and the desired new password (twice). Note that your passwords will NOT appear on the screen as you type them. ls List the contents of a directory. Typing "ls" alone will list the contents of the current working directory. If you want to see a specific directory, you can type "ls directoryname". For example, "ls /pub" will list the contents of the /pub directory (if there is one one your system). Adding "-CF" options will give you a more detailed listing in columns, marking directories with a /, executable files with a *, and logical links with a @. For example, typing "ls -CF" will give a detailed listing of the current directory. mkdir Make a new directory as a sub-directory of where you are now. For example, "mkdir work" will create a sub-directory named "work" in your current directory. cd Change directory. Used to go up or down in the directory tree. For example, to change to a sub-directory named "work" in the current directory, type "cd work". Typing "cd .." will change to the parent directory, the directory one level above the current directory. vi Invoke the vi editor. This is a screen editor, that is, a text editor that makes use of the full screen. You must know this or another editor to make use of "elm". For those who use one of the windowing systems exclusively, you can put off learning this as the windowing systems have adifferent e-mail system. rm Remove a file. (note: this is forever! Think before you erase) For example, to remove a file named "foo", type "rm foo". Adding the "-r" option allows you to delete an entire sub-directory and ALL files and directories beneath it. BE CAREFUL! For example, to delete a directory named "work", and all files and sub-directories in "work", type "rm -rf work". elm Invoke the elm mail program. Note: must know an editor first. User Contributions:Top Document: comp.unix.user-friendly Frequently Asked Questions (FAQ) Previous Document: 1.2 What books are available for learning Unix? Next Document: 1.4 What Internet resources are available for learning Unix? Single Page [ Usenet FAQs | Web FAQs | Documents | RFC Index ] Send corrections/additions to the FAQ Maintainer: noel@camelcity.com (CUUF FAQ Coordinators)
Last Update March 27 2014 @ 02:12 PM
|

Comment about this article, ask questions, or add new information about this topic: