Sie sind auf Seite 1von 19

Linux Shortcuts and Commands:

Linux Newbie Administrator Guide (http://linux-newbie.sunsite.dk/) by Stan and Peter Klimas

This is a practical selection o the commands we use most o ten. !ress <Tab> to see the listin" o all a#ailable command (on $our !AT%). &n m$ small home s$stem' it sa$s there are ()*) executables on m$ !AT%. +an$ o these ,commands, can be accessed rom $our a#ourite G-. ront-end (probabl$ /01 or Gnome) b$ clickin" on the ri"ht menu or button. The$ can all be run rom the command line. !ro"rams that re2uire G-. ha#e to be run rom a terminal opened under a G-.. Legend: 34 5 sin"le special or unction ke$ on the ke$board. 6or example 37trl4 indicates the ,control, ke$. italic 5 name o the ile or #ariable $ou probabl$ want to substitute with $our own. fixed width 5 in-line Linux commands and ilenames. Notes for the UNIX Clueless: 8. L.N-9 .: 7A:1-:1N:.T.;1. 6or example: Netscape' N1T:7A!1 and n1tscape are three di erent commands. Also m$< il1' m$< ile' and m$<6.L1 are three di erent iles. =our user lo"in name and password are also case sensiti#e. (This "oes with the tradition o -N.9 and the ,c, pro"rammin" lan"ua"e bein" case sensiti#e.) (. 6ilenames can be up to ()> characters lon" and can contain letters' numbers' ,., (dot)' ,<, (underscore)' ,-, (dash)' plus some other not recommended characters. ?. 6iles with names startin" with ,., are normall$ not shown b$ the ls (list) or dir commands. Think o these iles as ,hidden,. -se ls -a (list with the option ,all,) to see these iles. @. ,/, is an e2ui#alent to 0&: ,A, (root director$' meanin" the parent o all other directories). ). -nder Linux' all directories appear under a sin"le director$ tree (there are no 0&:-st$le dri#e letters). >. .n a con i"uration ile' a line startin" with B is a comment.

7 ! Linux essential shortcuts and sanity commands


<Ctrl><Alt><F1> :witch to the irst text terminal. -nder Linux $ou can ha#e se#eral (> in standard setup) terminals opened at the same time. <Ctrl><Alt><Fn> (n58..>) :witch to the nth text terminal. tty !rint the name o the terminal in which $ou are t$pin" this command. <Ctrl><Alt><F7> :witch to the irst G-. terminal (i 9-windows is runnin" on this terminal).

<Ctrl><Alt><Fn> (n5C..8() :witch to the nth G-. terminal (i a G-. terminal is runnin" on screen n-8). &n de ault' nothin" is runnin" on terminals D to 8(' but $ou can run another ser#er there. <Tab> (.n a text terminal) Autocomplete the command i there is onl$ one option' or else show all the a#ailable options. T%.: :%&ET7-T .: GE1ATF .t e#en works at L.L& promptF <ArrowUp> :croll and edit the command histor$. !ress 31nter4 to execute. <Shift><PgUp> :croll terminal output up. Gork also at the lo"in prompt' so $ou can scroll throu"h $our bootup messa"es. <Shift><Pg own> :croll terminal output down. <Ctrl><Alt><!> (in 9-windows) 7han"e to the next 9-ser#er resolution (i $ou set up the 9-ser#er to more than one resolution). 6or multiple resolutions on m$ standard :;GA card/monitor' . ha#e the ollowin" line in the ile "et#"$11"$F%&Config (the irst resolution starts on de ault' the lar"est determines the siHe o the ,#irtual screen,): 'odes (1)*+x7&%( (%))x&))( (&+)x+%)( (,1*x-%+( (+%)x-))( (+))x-))( (11,*x%&+( <Ctrl><Alt><-> (in 9-windows) 7han"e to the pre#ious 9-ser#er resolution. <Ctrl><Alt><./Sp#> (in 9-windows) /ill the current 9-windows ser#er. -se i the 9-windows ser#er crushes and cannot be exited normall$. <Ctrl><Alt>< el> :hut down the s$stem and reboot. This is the normal shutdown command or a user at the textmode console. 0onIt Just press the ,reset, button or shutdownF <Ctrl># /ill the current process (mostl$ in the text mode or small applications). <Ctrl>d Lo" out rom the current terminal. :ee also the next command. <Ctrl>d :end K1nd-o -6ileL to the current process. 0onIt press it twice else $ou also lo" out (see the pre#ious command). <Ctrl>s :top the trans er to the terminal.

<Ctrl>0 Eesume the trans er to the terminal. Tr$ i $our terminal m$steriousl$ stops respondin". <Ctrl>1 :end the current process to the back"round. exit Lo"out. . can also use logo2t or the same e ect. (. $ou ha#e started a second shell' e.".' usin" bash the second shell will be exited and $ou will be back in the irst shell' not lo""ed out.) reset Eestore a screwed-up terminal (a terminal showin" unn$ characters) to de ault settin". -se i $ou tried to ,cat, a binar$ ile. =ou ma$ not be able to see the command as $ou t$pe it. <'iddle'o2se.2tton> !aste the text which is currentl$ hi"hli"hted somewhere else. This is the normal ,cop$-paste, operation in Linux. (.t doesnIt work with Netscape and Gord!er ect which use the +: Gindows-st$le ,cop$-paste,. .t does work in the text terminal i $ou enabled ,"pm, ser#ice usin" ,setup,.) Mest used with a Linux-read$ ?-button mouse (Lo"itech or similar) or else set ,?-mouse button emulation,). 3 (tilde) +$ home director$ (normall$ the director$ "ho4e"4y5login5na4e). 6or example' the command #d 3"my_dir will chan"e m$ workin" director$ to the subdirector$ ,my_dir, under m$ home director$. T$pin" Just ,cd, alone is an e2ui#alent o the command ,cd N,. 6 (dot) 7urrent director$. 6or example' 6"4y5progra4 will attempt to execute the ile ,m$<pro"ram, located in $our current workin" director$. 66 (two dots) 0irector$ parent to the current one. 6or example' the command #d 66 will chan"e m$ current workin" director$ one one le#el up.

7 " Common Linux commands##system info


pwd !rint workin" director$' i.e.' displa$ the name o m$ current director$ on the screen. hostna4e !rint the name o the local host (the machine on which $ou are workin"). -se net#onf (as root) to chan"e the name o the machine. whoa4i !rint m$ lo"in name.

id username !rint user id (uid) and his/her "roup id ("id)' e ecti#e id (i di erent than the real id) and the supplementar$ "roups. date !rint or chan"e the operatin" s$stem date and time. 1.".' . could chan"e the date and time to (OOO-8(-?8 (?:)C usin" this command: date 1*-1*-,7*))) To set the hardware (M.&:) clock rom the s$stem (Linux) clock' use the command (as root) set#lo#/ ti4e 0etermine the amount o time that it takes or a process to complete P other in o. 0onIt con use it with the date command. 1.". . can ind out how lon" it takes to displa$ a director$ content usin": ti4e ls who 0etermine the users lo""ed on the machine. rwho -a (5remote who) 0etermine all users lo""ed on $our network. The rwho ser#ice must be enabled or this command to run. . it isnIt' run setup as root to enable ,rwho,. finger user_name :$stem in o about a user. Tr$: finger root last :how listin" o users last lo""ed-in on $our s$stem. history 7 4ore :how the last (8OOO or so) commands executed rom the command line on the current account. The ,Q more, causes the displa$ to stop a ter each screen ul. 2pti4e :how the amount o time since the last reboot. ps (5print status) List the processes currentl$ run b$ the current user. ps ax2 7 4ore List all the processes currentl$ runnin"' e#en those without the controllin" terminal' to"ether with the name o the user that owns each process. top /eep listin" the currentl$ runnin" processes' sorted b$ cpu usa"e (top users irst). .n /01' $ou can "et G-.-based /top rom ,/,menu under ,:$stem,-,Task +ana"er, (or b$ executin" ,ktop, in an 9-terminal). 2na4e -a (5 -nix name with option ,all,) .n o on $our (local) ser#er. . can also use g2na4e (in 9-

window terminal) to displa$ the in o more nicel$. free +emor$ in o (in kilob$tes). df -h (5disk ree) !rint disk in o about all the iles$stems (in human-readable orm) d2 " -bh 7 4ore (5disk usa"e) !rint detailed disk usa"e or each subdirector$ startin" at the ,/, (root) director$ (in human le"ible orm). #at "pro#"#p2info 7pu in o--it show the content o the ile #p2info. Note that the iles in the "pro# director$ are not real iles--the$ are hooks to look at in ormation a#ailable to the kernel. #at "pro#"interr2pts List the interrupts in use. #at "pro#"8ersion Linux #ersion and other in o #at "pro#"filesyste4s :how the t$pes o iles$stems currentl$ in use. #at "et#"print#ap :how the setup o printers. ls4od (As root. -se "sbin"ls4od to execute this command when $ou are a non-root user.) :how the kernel modules currentl$ loaded. set74ore :how the current user en#ironment. e#ho 9PAT: :how the content o the en#ironment #ariable ,!AT%,. This command can be used to show other en#ironment #ariables as well. -se ,set, to see the ull en#ironment. d4esg 7 less !rint kernel messa"es (the content o the so-called kernel rin" bu er). !ress ,2, to 2uit ,less,. -se less "8ar"log"d4esg to see what ,dmes", dumped into this ile ri"ht a ter the last s$stem bootup.

7 $ %asic o&erations
any_command --help 74ore 0ispla$ a brie help on a command (works with most commands). ,--help, works similar to 0&: ,/h, switch. The ,more, pipe is needed i the output is lon"er than one screen.

4an topic 0ispla$ the contents o the s$stem manual pa"es (help) on the topic. Tr$ 4an 4an irst. !ress ,2, to 2uit the #iewer. The command info topic works similar and ma$ contain more up-todate in ormation. +anual pa"es can be hard to read. Tr$ any_command --help or short' eas$ to di"est help on a command. . more in o needed' ha#e a look to the director$ "2sr"do#. To displa$ manual pa"e rom a speci ic section' . ma$ use somethin" like in this example: 4an - exit (this displa$s an in o on the command exit rom section ? o the manual pa"es). apropos topic Gi#e me the list o the commands that ha#e somethin" to to do with m$ topic. help #o44and 0ispla$ brie in o on a bash (shell) build-in command. ls List the content o the current director$. -nder Linux' the command ,dir, is an alias to ls. +an$ users ha#e ,ls, to be an alias to ,ls --color,. ls -al 74ore List the content o the current director$' all iles (also those startin" with a dot)' and in a lon" orm. !ipe the output throu"h the ,more, command' so that the displa$ pauses a ter each screen ul. #d directory 7han"e director$. -sin" ,cd, without the director$ name will take $ou to $our home director$. ,cd -, will take $ou to $our pre#ious director$ and is a con#enient wa$ to to""le between two directories. ,cd .., will take $ou one director$ up. #p source destination 7op$ iles. 1.".' #p "ho4e"stan"existing5file5na4e 6 will cop$ a ile to m$ current workin" director$. -se the ,-r, option ( or recursi#e) to cop$ the contents o whole directories' e.". ' #p -r 4y5existing"dir" 3 will cop$ a subdirector$ under m$ current workin" director$ to m$ home director$. 4#opy source destination 7op$ a ile rom/to a 0&: iles$stem (no mountin" necessar$). 1.".' 4#opy a;<a2toexe#6bat 3"=2n/ . :ee 4an 4tools or related commands: mdir' mcd' mren' mmo#e' mdel' mmd' mrd' m ormat .... 48 source destination +o#e or rename iles. The same command is used or mo#in" and renamin" iles and directories. ln source destination 7reate a hard link called destination to the ile called source. The link appears as a cop$ o the ori"inal iles' but in realit$ onl$ one cop$ o the ile is kept' Just two (or more) director$ entries point to it. An$ chan"es the ile are automaticall$ #isible throu"hout. Ghen one director$ entr$ is remo#ed' the other(s) sta$(s) intact. The limitation o the hard links are: the iles ha#e to be on the same iles$stem' hard links to directories or special iles are impossible. ln -s source destination 7reate a s$mbolic (so t) link called ,destination, to the ile called ,source,. The s$mbolic link

Just speci ies a path where to look or the ile. .n contradistinction to hard links' the source and destination donIt not ha#e to tbe on the same iles$stem. .n comparison to hard links' the drawback o s$mbolic links are: i the ori"inal ile is remo#ed' the link is ,broken,' s$mbolic links can also create circular re erences (like circular re erences in spreadsheets or databases' e.".' ,a, points to ,b, and ,b, points back to ,a,). r4 files Eemo#e (delete) iles. =ou must own the ile in order to be able to remo#e it. &n man$ s$stems' $ou will be asked or con irmation o deleation' i $ou donIt want this' use the ,- , (5 orce) option' e.".' r4 -f > will remo#e all iles in m$ current workin" director$' no 2uestions asked. 4/dir directory +ake a new director$. r4dir directory Eemo#e an empt$ director$. r4 -r files (recursi#e remo#e) Eemo#e iles' directories' and their subdirectories. 7are ul with this command as root--$ou can easil$ remo#e all iles on the s$stem with such a command executed on the top o $our director$ tree' and there is no undelete in Linux ($et). Mut i $ou reall$ wanted to do it (reconsider)' here is how (as root): r4 -rf "> #at filename 7 4ore ;iew the content o a text ile called , ilename,' one pa"e a time. The ,Q, is the ,pipe, s$mbol (on man$ American ke$boards it shares the ke$ with ,A,) The pipe makes the output stop a ter each screen ul. 6or lon" iles' it is sometimes con#enient to use the commands head and tail that displa$ Just the be"innin" and the end o the ile. . $ou happened to use ,cat, a binar$ ile and $our terminal displa$s unn$ characters a terwards' $ou can restore it with the command ,reset,. less filename :croll throu"h a content o a text ile. !ress 2 when done. ,Less, is rou"hl$ e2ui#alent to ,more, ' the command $ou know rom 0&:' althou"h #er$ o ten ,less, is more con#enient than ,more,. pi#o filename 1dit a text ile usin" the simple and standard text editor called pi#o. pi#o -w filename 1dit a text ile' while disablin" the lon" line wrap. %and$ or editin" con i"uration iles' e.". " et#"fstab. find " -na4e (filename( 6ind the ile called , ilename, on $our iles$stem startin" the search rom the root director$ ,/,. The , ilename, ma$ contain wildcards (R'S). lo#ate filename 6ind the ile name o which contains the strin" , ilename,. 1asier and aster than the pre#ious command but depends on a database that normall$ rebuilds at ni"ht.

6"program_name Eun an executable in the current director$' which is not on $our !AT%. to2#h filename 7han"e the date/time stamp o the ile filename to the current time. 7reate an empt$ ile i the ile does not exist. xinit :tart a barebone 9-windows ser#er (without a windows mana"er). startx :tart an 9-windows ser#er and the de ault windows mana"er. Gorks like t$pin" ,win, under 0&: with Gin?.8 startx -- ;1 :tart another 9-windows session on the displa$ 8 (the de ault is opened on displa$ O). =ou can ha#e se#eral G-. terminals runnin" concurrentl$. :witch between them usin" 37trl43Alt436C4' 37trl43Alt436D4' etc. xter4 (in 9 terminal) Eun a simple 9-windows terminal. T$pin" exit will close it. There are other' more ad#anced ,#irtual, terminals or 9-windows. . like the popular ones: /onsole and /8t (both come with kde) and gno4e-ter4inal (comes with "nome). . $ou need somethin" reall$ anc$-lookin"' tr$ ?ter4. xboing (in 9 terminal). ;er$ nice' old- ashioned "ame. +an$ small "ames/pro"rams are probabl$ installed on $our s$stem. . also like xboard (chess). sh2tdown -h now (as root) :hut down the s$stem to a halt. +ostl$ used or a remote shutdown. -se 37trl43Alt430el4 or a shutdown at the console (which can be done b$ an$ user). halt reboot (as root' two commands) %alt or reboot the machine. -sed or remote shutdown' simpler to t$pe than the pre#ious command.

Net'or( a&&s
nets#ape (in 9 terminal) Eun netscape (re2uires a separate Netscape installation). The current #ersions o Netscape (@.x) are known to be bi" and bu""$. The$ occasionall$ crash b$ #anishin" (no other harm done). Also' when not connected to the network ' Netscape likes to re use to do an$thin" (looks like it han"ed)-it re#i#es when $ou connect. nets#ape -display host;)6) (in 9 terminal) Eun netscape on the current machine and direct the output to machine named ,host, displa$ O screen O. =our current machine must ha#e a permission to displa$ on the machine ,host, (t$picall$ "i#en b$ executin" the command xhost

current_machine_name in the xterminal o the machine host. &ther 9-windows pro"ram can be run remotel$ the same wa$. lynx file.html ;iew an html ile or browse the net rom the text mode. pine A "ood text-mode mail reader. Another "ood and standard one is el4. =our Netscape mail will read the mail rom $our .nternet account. pine will let $ou read the ,local, mail' e.". the mail $our son or a cron process sends to $ou rom a computer on $our home network. The command 4ail could also be used or readin"/composin" mail' but it would be incon#enient--it is meant to be used in scripts or automation. el4 A "ood tex-mode mail reader. :ee the pre#ious command. 42tt A reall$ basic but extremall$ use ul and ast mail reader. 4ail A basic operatin" s$stem tool or e-mail. Look at the pre#ious commands or a better e-mail reader. 4ail is "ood i $ou wanted to send an e-mail rom a shell script. li#0 (in 9 term) An ic2 ,instant messa"in", client. Another "ood one is /xi#0. &lder distributions donIt ha#e an ic2 client installed' $ou ha#e to do download one and install it. tal/ username1 Talk to another user currentl$ lo""ed on $our machine (or use ,tal/ username1@machinename, to talk to a user on a di erent computer) . To accept the in#itation to the con#ersation' t$pe the command ,tal/ username2,. . somebod$ is tr$in" to talk to $ou and it disrupts $our work' $our ma$ use the command ,4esg n, to re use acceptin" messa"es. =ou ma$ want to use ,who, or ,rwho, to determine the users who are currentl$ lo""ed-in. 4# Launch the ,+idni"ht 7ommander, ile mana"er (looks like ,Norton 7ommander, or Linux). telnet server 7onnect to another machine usin" the T1LN1T protocol. -se a remote machine name or .! address. =ou will be prompted or $our lo"in name and password--$ou must ha#e an account on the remote machine to lo"in. Telnet will connect $ou to another machine and let $ou operate on it as i $ou were sittin" at its ke$board (almost). Telnet is not #er$ secure--e#er$thin" $ou t$pe "oes in open text' e#en $our passwordF rlogin server (5remote lo"in) 7onnect to another machine. The lo"in name/password rom $our current session is usedT i it ails $ou are prompted or a password.

rsh server (5remote shell) =et another wa$ to connect to a remote machine. The lo"in name/password rom $our current session is usedT i it ails $ou are prompted or a password. ftp server 6tp another machine. (There is also n#ftp which adds extra eatures and gftp or G-. .) 6tp is "ood or cop$in" iles to/ rom a remote machine. Tr$ user ,anon$mous, i $ou donIt ha#e an account on the remote ser#er. A ter connection' use ,S, to see the list o a#ailable tp commands. The essential tp command are: ls (see the iles on the remote s$stem)' ASCAA' binary (set the ile trans er mode to either text or binar$' important that $ou select the proper one )' get (cop$ a ile rom the remote s$stem to the local s$stem)' 4get ("et man$ iles at once)' p2t (cop$ a ile rom the local s$stem to the remote s$stem)' 4p2t (put man$ iles at once)' bye (disconnect). 6or automation in a script' $ou ma$ want to use n#ftpp2t and n#ftpget' or example: n#ftpp2t -2 4y52ser5na4e -p 4y5password -a re4ote6host6do4ain re4ote5dir >lo#al6ht4l 4ini#o4 +inicom pro"ram (looks like ,!rocomm or Linux,).

)ile *de+com&ression
tar -1x8f filename.tar.gz (5tape archi#er) -ntar a tarred and compressed tarball (R.tar."H or R.t"H) that $ou downloaded rom the .nternet. tar -x8f filename.tar -ntar a tarred but uncompressed tarball (R.tar). g2n1ip filename.gz 0ecompress a Hipped ile (R."H, or R.H). -se "Hip (also 1ip or #o4press) i $ou wanted to compress iles to this ile ormat. b2n1ip* filename.bz2 (5bi" unHip) 0ecompress a ile (R.bH() Hipped with bHip( compression utilit$. -sed or bi" iles. 2n1ip filename.zip 0ecompress a ile (R.Hip) Hipped with a compression utilit$ compatible with !/U.! or 0&:. 2nar= e filename.arj 1xtract the content o an R.arJ archi#e. 22de#ode -o outputfile filename 0ecode a ile encoded with 22en#ode. uu-encoded iles are t$picall$ used or trans er o nontext iles in e-mail (uuencode trans orms an$ ile into an A:7.. ile).

7 , Process control
ps (5print status) 0ispla$ the list o currentl$ runnin" processes with their process .0s (!.0) numbers. -se ps ax2 to see all processes currentl$ runnin" on $our s$stem (also those o other users or without a controllin" terminal)' each with the name o the owner. -se ,top, to keep listin" the processes currentl$ runnin". fg PID Mrin" a back"round or stopped process to the ore"round. bg PID :end the process to the back"round. &pposite to ". The same can be accomplished with 37trl4H. . $ou ha#e stopped Jobs' $ou ha#e to t$pe exit twice in row to lo" out. any_commandB Eun an$ command in the back"round (the s$mbol ,V, means ,run the proceedin" command in the back"round,). bat#h any_command Eun an$ command (usuall$ one that is "oin" to take more time) when the s$stem load is low. . can lo"out' and the process will keep runnin". at 17;)) 1xecute a command at a speci ied time. =ou will be prompted or the command(s) to run' until $ou press 37trl4d. /ill PID 6orce a process shutdown. 6irst determine the !.0 o the process to kill usin" ps. /illall program_name /ill pro"ram(s) b$ name. x/ill (in an xwindow terminal) /ill a G-.-based pro"ram with mouse. (!oint with $our mouse cursor at the window o the process $ou want to kill and click.) lp# (as root) 7heck and control the printer(s). T$pe ,S, to see the list o a#ailable commands. lp0 :how the content o the printer 2ueue. -nder /01 (9-Gindows)' $ou ma$ use G-.-based ,!rinter Wueue, a#ailable rom ,/,menu--tilities. lpr4 job_number Eemo#e a printin" Job ,Job<number, rom the 2ueue. ni#e program_name Eun program_name adJustin" its priorit$. :ince the priorit$ is not speci ied in this example' it will be adJusted b$ 8O (the process will run slower)' rom the de ault #alue (usuall$ O). The lower the number (o ,niceness, to other users on the s$stem)' the hi"her the priorit$. The priorit$ #alue

ma$ be in the ran"e -(O to 8*. &nl$ root ma$ speci $ ne"ati#e #alues. -se ,top, to displa$ the priorities o the runnin" processes. reni#e -1 PID (as root) 7han"e the priorit$ o a runnin" process to -8. Normal users can onl$ adJust processes the$ own' and onl$ up rom the current #alue (make them run slower). <Ctrl>#' <Ctrl>1' <Ctrl>s' and <Ctrl>0 also belon" to this chapter but the$ were described pre#iousl$ (http://www.unix"uide.net/linux/linuxshortcuts.shtmlBshortcuts). .n short the$ mean: stop the current command' send the current command to the back"round' stop the data trans er' resume the data trans er.

7 - %asic administration commands


printtool (as root in 9-terminal) 7on i"uration tool or $our printer(s). :ettin"s "o to the ile " et#"print#ap. set2p (as root) 7on i"ure mouse' soundcard' ke$board' 9-windows' s$stem ser#ices. There are man$ distibution-speci ic con i"uration utilities' set2p is the de ault on Eed%at. +andrake C.O o ers #er$ nice ra/Conf . lin2x#onfig (as root' either in text or "raphical mode). =ou can access and chan"e hundreds o settin" rom it. ;er$ power ul--donIt chan"e too man$ thin"s at the same time' and be care ul with chan"in" entries $ou donIt understand. x8idt2ne (in 9-terminal). AdJust the settin"s o the "raphical displa$ or all resolutions so as to eliminate black bands' shi t the displa$ ri"ht/le t/up/down' etc. (6irst use the knobs on $our monitor to it $our text mode correctl$ on the screen.) To make the chan"es permanent' displa$ the re2uencies on the screen and trans er them to the setup ile "et#"$11"$F%&Config. alias lsC(ls --#olorCtty( 7reate an alias or the command ,ls, to enhance its ormat with color. .n this example' the alias is also called ,ls, and the ,color, option is onl$ en#oke when the output is done to a terminal (not to iles). !ut the alias into the ile "et#"bashr# i $ou would like the alias to be alwa$s accessible to all users on the s$stem. T$pe ,alias, alone to see the list o aliases on $our s$stem. add2ser user_name 7reate a new account ($ou must be root). 1.".' add2ser barbara 0onIt or"et to set up the password or the new user in the next step. The user home director$ is "ho4e"user_name6 2seradd user_name The same as the command , add2ser user_name (. 2serdel user_name

Eemo#e an account ($ou must be a root). The userIs home director$ and the undeli#ered mail must be dealt with separatel$ (manuall$ because $ou ha#e to decide what to do with the iles). gro2padd group_name 7reate a new "roup on $our s$stem. Non-essential but can be hand$ e#en on a home machine with a small number o users. passwd 7han"e the password on $our current account. . $ou are root' $ou can chan"e the password or an$ user usin": passwd user_name chmod perm filename (5chan"e mode) 7han"e the ile access permission or the iles $ou own (unless $ou are root in which case $ou can chan"e an$ ile). =ou can make a ile accessible in three modes: read (r)' write (w)' execute (x) to three classes o users: owner (u)' members o the same "roup as the owner (")' others on the s$stem (o). 7heck the current access permissions usin": ls -l filename . the ile is accessible to all users in all modes it will show: rwxrwxrwx The irst triplet shows the ile permission or the owner o the ile' the second or his/her "roup' the third or others. A ,no, permission is shown as ,-,. 1.".' this command will add the permission to read the ile ,Junk, to all (5userP"roupPothers): #h4od a!r =2n/ This command will remo#e the permission to execute the ile Junk rom others: #h4od o-x =2n/ Also tr$ here (http://sunsite.auc.dk/share/pa"e/6AW(.htmB ile<permissions) or more in o. =ou can set the de ault ile permissions or the news iles that $ou create usin" the command 24as/ (see 4an 24as/). #hown new_ownername filename #hgrp new_groupname filename 7han"e the ile owner and "roup. =ou should use these two commands a ter $ou cop$ a ile or use b$ somebod$ else. s2 (5substitute user id) Assume the superuser (5root) identit$ ($ou will be prompted or the password). T$pe ,exit, to return $ou to $our pre#ious lo"in. 0onIt habituall$ work on $our machine as root. The root account is or administration and the su command is to ease $our access to the administration account when $ou re2uire it. =ou can also use ,su, to assume an$ other user identit$' e.". s2 barbara will make me ,barbara, (password re2uired unless . am a superuser). /ernel#fg (as root in 9 terminal). G-. to to add/remo#e kernel modules. =ou can do the same rom the command line usin" the command ,ins4od,' but ,ins4ode, is less ,newbie- riendl$,. ls4od List currentl$ loaded kernel modules. A module is like a de#ice dri#er--it pro#ides operatin" s$stem kernel support or a particular piece o hardware or eature. 4odprobe -l 74ore

List all the modules a#ailable or $our kernel. The a#ailable modules are determined b$ how $our Linux kernel was compliled. 1#er$ possible module/ eature can be compiled on linux as either ,hard wired, ( ast' non-remo#able)' ,module, (ma$be slower' but loaded/remo#able on demand)' or ,no, (no support or this eature at all). ins4od parport ins4od ppa (as root) .nsert modules into the kernel (a module is rou"hl$ an e2ui#alent o a 0&: de#ice dri#er). This example shows how to insert the modules or support o the external parallel port Hip dri#e (it appears to be a problem to "et the external Hip dri#e to work in an$ other wa$ under E%>.O ). r44od module_name (as root' not essential). Eemo#e the module module_name rom the kernel. setserial "de8"#2a) port )x)-f% ir0 + (as root) :et a serial port to a non-standard settin". The example here shows the standard settin" or the irst serial port (cuaO or tt$:O). The standard !7 settin"s or the second serial port (cua8or tt$:8) are: address o i/o port OxO( D' ir2 ?. The third serial port (cua( or tt$:(): OxO?eD' ir2 @. The orth serial port (cua? or tt$:?): OxO(eD' ir2 ?. Add $our settin" to " et#"r#6d"r#6lo#al i $ou want it to be set at the boot time. :ee man setserial or "ood a o#er#iew. fdis/ (as root) Linux hard dri#e partitionin" utilit$ (0&: has a utilit$ with the same name). #d "2sr"sr#"lin2x-*6)6-& 4a/e x#onfig (as root in 9 terminal). Nice G-. ront-end or con i"uration o the kernel options in preparation or compilation o $our customiHed kernel. (The director$ name contains the #ersion o $our Linux kernel so $ou ma$ need to modi $ the director$ name i $our Linux kernel #ersion is di erent than (.O.?> used in this example. =ou also need the ,Tk, interpreter and the kernel source code installed. ) The alternati#es to ,make xcon i", are: ,make con i", (runs a scripts that asks $ou 2uestions in the text mode) and ,make menucon i", (runs a text-based menu-dri#en con i"uration utilit$). Tr$: less "2sr"do#":DETD"Fernel-:DETD or more in ormation. A ter the con i"uration' $ou ma$ choose to proceed with kernel compilation o the new kernel b$ issuin" the ollowin" commands: 4a/e dep 4a/e 1A4age The last command will take some time to complete (ma$be O.) h' dependin" on $our hardware). .t produces the ile ,H.ma"e,' which is $our new Linux kernel. Next: 4a/e 4od2les 4a/e 4od2les5install Eead: /usr/doc/%&GT&//ernel-%&GT& or in ormation on how to install the new kernel. =ou will probabl$ also ind it use ul to read ,man depmode,. 7on i"uration' compilation and installation o a new kernel is not di icult but it 7AN lead to problems i $ou donIt know what $ou are doin". 7ompilation o a kernel is a "ood wa$ to test $our hardware' because it in#ol#es a massi#e amount o computin". . $our hardware is , lak$,' $ou will most likel$ recei#e the ,si"nal 88, error (read the beati ul "2sr"do#"FAG"txt"HCC-SAH11-FAG).

:ee this (http://sunsite.auc.dk/share/pa"e/kernel<up"rade.htm) or details on kernel up"rade. dep4od -a (as root) Muild the module dependenc$ table or the kernel. This can' or example' be use ul a ter installin" and bootin" a new kernel. -se ,4odprobe -a, to load the modules. ld#onfig (as root) Ee-create the bindin"s and the cache or the loader o d$namic libraries (,ld,). =ou ma$ want to run ldcon i" a ter an installation o new d$namicall$ linked libraries on $our s$stem. (.t is also re-run e#er$ time $ou boot the computer' so i $ou reboot $ou donIt ha#e to run it manuall$.) 4/nod "de8"fd) b * ) (5make node' as root) 7reate a de#ice ile. This example shows how to create a de#ice ile associated with $our irst lopp$ dri#e and could be use ul i $ou happened to accidentall$ erase it. The options are: b5block mode de#ice (c5character mode de#ice' p56.6& de#ice' u5unbu ered character mode de#ice). The two inte"ers speci $ the maJor and the minor de#ice number. fdfor4at "de8"fd):1++) 4/fs -# -t ext* (5 lopp$ disk ormat' two commands' as root) !er orm a low-le#el ormattin" o a lopp$ in the irst lopp$ dri#e (/de#/ dO)' hi"h densit$ (8@@O kM). Then make a Linux iles$stem (-t ext()' checkin"/markin" bad blocks (-c ). +akin" the iles s$stem is an e2ui#alent to the hi"h-le#el ormat. badblo#/s "de8"fd)1++) 1++) (as root) 7heck a hi"h-densit$ lopp$ or bad blocks and displa$ the results on the screen. The parameter ,8@@O, speci ies that 8@@O blocks are to be checked. This command does not modi $ the lopp$. fs#/ -t ext* "de8"hda* (5 ile s$stem check' as root) 7heck and repair a iles$stem. The example uses the partition hda(' iles$stem t$pe ext(. dd ifC"de8"fd):1++) ofCfloppy5i4age dd ifCfloppy5i4age ofC"de8"fd):1++) (two commands' dd5,data duplicator,) 7reate an ima"e o a lopp$ to the ile called , lopp$<ima"e, in the current director$. Then cop$ floppy5i4age ( ile) to another lopp$ disk. Gorks like 0&: ,0.:/7&!=,.

Program installation
rp4 -i8h filename.rpm (5Eedhat!acka"e+ana"er' install' #erbose' hashes displa$ed to show pro"ress' as root.) .nstall a content o Eed%at rpm packa"e(s) and print in o on what happened. /eep readin" i $ou pre er a G-. installation.

rp4 -0pi filename.rpm (5Eedhat!acka"e+ana"er' 2uer$' packa"e' list.) Eead the in o on the content o a $et uninstalled packa"e filename.rpm. rp4 -0pl filename.rpm (5Eedhat!acka"e+ana"er' 2uer$' packa"e' in ormation.) List the iles contained in a $et uninstalled packa"e filename.rpm. rp4 -0f filename (5Eedhat!acka"e+ana"er' 2uer$' ile.) 6ind out the name o the R.rpm packa"e to which the ile filename (on $our hardri#e) belon"s. rp4 -e pac agename (5Eedhat!acka"e+ana"er' erase5uninstall.) -ninstall a packa"e pagckagename. Packagname is the same as the be"innin" o the R.rpm packa"e ile but without the dash and #ersion number. /pa#/age gnorp4 glint (in 9 terminal' as root i $ou want to be able to install packa"es) G-. ronts to the Eed %at !acka"e +ana"er (rpm). ,"lint, comes with E%).(' ,"norpm, with E%>.O' ,kpacka"e, comes with E%>.8 or must be installed separatel$ but is the best o the three. -se an$ o them to #iew which so tware packa"es are installed on $our s$stem and the what not-$et-installed packa"es are a#ailable on $our Eed%at 70' displa$ the in o about the packa"es' and install them i $ou want (installation must be done as root).

.ccessing dri/es0&artitions
4o2nt :ee here (http://sunsite.auc.dk/share/pa"e/6AW.htmBGhere<dri#es) or details on mountin" dri#es. 1xamples are shown in the next commands. 4o2nt -t a2to "de8"fd) "4nt"floppy (as root) +ount the lopp$. The director$ "4nt"floppy must exist' be empt$ and N&T be $our current director$. 4o2nt -t a2to "de8"#dro4 "4nt"#dro4 (as root) +ount the 70. =ou ma$ need to create/modi $ the "de8"#dro4 ile dependin" where $our 70E&+ is. The director$ "4nt"#dro4 must exist' be empt$ and N&T be $our current director$. 4o2nt "4nt"floppy (as user or root) +ount a lopp$ as user. The ile "et#"fstab must be set up to do this. The director$ "4nt"floppy must not be $our current director$. 4o2nt "4nt"#dro4 (as user or root) +ount a 70 as user. The ile "et#"fstab must be set up to do this. The director$ "4nt"#dro4 must not be $our current director$. 24o2nt "4nt"floppy

-nmount the lopp$. The director$ "4nt"floppy must not be $our (or an$bod$ elseIs) current workin" director$. 0ependin" on $our setup' $ou mi"ht not be able to unmount a dri#e that $ou didnIt mount.

7 1 Net'or( administration tools


net#onf (as root) A #er$ "ood menu-dri#en setup o $our network. pingmachine_name 7heck i $ou can contact another machine ("i#e the machineIs name or .!)' press 37trl47 when done (it keeps "oin"). ro2te -n :how the kernel routin" table. nsloo/2p host_to_find Wuer$ $our de ault domain name ser#er (0N:) or an .nternet name (or .! number) host_to_find. This wa$ $ou can check i $our 0N: works. =ou can also ind out the name o the host o which $ou onl$ know the .! number. tra#ero2te host_to_trace %a#e a look how $ou messa"es tra#e to host_to_trace (which is either a host name or .! number). ipfwad4 -F -p 4 ( or E%).(' seen next command or E%>.O) :et up the irewall .! orwardin" polic$ to mas2ueradin". (Not #er$ secure but simple.) !urpose: all computers rom $our home network will appear to the outside world as one #er$ bus$ machine and' or example' $ou will be allowed to browse the .nternet rom all computers at once. e#ho 1 > "pro#"sys"net"ip8+"ip5forward ipfwad4-wrapper -F -p deny ipfwad4-wrapper -F -a 4 -S xxx6xxx6xxx6)"*+ - )6)6)6)") (three commands' E%>.O). 0oes the same as the pre#ious command. :ubstitute the ,x,s with di"its o $our class ,7, .! address that $ou assi"ned to $our home network. :ee here (http://sunsite.auc.dk/share/pa"e/6AW.htmBmas2ueradin") or more details. .n E%>.8' mas2uaradin" seems broken to me--. think . will install +andrake Linux:). if#onfig (as root) 0ispla$ in o on the network inter aces currentl$ acti#e (ethernet' ppp' etc). =our irst ethernet should show up as ethO' second as eth8' etc' irst ppp o#er modem as pppO' second as ppp8' etc. The ,lo, is the ,loopback onl$, inter ace which should be alwa$s acti#e. -se the options (see if#onfig --help) to con i"ure the inter aces. if2p interface_name ("sbin"if2p to it run as a user) :tartup a network inter ace. 1.".: if2p eth) if2p ppp) -sers can start up or shutdown the ppp inter ace onl$ when the ri"ht permission was checked

durin" the ppp setup (usin" net#onf ). To start a ppp inter ace (dial-up connection)' . normall$ use kppp a#ailable under kde menu ,internet,. ifdown interface_name ("sbin"ifdown to run it as a user). :hut down the network inter ace. 1.".: ifdown ppp) Also' see the pre#ious command. netstat 7 4ore 0ispla$s a lot (too muchS) in ormation on the status o $our network.

2usic#related commands
#dplay play 1 !la$ the irst track rom a audio 70. e=e#t Get a ree co ee cup holder :))). (1Ject the 70 E&+ tra$). play my_file.wav !la$ a wa#e ile. 4pg1*- my_file.mp! !la$ an mp? ile. 4pg1*- -w my_file.wav my_file.mp! 7reate a wa#e audio ile rom an mp? audio ile. /napster (in 9 terminal) :tart the pro"ram to downolad mp? iles that other users o napster ha#e displa$ed or downloadin". Eeall$ coolF #dparanoia -. (1-( (70 ripper) Eead the contents o an audio 70 and sa#e it into wa#e iles in the current directories' one track per wa#e ile. The ,8-, means , rom track 8 to the last,. -M orces puttin" each track into a separate ile. play4idi my_file.mid !la$ a midi ile. play4idi -r my_file.mid will displa$ text mode e ects on the screen. sox (ar"ument not "i#en here) 7on#ert rom almost an$ audio ile ormat to another (but not mp?s). :ee 4an sox.

3ra&hics#related commands
/ghost8iew my_file.ps 0ispla$ a postscript ile on screen. . can also use the older-lookin" ghost8iew or g8 or the same end e ect.

ps*pdf 4y5file6ps 4y5file6pdf +ake a pd (Adobe portable document ormat) ile rom a postscript ile. gi4p (in 9 terminal) A humble lookin" but #er$ power ul ima"e processor. Takes some learnin" to use' but it is "reat or artists' there is almost nothin" $ou canIt do with "imp. -se $our mouse ri"ht button to "et local menus' and learn how to use la$ers. :a#e $our ile in the nati#e "imp ile ormat R.xc (to preser#e la$ers) and onl$ then latten it and sa#e as pn" (or whate#er). There is a lar"e user manual /usr/ gphoto (in 9 terminal) !ower ul photo editor. giftopn4 my_file.giff > my_file.pnm pn4topng my_file.pnm > my_file.png 7on#ert the propriator$ "i "raphics into a raw' portable pnm ile. Then con#ert the pnm into a pn" ile' which is a newer and better standard or .nternet pictures (better technicall$ plus there is no dan"er o bein" sued b$ the owner o "i patents).

Das könnte Ihnen auch gefallen