UNIX Introduction and Quick Reference Commands may need additional information, such as Information applications Quick Reference file or directory names, which are typed immediately apropos locate commands by keyword following the name. Clarification and gopher local and worldwide information syntax for any command is available by typing man access commandname after the ”%” prompt and then man display entries from online manual pressing Return. rn, trn, tin read Usenet news

Basic file commands Network commands concatenate or display files ftp general file transfer utility copy files rcp copy files between UNIX systems list file names rcp –r copy entire directory tree ls –l list file names, sizes, attributes telnet connect to a remote system to log in move or rename files ssh connect via a secure channel to a remote remove files system to log in

Editors Controlling applications The easiest editor to use is pico. The vi , jove, and fg restart a suspended command emacs editors are also available. jobs display suspended commands kill kill a command Mail ps display commands with process numbers ^C interrupt currently running process The easiest mail program to use is pine. The elm and mail mail programs are also available. ^Z suspend currently running process ^S stop output on screen Other file commands ^Q continue output on screen

diff compare two files fmt simple line adjuster for mail Miscellaneous grep scan a file for a pattern chfn change information shown by finger display the first ten lines of a file clear clear screen less display file one screen at a time date display date and time more display file one screen at a time finger show information about users sort/merge utility lpr send file to printer passwd change password display the last ten lines of a file count lines, words, characters in a file tell who is logged in wc –l count lines

Commands

cd change to a different directory

make a directory print the current directory’s name Information Systems and Technology rm –r remove directory & all files in that directory University of California UNX 1.4.5 August 1995-2003 remove empty directory Berkeley, Ca 94720-3812 UNIX Introduction Special Characters History This brochure provides a brief introduction to Special characters may be used in commands to The history command displays a numbered list UNIX. A quick reference to commonly used match existing file and directory names. The asterisk of the last twenty-five commands entered. You can commands is listed on the reverse side of this ( * ) is used to match an arbitrary string of characters. repeat a specififc numbered command in the list. For brochure. A few features to get you started with For example, example, UNIX are described below. % ls let* % !35 will list all of your files in the current directory repeats the command numbered 35. Also, you can Files and Directories beginning with “let” and repeat the last command that began with “str” by On UNIX, information is stored in files and % ls *old typing the following: directories. Files have names, such as thesis or will list all files ending with “old”. % !str A question mark is used to match any single You can repeat the last executed command in the list report.nov19. Because UNIX uses special characters for special purposes, it is best to use only letters character; for examle, by typing ( A...Z, a...z ), digits ( 0...9 ), periods ( . ), and % ls ab?de % !! will match and list files named “ab1de”, “abcde” and underscores ( _ ) in file names. Files are created by various UNIX commands. “ab.de”, but will not match files named “abde” or For more information You can save your mail messages in files. You can “abccde”. Information about UNIX commands is available also create text files with an editor. via the man and apropos commands. Type Files are located in directories. Directories can Redirection % apropos topic contain other directories, with are called Commands normally display results on the to find manual entries relating to “topic”, and subdirectories. The directory containing a screen; this output may be redirected to a file by % man command subdirectory is known as the parent of the using the redirection ( > ) symbol. For example, the to find the manual entry for “command”. subdirectory. Each account has a main directory who command lists the current users on the system. Many introductory books on UNIX are available known as the home directory. The command in bookstores and libraries. % who > save_who Commands writes the output of who into the file save_who. Redirection using > will not overwrite an existing You can enter UNIX commands by typing the command after a prompt such as “%” and then file. To do that, use >!: pressing the Return key. For example, type % who >! save_who To append to the end of an existing file, use two % ls and then press the Return key. The ls command lists redirection characters ( >> ) instead of one ( > ). the names of files in the current directory. The mkdir Output of one command may be used as input to another command by using the pipe ( | ) symbol. For command is used to create directories. For example, % mkdir letters example, creates a directory named letters. % who | wc –l shows how many users are logged in by usign wc –l Basic file manipulation commands include mv for moving or renaming files, cp for copying files, lpr to count the lines in the output of who. for printing files, and rm for removing files. The cd command is used to change from one directory to another. For example, the command % cd letters moves you to the letters subdirectory, and % cd moves you to your home direcory.