UNIX Charges.


70 views
Uploaded on:
Category: People / Lifestyle
Description
July 10, 2003. Serguei A. Mokhov, mokhov@cs.concordia.ca. 2. Substance. Shell IntroCommand FormatShell I/OCommand I/OCommand Overview. July 10, 2003. Serguei A. Mokhov, mokhov@cs.concordia.ca. 3. Shell Intro. A framework program that permits a client to execute:shell capacities (inward commands)other projects (outside commands)shell scriptsLinux/UNIX has a group of them, the most widely recognized aretcsh, an exp
Transcripts
Slide 1

UNIX Commands COMP 444/5201 Revision 1.4 January 25, 2005 Serguei A. Mokhov, mokhov@cs.concordia.ca

Slide 2

Contents Shell Intro Command Format Shell I/O Command I/O Command Overview Serguei A. Mokhov, mokhov@cs.concordia.ca

Slide 3

Shell Intro A framework program that permits a client to execute: shell capacities (interior charges) different projects (outside summons) shell scripts Linux/UNIX has a group of them, the most widely recognized are tcsh , an extended form of csh (Bill Joy, Berkley, Sun) bash , a standout amongst the most famous and rich in usefulness shells, a development of sh (AT&T Bell Labs) ksh , Korn Shell zhs ... Serguei A. Mokhov, mokhov@cs.concordia.ca

Slide 4

Command Format: summon name and 0 or more contentions: % commandname [arg1] ... [argN] By % sign I mean brief here and from now on. Contentions can be choices (changes to the charge to demonstrate a method of operation) ; more often than not prefixed with a hyphen (- ) or two (- - ) in GNU style non-alternatives, or operands, essentially the information to work with (real information, or a document name) Serguei A. Mokhov, mokhov@cs.concordia.ca

Slide 5

Shell I/O Shell is a "force client" interface, so the client cooperates with the shell by writing in the summons. The shell deciphers the charges, that may create a few results, they do a reversal to the client and the control is offered back to the client when an order finishes (as a rule). On account of outer charges, shell executes genuine projects that may call elements of the OS piece. These framework summons are regularly wrapped around a purported framework calls, to request that the bit play out an operation (normally advantaged) on your sake. Serguei A. Mokhov, mokhov@cs.concordia.ca

Slide 6

Command I/O Input to shell: Command name and contentions wrote by the client Input to an order: Keyboard, record, or different charges Standard info: console. Standard yield: screen. These STDIN and STDOUT are frequently together alluded to as a terminal. Both standard information and standard yield can be diverted from/to a document or other charge. Record redirection: < input > yield >> yield add Serguei A. Mokhov, mokhov@cs.concordia.ca

Slide 7

Commands Serguei A. Mokhov, mokhov@cs.concordia.ca

Slide 8

man Manual Pages The principal summon to recall Contains information about practically everything :- ) different charges framework calls c/library capacities different utils, applications, arrangement records To peruse about man itself sort: % man NOTE: sadly there\'s no % man lady ... Serguei A. Mokhov, mokhov@cs.concordia.ca

Slide 9

which Displays a way name of an order. Hunt a way natural variable down the summon and shows the outright way. To discover which tcsh and bash are really being used, sort: % which tcsh % which bash % man which for more subtle elements Serguei A. Mokhov, mokhov@cs.concordia.ca

Slide 10

chsh Change Login Shell Login shell is the shell that translates summons after you signed in of course. You can transform it with chsh (gave that your framework administrator permitted you to do as such). To rundown every single conceivable shell, contingent upon execution: % chsh - l % feline/and so forth/shells % chsh without any contentions will provoke you for the shell. Serguei A. Mokhov, mokhov@cs.concordia.ca

Slide 11

whereis Display all areas of an order (or some other twofold, man page, or a source document). Searchers all registries to discover orders that match whereis " contention % whereis tcsh Serguei A. Mokhov, mokhov@cs.concordia.ca

Slide 12

General Commands Serguei A. Mokhov, mokhov@cs.concordia.ca

Slide 13

passwd Change your login secret key. A smart thought after you got another one. It\'s normally a suspicious system requesting that your secret key have no less than 6 roasts in the watchword, no less than two in sequential order and one numerical characters. Some different limitations (e.g. lexicon words or past secret key comparability) may apply. Contingent upon a benefit, one can change client\'s and gathering passwords and in addition genuine name, login shell, and so forth % man passwd Serguei A. Mokhov, mokhov@cs.concordia.ca

Slide 14

date Guess what :- ) Displays dates in different organizations % date % date - u in GMT % man date Serguei A. Mokhov, mokhov@cs.concordia.ca

Slide 15

Calendar for month whole year Years range: 1 - 9999 No year 0 Calendar was amended in 1752 - evacuated 11 days % cal current month % cal 2 2000 Feb 2000, jump year % cal 2 2100 not a jump year % cal 2 2400 leap year % cal 9 1752 11 days skipped % cal 0 error % cal 2002 whole year cal Serguei A. Mokhov, mokhov@cs.concordia.ca

Slide 16

clear Clears the screen There\'s a nom de plume for it: Ctrl+L Example arrangement: % cal % clear % cal Ctrl+L Serguei A. Mokhov, mokhov@cs.concordia.ca

Slide 17

rest "Dozing" is doing nothing for quite a while. Generally utilized for postponements as a part of shell scripts. % rest 2 2 seconds stop Serguei A. Mokhov, mokhov@cs.concordia.ca

Slide 18

Command Grouping Semicolon: ";" Often gathering goes about as though it were a solitary order, so a yield of various orders can be diverted to a document: % (date; cal; date) > out.txt Serguei A. Mokhov, mokhov@cs.concordia.ca

Slide 19

false name Defined another name for an order % nom de plume without any contentions records as of now dynamic nom de plumes % moniker newcommand oldcommand characterizes a newcommand % assumed name cl cal 2003 % cl Serguei A. Mokhov, mokhov@cs.concordia.ca

Slide 20

unalias Removes nom de plume Requires a contention. % unalias cl Serguei A. Mokhov, mokhov@cs.concordia.ca

Slide 21

Display a past filled with as of late utilized summons % history all orders in the history % history 10 last 10 % history - r 10 reverse request % !! rehash last order % ! n rehash charge n in the history % !- 1 rehash last order = !! % !- 2 rehash second last summon % !ca rehash last order that starts with "ca" history Serguei A. Mokhov, mokhov@cs.concordia.ca

Slide 22

Search man pages for a substring. % pertinent word Equivalent: % man - k word % opportune date % man - k date % relevant secret key opportune Serguei A. Mokhov, mokhov@cs.concordia.ca

Slide 23

exit/logout Exit from your login session. % exit % logout Serguei A. Mokhov, mokhov@cs.concordia.ca

Slide 24

shutdown Causes framework to shutdown or reboot neatly. May require superuser benefits % shutdown - h now -stop % shutdown - r now -reboot Serguei A. Mokhov, mokhov@cs.concordia.ca

Slide 25

Files Serguei A. Mokhov, mokhov@cs.concordia.ca

Slide 26

List index substance Has entire group of alternatives, see man ls for points of interest. % ls all records aside from those beginning with a "." % ls - an all % ls - An all without "." and ".." % ls - F affix "/" to dirs and "*" to executables % ls - l long configuration % ls - al % ls - lt sort by adjustment time (most recent - soonest) % ls - ltr reverse ls Serguei A. Mokhov, mokhov@cs.concordia.ca

Slide 27

feline Display and connect records. % feline Will read from STDIN and print to STDOT each line you enter. % feline file1 [file2] ... Will link all records in one and print them to STDOUT % feline > filename Will take whatever you write from STDIN and will place it into the document filename To leave feline or feline > filename sort Ctrl+D to show EOF (End of File). Serguei A. Mokhov, mokhov@cs.concordia.ca

Slide 28

more/less Pagers to show substance of huge documents page by page or parchment line by line here and there. Have a great deal of review alternatives and pursuit ability. Intelligent. To leave: "q" Serguei A. Mokhov, mokhov@cs.concordia.ca

Slide 29

less ("less is more") more keen than the more summon to show substance of a record: % less filename To show line numbers: % less - N filename To show a brief: % less - P"Press "q" to quit" filename Combine the two: % less - NP"Blah-blah-blah" filename For more data: % man less Serguei A. Mokhov, mokhov@cs.concordia.ca

Slide 30

touch By touching a document you either make it on the off chance that it didn\'t exists (with 0 length). Then again you overhaul it\'s last adjustment and access times. There are alternatives to supersede the default conduct. % touch record % man touch Serguei A. Mokhov, mokhov@cs.concordia.ca

Slide 31

cp Copies records/indexes. % cp [options] <source> <destination> % cp file1 file2 % cp file1 [file2] …/registry Useful alternative: - i to forestall overwriting existing records and provoke the client to affirm. Serguei A. Mokhov, mokhov@cs.concordia.ca

Slide 32

mv Moves or renames documents/indexes. % mv <source> <destination> The <source> gets evacuated % mv file1 dir/% mv file1 file2 rename % mv file1 file2 dir/% mv dir1 dir2 Serguei A. Mokhov, mokhov@cs.concordia.ca

Slide 33

rm Removes file(s) and/or catalogs. % rm file1 [file2] ... % rm - r dir1 [dir2] ... % rm - r file1 dir1 dir2 file4 ... Serguei A. Mokhov, mokhov@cs.concordia.ca

Slide 34

script Writes a log (a typescript) of whatever happened in the terminal to a document. % script [file] % script all log is spared into a record named typescript % script document all log is spared into a document named document To leave logging, sort: % exit Serguei A. Mokhov, mokhov@cs.concordia.ca

Slide 35

discover Looks up a record in a catalog tree. % find . - name % find . \(- name "w*" - or - name "W*" \) Serguei A. Mokhov, mokhov@cs.concordia.ca

Slide 36

mkdir Creates a catalog. % mkdir newdir Often individuals make a false name of md for it. Serguei A. Mokhov, mokhov@cs.concordia.ca

Slide 37

disc Changes your present index to another one. % disc/a few/other/dir Absolute way % album subdir Assuming subdir is in the present registry. % album Returns you to your home index. Serguei A. Mokhov, mokhov@cs.concordia.ca

Slide 38

pwd Displays individual working index, i.e. your present index. % pwd Serguei A. Mokhov, mokhov@cs.concordia.ca

Slide 39

rmdir Removes a registry. % rmdir dirname Equivalent: % rm - r dirname Serguei A. Mokhov, mokhov@cs.concordia.ca .:t

Recommended
View more...