Basic Unix Commands
http://www.cas.suffolk.edu/cas/doc/unix.html
Basic Unix Commands
Introductory Information about Unix Unix is a computer operating system, like DOS for IBM PCs. An operating system consists of commands that let you manage information in the form of files, or run programs that perform tasks such as word processing, e-mail, or data analysis. A Unix file is a collection of information stored on disk, be it the text of a document, data for statistical analysis, or the executable code for a program. A file is referenced by a name. A filename in Unix can consist of any combination of characters on the keyboard except for the space bar and all of the following: * ? ! | \ / ' " { } < > ; , ^ ( ) $ ~. These characters cannot be used in filenames because they have special meaning to the shell. For example, the first two symbols are used as "wildcard" characters when you're issuing commands: the * will match any string of characters in a filename, whereas the ? matches any single character. Unix is case-sensitive. That is, Unix distinguishes between upper and lower case letters in the names of files and programs. Thus, while "ls" is a valid Unix command, "LS" is not. Login names and passwords are also case-sensitive. The UNIX Online Manual The "man" and "apropos" commands give you access to the online reference manual. The manual is organized by command; as a novice, you may find that the difficulty is knowing which command you need to read about. As shown in the following sample session, you can use the "-k" option with "man" to obtain a list of topics related to a particular key word. This displays the section of the manual describing the manual displayprogram itself. Press the "space bar" to display the next screenful of information. Type "q" to leave the manual and return to the system prompt. This shows all commands associated with the keyword directory. Same as the command apropos directory . This displays the section of the manual describing the command "ls".
man man
man -k directory man ls Basic File Commands:
1 of 3
02/10/2000 12:02 PM
Basic Unix Commands
http://www.cas.suffolk.edu/cas/doc/unix.html
ls (list files)
ls –l ls –a ls DIRODIR mv FILE1 FILE2 mv FILE1 DIR/ rm FILE more FILE
"ls" list all the files in your current directory.
List all files as above, but along with information aboute date, time, and
type of file.
List all files, including normally hidden files that begin with a ".". Will lists the content of the directory DIRODIR. Rename a file from old name FILE1 to new name FILE2 .
Move FILE1 from it's present directory into another directory (DIR). Remove or delete FILE. Display the contents of FILE, pausing after each screenful.
There are several keys which control the output once a screenful has been printed. "q" "/string" + less FILE tail FILE
Will advance the output one line at a time. Will advance the output by another full screenful. Will quit and return you to the UNIX prompt. Will search forwards for string.
"less" is a program similar to "more", but which allows backward movement in the file as well as forward movement. Shows the last 10 lines of FILE. Record everything that appears on the screen in a file. "script" will create a file called ‘typescript’ and record everything that you type and the output of every program you run until you either type ‘exit’ or press Ctrl-d. Do not use emacs command while making a script file, or the resulting file will be unreadable. "script FILE" does exactly like above, but the file is called FILE instead of ‘typescript’.
script
Basic Directory Commands: cd DIR cd .. mkdir DIR rmdir DIR cd mv DIR1 DIR2 pwd Printing: Printing On the Fenton Computer Lab Printer To print a Unix text or PostScript file, type the following command at the system prompt: lpr FILE Printing to any other printer To print a Unix file on any other printer, you must first download/FTP it to your desktop computer and you can open it with word processor (Microsoft Word/Notepad). Go to the directory called DIR. Go to the directory above the current directory. Create a new directory called DIR. Remove the directory DIR (must be empty first). Go to your home directory. Move or rename a directory from old name DIR1 to new name DIR2. Shows your current working directory.
2 of 3
02/10/2000 12:02 PM
Basic Unix Commands
http://www.cas.suffolk.edu/cas/doc/unix.html
Useful Commands: exit Ctrl-l or clear Ctrl-c Ctrl-p Ctrl-z man COMMAND finger USER@ADDRESS jobs telnet/ssh ADDRESS ftp ADDRESS wc FILE spell FILE history Ends your work on the Unix system. Clears the screen. Stops the program currently running. Retrieves the last shell command you typed. Pauses the currently running program. Looks up the Unix command COMMAND in the online manual pages. Displays login/e-mail status of a user at another host. Lists background jobs started during your current login session. Logs on to another machine on the Internet on which you have an account. Begins a file transfer session with another computer on the Internet. Counts the lines, words, and characters in FILE. Reports possible misspelled words in FILE. List all commands typed so far.
3 of 3
02/10/2000 12:02 PM