Документ взят из кэша поисковой машины. Адрес оригинального документа : http://kodomo.cmm.msu.ru/FBB/year_03/doc/term3/EMBnet_unix.pdf
Дата изменения: Tue Oct 5 12:02:56 2004
Дата индексирования: Sat Dec 22 07:22:33 2007
Кодировка:
A Quick Guide To UNIX
This is an introduction to the UNIX operating system. Unix may seem idiosyncratic, even impenetrable, to begin with but it has the virtue of minimising the number of keystr okes and so speeding up your access to the computer. The commands listed here are common to different operating systems and shells. They include some of the most useful and frequently used commands in UNIX. The power and utility of most UNIX commands can be enhanced with switches or options preceded by a "-" sign. More information on the options, the effects and how to use the commands is available by using the man command: man gives manual information on a topic man grep displays the manual page about grep Another useful source of information is the on-line EMBnet tutorial which includes a page on UNIX

FILES ls

more lists files in a directory ls -alF lists -a all files in -l long format -F identifies directories /, executable files *, and symbolic links @, in the current directory concatenates and displays files cat my.file displays my.file on the screen modifies the read (r), write and delete (w), and execute (x) permissions of specified files and the search permissions of specified directories chmod go-w my.file stops anyone else changing or deleting my.file copies files cp orig.file copy.file cp file subdir/file compares two files and prints how they differ diff file1 file2 prints differences to screen options include -b to ignore differences in blank space, and -i to ignore case. searches the directory tree for a file find . -name lostfile -print will search "." (your current directory and any subdirectories) for lostfile searches a file for a string grep word file grep 'two words' file options include -i to ignore case and -n to print line numbers prints the first few (default = 10) lines of a file head oddfile head -20 oddfile displays first twenty lines displays last few lines of a file (see head) >>

displays a file one screenful at a time: more longfile hit to see the next screen moves/renames a file (or directory) mv file1 file2 mv file1 subdir/file1 removes/deletes a file. rm oldfile rm -i *.file option -i (interactive) advised if wildcards (*) in use

mv

cat

rm

chmod

OUTPUT REDIRECTION > redirects output of a command to a file diff file1 file2 > new.file puts differences into new.file cat one.file two.file > both.file writes the output of the cat command into both.file (overwrites both.file) appends a file to the bottom of another cat three.file >> both.file appends three.file to the bottom of both.file "pipe" - uses the output of the first command as the input of the second grep string my.file | wc -l finds how many lines on which "string" occurs (see grep and wc)

cp

diff http://biobase.dk/Embnetut/Universl/unixcmds.html or equally http://www.hgmp.mrc.ac.uk/Embnetut/Universl/ unixcmds.html The general format of this document is that anything in bold type is a command you can enter. Anything preceded by a hyphen "-" is an option which will modify the effects of a command. A general description of each command is followed by one or several examples of its use.

|

find

DIRECTORIES grep cd cd cd cd changes current directory /etc go to /etc directory .. go up one level in directory tree ../subdir2 go "sideways" to subdir2

head

mkdir creates a new subdirectory mkdir subdir rmdir removes a directory - you must delete all the files in it first rmdir subdir

tail


PROCESSES ^c -c kills (definitely stops) current job -z suspends the current job. This can either be moved to the background or resumed in the foreground by using bg or fg moves the current process to the background moves a process to the foreground. (If there is more than one suspended job, use jobs to decide which you want to fg) fg 1 moves process 1, as listed by jobs, to the foreground lists background and suspended processes (created with bg or ^z) jobs -l ("el" not one) includes the pid (process id number) ps kill lists all your processes stops a process (use ps or jobs to find your processes) kill 2986 kills off the process with pid 2986 kill -KILL 2986 definitely kills off pid 2986

passwd exit

invokes a password changing program leaves the current shell (same as ^d or -d) usually = logout tells you who is logged on (see also w) displays last several commands used re-executes the last command executes command 51 in the history list shows information about logged in users who produces similar result (see finger) for those having an identity crisis

^z

finger history !! !51 w

EMBnet

bg

fg

whoami

jobs

This document was written and designed by Aoife McLysaght and Andrew Lloyd(C) from the Irish EMBnet node and distributed by the Publications Committee of EMBnet. EMBnet - European Molecular Biology Network - is a network of bioinformatics support centres situated primarily in Europe. Most countries have a national node which can provide training courses and other forms of help for users of bioinformatics software. Further information about UNIX is available from your national node. You can find contact information about your national node from the EMBnet brochure: http://www.embnet.org/

MISCELLANEOUS wc word count wc long.file prints the number of lines, words and characters in long.file. Options include -l to count lines only, and -c to count characters only lists all the man(ual) entries relating to a topic (same as man -k) apropos print displays current date and time If you have found this publication useful, please let us know. If you have ideas for similar documents we'd like to hear from you: emb-pr@dl.ac.uk A Quick Guide To UNIX Second printing 1998

apropos

A Quick Guide UNIX

date