{"id":9,"date":"2008-05-06T14:07:24","date_gmt":"2008-05-06T12:07:24","guid":{"rendered":"http:\/\/oktay.com\/wp\/wordpress\/?page_id=9"},"modified":"2008-05-06T14:14:25","modified_gmt":"2008-05-06T12:14:25","slug":"aliens-bash-tutorial","status":"publish","type":"page","link":"https:\/\/wp.oktay.com\/?page_id=9","title":{"rendered":"aliens bash tutorial"},"content":{"rendered":"<p>original link: <a href=\"http:\/\/subsignal.org\/doc\/AliensBashTutorial.html\">http:\/\/subsignal.org\/doc\/AliensBashTutorial.html<\/a><br \/>\n=========================== Aliens Bash Tutorial ==============================<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212; Written by Billy Wideling &lt;-&gt; <a href=\"mailto:alien@koping.net\">alien@koping.net<\/a> &#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\n===============================================================================<\/p>\n<p>First you probably need to read a UNIX command bible to really understand this<br \/>\ntutorial, but I will try to make it as clear as possible, there is about<br \/>\n100-150 UNIX commands explained later in this tutorial.<br \/>\nYou are to have some UNIX experance before starting on this tutorial, so<br \/>\nif you feel that you have UNIX\/Linux experance feel free to start to learn<br \/>\nhere.<br \/>\nWhat I included here is general shell scripting, most common other things<br \/>\nand some UNIX commands.<br \/>\nHere&#8217;s the most common shell types:<\/p>\n<p>bash\u00a0 = Bourne again shell<br \/>\nsh\u00a0\u00a0\u00a0 = shell<br \/>\ncsh\u00a0\u00a0 = C shell<br \/>\ntcsh\u00a0 = Tenex C shell (not tab-completion-extended C shell)<br \/>\ntclsh = Tcl shell<br \/>\nksh\u00a0\u00a0 = korn shell<br \/>\nash\u00a0\u00a0 = a shell<br \/>\nbsh\u00a0\u00a0 = bourne shell ? (in most Linux distributions it&#8217;s a link to \/bin\/ash)<br \/>\nzsh\u00a0\u00a0 = the Z shell (it&#8217;s what it&#8217;s manual page tells about it .. :\/ )<\/p>\n<p>===============================================================================<br \/>\n1 &#8211; What you already know. (should know)<br \/>\n===============================================================================<\/p>\n<p>Here we go, bash scripting is nothing more then combining lots of UNIX commands<br \/>\nto do things for you, you can even make simple games in bash<br \/>\n(just UNIX commands) or as in normal cases, batch files to control things<br \/>\nin your computer.<\/p>\n<p>There is a variety of easyer and harder examples in the beginning of this<br \/>\ntutorial, I&#8217;ve done it this way to make it easier for people to get the<br \/>\ngeneral picture, so they will get more of the &#8220;aha!&#8221; experiences in the later<br \/>\nchapters of this tutorial.<\/p>\n<p>What bash or any scripting language does is to call for premade programs<br \/>\nthat lives in your computer.<br \/>\nSo when you write a command in a script you are calling a command that is<br \/>\na part of the system.<br \/>\nThat is why this tutorial will be just as much a Linux and UNIX tutorial<br \/>\nas a shell scripting tutorial.<\/p>\n<p>I will however not take up much about The X Windows System in this<br \/>\ntutorial, for the simple reason that a Window Manager does nothing else<br \/>\nthen display programs.<\/p>\n<p>This means that a Window Manager is like a graphical shell for the system.<br \/>\nYou can do all in this tutorial from any terminal emulator in a Linux<br \/>\nGraphical Enviorment (The X Windows System).<br \/>\nA terminal emulator would be such as: Eterm, xterm, axvt, rxvt, kterm etc.<br \/>\nA terminal emulator let&#8217;s you get up a terminal with a command prompt<br \/>\nin a graphical window.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Shell command separator\/control characters:<\/p>\n<p>|\u00a0 = pipe will take the first commands stdout as the second commands stdin.<br \/>\n|| = OR if first command is false, it will take the second.<br \/>\n|= = OR IS (mostly used in if statements)<br \/>\n&amp;&amp; = AND if first command is true, it will execute the second one.<br \/>\n!\u00a0 = NOT (mostly used in if and test statements), but as a shell-command<br \/>\n\u00a0\u00a0\u00a0\u00a0 it opens a shell to run the command (ex. `! echo foo`)<br \/>\n!= = NOT IS (mostly used in if statements)<br \/>\n!$ = last commands last argument<br \/>\n!! = repeat last command<br \/>\n=\u00a0 = IS (mostly used in if statements)<br \/>\n;\u00a0 = will separate 2 commands as if they were written on separate command lines<br \/>\n;; = end of a case function in a case statement. (see `case` further down)<br \/>\n$\u00a0 = prefix to a variable like &#8220;$myvar&#8221;<br \/>\n$! = PID of the last child process.<br \/>\n$$ = PID of current process (PID == Process ID)<br \/>\n$0 = Shows program that owns the current process.<br \/>\n$1 = First agument supplied after the program\/function on execution.<br \/>\n$2 = Second agument supplied after the program\/function on execution. ($3 etc.)<br \/>\n$# = Shows the number of arguments.<br \/>\n$? = Any argument (good to use in `if` statements)<br \/>\n$- = current option flags (I never ever had to use this one)<br \/>\n$_ = Last argument\/Command<br \/>\n$* = All arguments<br \/>\n$@ = All arguments<br \/>\n#\u00a0 = remmed line, anything on a line after &#8220;#&#8221; will be overlooked by the script<br \/>\n{\u00a0 = start braces (starts a function)<br \/>\n}\u00a0 = end braces\u00a0\u00a0 (ends a function)<br \/>\n[\u00a0 = start bracket (multiple-argument specifiers)<br \/>\n]\u00a0 = end bracket (multiple-argument specifiers)<br \/>\n@\u00a0 = $@ is equivalent to &#8220;$1&#8221; &#8220;$2&#8243; etc. (all arguments)<br \/>\n*\u00a0 = wild card (* can substitute any number of characters)<br \/>\n?\u00a0 = wild card (? can substitute any single character)<br \/>\n&#8221;\u00a0 = quote<br \/>\n&#8216;\u00a0 = precise quote. (Will even include &#8220;&#8216;s in the quote)<br \/>\n`\u00a0 = command quote. (variable=`ls -la` doing $variable will show the dir list)<br \/>\n.\u00a0 = dot will read and execute commands from a file, ( . .bashrc )<br \/>\n&amp;\u00a0 = and. as suffix to executed file makes it go to the background(.\/program &amp;)<br \/>\n0&gt; = stdin stream director (I never seen this used in any script)<br \/>\n1&gt; = stdout stream director (standard output)<br \/>\n2&gt; = stderr stream director (standard error output)<br \/>\n%\u00a0 = job character, %1 = fg job 1, %2 = fg job 2, etc.<br \/>\n&gt;&gt; = stream director append to a file<br \/>\n&lt;&lt; = stdin stream director. (cat &gt; file &lt;&lt; EOF ; anything ; EOF)<br \/>\n&gt;\u00a0 = stream director that will start at the top of the file<br \/>\n\u00a0\u00a0\u00a0 (in if statements &lt; and &gt; may be used as greater-then<br \/>\n\u00a0\u00a0\u00a0 and lesser-then, as: if [ &#8220;$1&#8221; &gt;= &#8220;2&#8221; ])<br \/>\n\\\u00a0 = back-slash, takes away any special meaning with a character,<br \/>\n\u00a0\u00a0\u00a0\u00a0 \\$var will not be treated as a variable.<br \/>\n\u00a0\u00a0\u00a0\u00a0 (and a new line will not be treated as a new line)<br \/>\n\u00a0\u00a0\u00a0\u00a0 Also a \\ before a command, removes any alias on the command as: \\rm<br \/>\n&gt;&amp; = stream director to stream director, ie. echo &#8220;a&#8221; 1&gt;\/dev\/null 2&gt;&amp;1<br \/>\n\u00a0\u00a0\u00a0\u00a0 this directs 2&gt; to the same place as 1&gt;<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Here is the basic UNIX or rather Linux directory structur:<\/p>\n<p>\u00a0\u00a0\u00a0 \/ (system root)<br \/>\n\u00a0_______________________________|____________________________________<br \/>\n\u00a0|\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |\u00a0 |\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |<br \/>\nbin\/ boot\/ dev\/ etc\/ home\/ lib\/ lost+found\/ proc\/ root\/ sbin\/ usr\/ var\/<br \/>\n\u00a0|\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |<br \/>\n\u00a0|\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |-&gt; various<br \/>\n\u00a0|\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |<br \/>\n\u00a0|\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |-&gt; Read later..<br \/>\n\u00a0|\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0 |<br \/>\n\u00a0|\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0 |-&gt; Superuser Binarys<br \/>\n\u00a0|\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |<br \/>\n\u00a0|\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |-&gt; User roots home dir<br \/>\n\u00a0|\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |<br \/>\n\u00a0|\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |-&gt; system info etc.<br \/>\n\u00a0|\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |<br \/>\n\u00a0|\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |-&gt; Orphan files (look here after crashes)<br \/>\n\u00a0|\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |<br \/>\n\u00a0|\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |-&gt; System \/ programming librarys<br \/>\n\u00a0|\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |<br \/>\n\u00a0|\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |-&gt; Contains the user accounts home directorys<br \/>\n\u00a0|\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |<br \/>\n\u00a0|\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |-&gt; System configuration files.<br \/>\n\u00a0|\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |<br \/>\n\u00a0|\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |-&gt; Devices<br \/>\n\u00a0|\u00a0\u00a0\u00a0 |<br \/>\n\u00a0|\u00a0\u00a0\u00a0 |-&gt; The kernel and kernel maps.<br \/>\n\u00a0|<br \/>\n\u00a0|-&gt; Executeble files. (binarys)<\/p>\n<p>The \/usr directory contains a whole lot of things, mainly user accesseble<br \/>\nthings, like binarys in \/usr\/local\/bin\/ and \/usr\/bin\/ also librarys<br \/>\nin \/usr\/lib\/ and \/usr\/local\/lib\/.<br \/>\nThe kenrel source should also be under \/usr, in \/usr\/src\/linux\/<br \/>\nBut more about that later.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Here&#8217;s an example of the following files locations:<\/p>\n<p>\/dev\/null<br \/>\n\/dev\/fd0<br \/>\n\/etc\/passwd<br \/>\n\/home\/alien\/.profile<br \/>\n\/usr\/local\/bin\/BitchX<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/<br \/>\n\u00a0_______________________________|____________________________________<br \/>\n\u00a0|\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |<br \/>\nbin\/ boot\/ dev\/ etc\/ home\/ lib\/ lost+found\/ proc\/ root\/ sbin\/ usr\/ var\/<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0 alien\/\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 local\/<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |-&gt; .profile\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 |-&gt; passwd\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 bin\/<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |-&gt; null\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |-&gt; BitchX<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |-&gt; fd0<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>And a final example that&#8217;s a bit more stripped, just incase you are really<br \/>\nnew to computers.<br \/>\nHere following files locations:<\/p>\n<p>\/dev\/null<br \/>\n\/dev\/audio<br \/>\n\/dev\/hda1<br \/>\n\/etc\/passwd<br \/>\n\/etc\/shadow<br \/>\n\/home\/alien\/.profile<br \/>\n\/home\/alien\/tmp\/somefile<br \/>\n\/home\/user\/.bash_profile<br \/>\n\/usr\/local\/bin\/BitchX<br \/>\n\/sbin\/shutdown<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/<br \/>\n\u00a0 _____________________________|_____________________________<br \/>\n\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |<br \/>\n\u00a0dev\/\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 etc\/\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 home\/&#8212;&#8211;\u00a0\u00a0\u00a0 usr\/\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 sbin\/<br \/>\n\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |<br \/>\n\u00a0 |-&gt; null\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0 local\/\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |-&gt; shutdown<br \/>\n\u00a0 |-&gt; audio\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |<br \/>\n\u00a0 |-&gt; hda1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0 bin\/<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |-&gt; passwd\u00a0 alien\/\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 |<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |-&gt; shadow\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0 user\/\u00a0 |-&gt; BitchX<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0 |<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\u00a0\u00a0\u00a0\u00a0\u00a0 |-&gt; .bash_profile<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |-&gt; .profile<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 tmp\/<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |-&gt; somefile<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>This is the same structure as on any Operating System that uses directorys,<br \/>\nThough some Operating Systems may call the \/ directory C: and some other<br \/>\nmay call it HD etc.<br \/>\nand ofcorse some of the directory names in Linux\/UNIX are UNIX specific.<\/p>\n<p>No further explanation should be nessesary.<\/p>\n<p>After reading this tutorial, brows around the system and try to learn<br \/>\nwhat all the files does, just dont remove any files you didnt put there<br \/>\nuntil your ABSOLUTLEY sure of what you are doing.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Here&#8217;s a few UNIX commands just for illustration:<\/p>\n<p>echo<br \/>\n======<br \/>\n\u00a0echo will *echo* anything you add to it like this:<\/p>\n<p>\u00a0alien:~$ echo &#8220;blah&#8221;<br \/>\n\u00a0blah<br \/>\n\u00a0alien:~$<\/p>\n<p>\u00a0To get it to echo without a new line add the suffix -n<br \/>\n\u00a0like this:<\/p>\n<p>\u00a0alien:~$ echo -n &#8220;blah &#8221;<br \/>\n\u00a0blah alien:~$<\/p>\n<p>\u00a0I&#8217;ll get back to why you want to do &#8220;-n&#8221; sometimes in a while.<\/p>\n<p>read<br \/>\n======<br \/>\n\u00a0read will read from the keyboard (stdin) and save it as a variable<br \/>\n\u00a0the variable name goes after the read command, like this:<\/p>\n<p>\u00a0alien:~$ read myvar<br \/>\n\u00a0&lt;here I type say &#8220;blah&#8221;&gt;<br \/>\n\u00a0alien:~$ echo $myvar<br \/>\n\u00a0blah<br \/>\n\u00a0alien:~$<\/p>\n<p>\u00a0To combine these two commands (echo and read) in a small script<br \/>\n\u00a0line, it can look like this:<\/p>\n<p>\u00a0alien:~$ echo -n &#8220;password: &#8221; ; read pass ; echo &#8220;Your pass is $pass&#8221;<br \/>\n\u00a0password: &lt;here I type &#8220;mypass&#8221;&gt;<br \/>\n\u00a0Your pass is mypass<br \/>\n\u00a0alien:~$<\/p>\n<p>\u00a0Get the basic idea ?<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Anyway, here are some commands that you should know before moving on with this<br \/>\ntutorial &#8211;<br \/>\n[*] after == important to know.<br \/>\n[X] after == very basics will do.<\/p>\n<p>ls [*]\u00a0\u00a0\u00a0\u00a0 Ex: ls -la\u00a0 Long directory listing.<br \/>\necho [*] Ex: echo &#8220;foo&#8221;\u00a0 Does what it says.<br \/>\ncat [*] Ex: cat \/etc\/passwd Dump out the content of a file.<br \/>\nless [X] Ex: less \/etc\/passwd Scroll up and down in a file (q = exit)<br \/>\nhead [X] Ex: head -5 \/etc\/passwd Get the 5 (-5) first lines of a file.<br \/>\ntail [X] Ex: tail -7 \/etc\/passwd Get the 7 (-7) last lines of a file.<br \/>\ngrep [*] Ex: grep x \/etc\/issue\u00a0\u00a0 Dump lines containing x from \/etc\/issue<br \/>\nchmod [*] Ex: chmod a+x file Give everyone executable rights to file<br \/>\nchown [X] Ex: chown root file Change owner of file to root.<\/p>\n<p>(cd\u00a0\u00a0\u00a0\u00a0 [-]\u00a0\u00a0\u00a0\u00a0 Ex: cd \/etc\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Change Directory to \/etc)<\/p>\n<p>Some applications you need to know how to operate (basics will do) :<\/p>\n<p>any text editor (preferably emacs or vi &#8211; they are explaind last in this file)<br \/>\ntelnet\u00a0 Ex: telnet 127.0.0.1 Opens a connection to IP 127.0.0.1<br \/>\nlynx\u00a0 Ex: lynx <a href=\"http:\/\/foo.bar\">http:\/\/foo.bar<\/a> A command line based web browser.<br \/>\nftp (ncftp) Ex: ncftp <a href=\"ftp:\/\/foo.bar\">ftp:\/\/foo.bar<\/a> A command line based ftp client.<br \/>\nssh\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Ex: ssh 127.0.0.1 Opens a secure connection to 127.0.0.1<\/p>\n<p>These are all explained fully later in this tutorial.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Now don&#8217;t sit there and ask yourself how&#8217;s going to teach you the commands<br \/>\nor applications I just listed here above. use the manual pages.<br \/>\nlike this:<\/p>\n<p>man echo<\/p>\n<p>that will get you the full manual on the command echo \ud83d\ude42<br \/>\nman works the same way with applications that you have the manual pages for.<\/p>\n<p>To get out of the manual page just press the letter &#8220;q&#8221;.<br \/>\n&#8220;q&#8221; quits it and bet&#8217;s you back to the command line prompt.<br \/>\nman uses all the normal &#8220;less&#8221; commands.<\/p>\n<p>Or read further down in this tutorial in the basic Linux\/UNIX commands and<br \/>\noperations section (8).<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>The key to shell scripting just as with any programming language\/Operating<br \/>\nSystem is to REALLY understand what you are doing, so do read this file<br \/>\nmore then once, and don&#8217;t read it to fast.<br \/>\nTake your time and let it sink in, so you know what it&#8217;s all about,<br \/>\nand do take time to read manual pages and do some playing with the commands<br \/>\nso you learn them.<\/p>\n<p>Now that should be enough of what you *should* know before starting to learn<br \/>\nUNIX shell scripting.<\/p>\n<p>So here we go&#8230;&#8230;.<\/p>\n<p>===============================================================================<br \/>\n2 &#8211; Where to start<br \/>\n===============================================================================<\/p>\n<p>You should always start with very simple scripts that you really don&#8217;t have<br \/>\nany practical use for but still *could* be of practical use =)<\/p>\n<p>As for first let&#8217;s make what we already know to a *real* executable script.<br \/>\nOpen a text editor (name the file myscript.sh) and type this:<\/p>\n<p>#!\/bin\/bash<\/p>\n<p>echo -n &#8220;password: &#8221;<br \/>\nread pass<br \/>\necho &#8220;Your pass is $pass&#8221;<\/p>\n<p>save &amp; exit &#8212; then do this command: chmod u+x myscript.sh<br \/>\nThen we can execute it:<\/p>\n<p>\u00a0alien:~$ .\/myscript.sh<br \/>\n\u00a0password: &lt;type what you want&gt;<br \/>\n\u00a0Your pass is &lt;what you typed&gt;<br \/>\n\u00a0alien:~$<\/p>\n<p>The &#8220;#!\/bin\/bash&#8221; at the start of the file is to let the script know what<br \/>\nshell type it should use.<\/p>\n<p>The &#8220;chmod u+x myscript.sh&#8221; is to make it executable.<br \/>\n(change-mode user+execute-right-on myscript.sh) &#8230;.. read the manual pages<br \/>\non chmod for more info on it =)<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Take alot of time to play around in your system, open files, figure out<br \/>\nwhat they do (but don&#8217;t edit or remove them).<\/p>\n<p>Take time also to learn some good text editor, that&#8217;s important.<br \/>\nLearn, emacs or vi, those are by most people considerd the absolutly best,<br \/>\nbut jed, joe, elvis, pico or any simple editor like that will do<br \/>\njust fine for now.<\/p>\n<p>emacs and vi are explained later in this tutorial.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Another thing before moving on is that you can export a variable from a<br \/>\nscript.<\/p>\n<p>Say that you have the variable &#8220;$var&#8221; in a script and want to export<br \/>\nit to the system for use with some other script or something, you can<br \/>\ndo: export var<\/p>\n<p>Like this little script:<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>#!\/bin\/bash<\/p>\n<p>VAR=&#8221;10&#8243;<br \/>\nexport VAR<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Note: VAR=&#8221;10&#8243; can not be written as VAR = &#8220;10&#8221;, since it&#8217;s<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 &#8216;whitespace-sensetive&#8217;.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>But more to how to make scripts in a second, I just thought that this would<br \/>\nbe a good time to enlighten you about this.<\/p>\n<p>So here we go &#8230;.<\/p>\n<p>===============================================================================<br \/>\n3 &#8211; Beginning techniques.<br \/>\n===============================================================================<\/p>\n<p>First off I&#8217;m going to show how to count in bash or how to use your command<br \/>\nline as a calculator, which is really easy and useful.<\/p>\n<p>alien:~$ echo $[ 4 * 2 ]<br \/>\n8<br \/>\nalien:~$<\/p>\n<p>or another example:<\/p>\n<p>alien:~$ echo $[ 10 + 5 ]<br \/>\n15<br \/>\nalien:~$<\/p>\n<p>Easy ? &#8230;. I think it is =)<\/p>\n<p>The internal calculator can also be used like this:<\/p>\n<p>alien:~$ echo $(( 10 + 5 ))<br \/>\n15<br \/>\nalien:~$<\/p>\n<p>The second way of using the internal shell calculator is here just<br \/>\nso you dont get confused if you see it used that way sometime.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Now I&#8217;d like to show the *string comparing* with &#8220;if&#8221; statements,<br \/>\nwhich can be a little hard at first contact, but as soon as you get<br \/>\nfamiliar with it, it wont be any problems.<br \/>\nSo here&#8217;s an example.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>#!\/bin\/bash<\/p>\n<p>echo -n &#8220;enter a name: &#8221;<br \/>\nread var1<br \/>\necho -n &#8220;enter another name: &#8221;<br \/>\nread var2<\/p>\n<p>if [ &#8220;$var1&#8221; = &#8220;$var2&#8221; ]; then<br \/>\necho &#8220;The names are the same&#8221;<br \/>\nelse<br \/>\necho &#8220;The names were not the same&#8221;<br \/>\nfi<\/p>\n<p>exit 0<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Note: &#8220;fi&#8221; is the ending of if, just like a &#8220;}&#8221; is the ending of a &#8220;{&#8220;,<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 exit 0 terminates the script correctly and returns you to the prompt.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Another note is that instead of &#8216;=&#8217; you can use &#8216;-eq&#8217; to test if<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 2 expressions are equal, or &#8216;-eg&#8217; to check if 2 integers are equal, etc.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 It should also be said that a variable say &#8216;$var&#8217; can be written<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 as this: ${var}, just so you know if you see it done that way<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 in some scripts, but here we will use the $var way.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>This example if executed looks like this:<\/p>\n<p>(Matching names)<\/p>\n<p>alien:~$ .\/script1.sh<br \/>\nenter a name: smurf<br \/>\nenter another name: smurf<br \/>\nThe names are the same<br \/>\nalien:~$<\/p>\n<p>(Non-matching names)<\/p>\n<p>alien:~$ .\/script1.sh<br \/>\nenter a name: smurf<br \/>\nenter another name: guru<br \/>\nThe names were not the same<br \/>\nalien:~$<\/p>\n<p>You can compare any 2 strings with this, as this *mid script example*:<\/p>\n<p>&#8230;<br \/>\nif [ &#8220;$user&#8221; = &#8220;gnu&#8221; ]; then<br \/>\necho &#8220;Hello user gnu !&#8221;<br \/>\nelse<br \/>\necho &#8220;I don&#8217;t know you.&#8221;<br \/>\nfi<br \/>\n&#8230;<\/p>\n<p>This compares a variable with a static string which you can set to anything.<br \/>\nYou can also do this the other way around.<\/p>\n<p>&#8230;<br \/>\nif [ &#8220;$user&#8221; != &#8220;gnu&#8221; ]; then<br \/>\necho &#8220;I don&#8217;t know you.&#8221;<br \/>\nelse<br \/>\necho &#8220;Hello user gnu !&#8221;<br \/>\nfi<br \/>\n&#8230;<\/p>\n<p>The &#8216;!=&#8217; means NOT-IS, in clear text if the 2 strings are not a match.<br \/>\nAs the above example in straight English:<\/p>\n<p>&#8230;<br \/>\nif the variable don&#8217;t match the word gnu, then<br \/>\nsay &#8220;I don&#8217;t know you.&#8221;<br \/>\nin other cases<br \/>\nsay &#8220;Hello user gnu !&#8221;<br \/>\n&#8230;<\/p>\n<p>If you think that a variable may not contain anything and you wanna avoid<br \/>\nit showing you errors you can add an x as the first character to both<br \/>\nthe statements to test with if, like this to compare $one with -x:<\/p>\n<p>&#8230;<br \/>\nif [ &#8220;x$one&#8221; = &#8220;x-x&#8221; ]; then<br \/>\necho &#8220;$one is -x&#8221;<br \/>\nelse<br \/>\necho &#8220;$one is not -x&#8221;<br \/>\nfi<br \/>\n&#8230;<\/p>\n<p>In plain english:<\/p>\n<p>&#8230;<br \/>\nif (contents of $one) equals -x (supress error messages if any), then<br \/>\nsay (contents of $one) is -x<br \/>\nin other cases<br \/>\nsay (contents of $one) is not -x<br \/>\n&#8230;<\/p>\n<p>This previous way is actually quite old, and only a precaution, say this:<\/p>\n<p>&#8230;<br \/>\necho -n &#8220;enter a number: &#8221;<br \/>\nread foo<br \/>\nif [ $foo = 2 ]; then<br \/>\necho ok foo<br \/>\nfi<br \/>\n&#8230;<\/p>\n<p>Now, if you with this example dont enter any number there will be nothing<br \/>\nthere for if to compare with, not even a blank &#8220;&#8221;, since we&#8217;re not<br \/>\nusing quotes, but as this:<\/p>\n<p>&#8230;<br \/>\necho -n &#8220;enter a number: &#8221;<br \/>\nread foo<br \/>\nif [ x$foo = x2 ]; then<br \/>\necho ok foo<br \/>\nfi<br \/>\n&#8230;<\/p>\n<p>There will always be something, because if $foo is nothing there is<br \/>\nstill x.<br \/>\nJust read acouple of times and you&#8217;ll get it.<\/p>\n<p>You can also test if a variable contains anyting at all like this:<\/p>\n<p>&#8230;<br \/>\necho -n &#8220;enter a number: &#8221;<br \/>\nread foo<br \/>\n[ -n $foo ] &amp;&amp;<br \/>\necho ok foo<br \/>\n&#8230;<\/p>\n<p>This uses the same options as the test command, so &#8220;-z&#8221; will return true<br \/>\nif the variable is empty, &#8220;-z&#8221; will return true if the variable is not<br \/>\nempty etc, it&#8217;s ok if you dont understand this right now &#8230;.<br \/>\nI&#8217;ve added this for the second time readers.<\/p>\n<p>You can also test if a command turns out as true, like this:<\/p>\n<p>&#8230;<br \/>\nif echo &#8220;foo&#8221; &gt;\/dev\/null; then<br \/>\necho &#8220;foo&#8221;<br \/>\nelse<br \/>\necho &#8220;bar&#8221;<br \/>\nfi<br \/>\n&#8230;<\/p>\n<p>Here if will check if foo echos to \/dev\/null, and if so, then it will<br \/>\nprint out &#8220;foo&#8221; and if foo didnt echo to \/dev\/null, it&#8217;ll print out<br \/>\nthe word &#8220;bar&#8221;<\/p>\n<p>Anoter and perhaps *cleaner* way of doing the same is this:<\/p>\n<p>&#8230;<br \/>\nif (echo &#8220;foo&#8221; &gt;\/dev\/null); then<br \/>\necho &#8220;foo&#8221;<br \/>\nelse<br \/>\necho &#8220;bar&#8221;<br \/>\nfi<br \/>\n&#8230;<\/p>\n<p>It&#8217;s the exact same thing but with parenthases around the command,<br \/>\nit looks much cleaner &#8230; and so the code is easyer to follow.<\/p>\n<p>You can also make if think &#8216;if this is a match or that is a match&#8217;, like<br \/>\nif the variable is one of two options do one thing else do another.<br \/>\nLike this:<\/p>\n<p>&#8230;<br \/>\nif [ &#8220;$user&#8221; = &#8220;gnu&#8221; -o &#8220;$user&#8221; = &#8220;ung&#8221; ]; then<br \/>\necho &#8220;Hello $user !&#8221;<br \/>\nelse<br \/>\necho &#8220;I never heard of $user&#8230;&#8221;<br \/>\nfi<br \/>\n&#8230;<\/p>\n<p>The &#8216;-o&#8217; means OR in an if statement, so here is the example in plain english:<\/p>\n<p>&#8230;<br \/>\nif the variable matches the word gnu or matches the word ung, then<br \/>\nsay Hello word ! (the word is the variable, now gnu or ung)<br \/>\nin other cases<br \/>\nsay &#8220;I never heard of word&#8230; (the word is whatever the variable is set to)<br \/>\n&#8230;<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Note: The quotes are needed in an if statement in case the strings or<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 variables it&#8217;s suppse to compare is empty, since<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 if [ foo =\u00a0 ]; then<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 would produse a syntax error, but<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 if [ &#8220;foo&#8221; = &#8220;&#8221; ]; then<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 would not.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>The &#8216;-o&#8217; can also be made with &#8216;] || [&#8216;, so that:<br \/>\nif [ &#8220;$user&#8221; = &#8220;gnu&#8221; -o &#8220;$user&#8221; = &#8220;ung&#8221; ]; then<br \/>\ncan also be expressed as this:<br \/>\nif [ &#8220;$user&#8221; = &#8220;gnu&#8221; ] || [ &#8220;$user&#8221; = &#8220;ung&#8221; ]; then<br \/>\nYou dont really need to remember that, but for the knowlidge I desided<br \/>\nto make a note out of that anyway, mostly for the more experianced readers<br \/>\nof this tutuorial, and for the readers that have read it several times.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>You can also set static text in a variable, which is really easy:<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>#!\/bin\/bash<\/p>\n<p>anyvar=&#8221;hello world&#8221;<\/p>\n<p>echo &#8220;$anyvar&#8221;<\/p>\n<p>exit 0<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Which executed would look like this:<\/p>\n<p>alien:~$ .\/myscript<br \/>\nhello world<br \/>\nalien:~$<\/p>\n<p>Easy enough ? =)<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Now let&#8217;s move on to &#8220;for&#8221; and common for-loops.<br \/>\nI am actually only going to show one sort of for-loop example, of the reason that<br \/>\nat this stage no more is needed, and would only confuse.<br \/>\nas a note, for loops-can be uses (as soon shown) to import strings<br \/>\nfrom a file to be used as variables in the script.<\/p>\n<p>Now, here&#8217;s the example:<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>#!\/bin\/bash<\/p>\n<p>for VAR in `cat list.txt`; do<br \/>\necho &#8220;$VAR was found in list.txt&#8221;<br \/>\ndone<\/p>\n<p>exit 0<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Note: &#8220;done&#8221; terminates the loop when finished.<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 &#8220;in&#8221; and &#8220;do&#8221; are like bash *grammar*, I&#8217;ll explain that later.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0 The `cat list.txt` part, the `s around the command will make sure<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 the script\/line executes that part as a command, another way of<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 doing this is to: $(cat list.txt)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 which has the same effect.<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 That&#8217;s just a note so you wont get confused if you see it used<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 that way some time.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>The previous script example is dependent on that there is a file called<br \/>\n&#8220;list.txt&#8221;, so let&#8217;s make such, and fill it with something like this:<\/p>\n<p>list.txt<\/p>\n<p>123<br \/>\n234<br \/>\n345<br \/>\n456<br \/>\n567<br \/>\n678<br \/>\n789<br \/>\n890<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Then the executed script would look like this:<\/p>\n<p>alien:~$ .\/script2.sh<br \/>\n123 was found in list.txt<br \/>\n234 was found in list.txt<br \/>\n345 was found in list.txt<br \/>\n456 was found in list.txt<br \/>\n567 was found in list.txt<br \/>\n678 was found in list.txt<br \/>\n789 was found in list.txt<br \/>\n890 was found in list.txt<br \/>\nalien:~$<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Note: A space in a file read by a for-loop is taken the same way as a new line.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Here is another example, with a for-loop with an if statement:<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>#!\/bin\/bash<\/p>\n<p>for VAR3 in `cat list.txt`; do<br \/>\nif [ &#8220;$VAR3&#8221; = &#8220;789&#8221; ]; then<br \/>\necho<br \/>\necho &#8220;Match was found ($VAR)&#8221;<br \/>\necho<br \/>\nfi<br \/>\ndone<\/p>\n<p>exit 0<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>And executed that looks like this:<\/p>\n<p>alien:~$ .\/script3.sh<\/p>\n<p>Match was found (789)<\/p>\n<p>alien:~$<\/p>\n<p>If you have read this in a calm fashion it should be quite clear to you<br \/>\nso far, but before I move on to real practice examples I will explain<br \/>\nthe while-loop, and some, more which can be used as to count and more,<br \/>\nfor various purposes, as you will see.<br \/>\nYou don&#8217;t have to *understand* all of how this works, but you should<br \/>\nat least learn it.<\/p>\n<p>So here we go on an example with &#8220;while&#8221;:<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>#!\/bin\/bash<\/p>\n<p>count=&#8221;0&#8243;<br \/>\nmax=&#8221;10&#8243;<\/p>\n<p>while [ $count != $max ]; do count=`expr $count + 1`<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 echo &#8220;We are now at number: $count&#8221;<br \/>\ndone<\/p>\n<p>exit 0<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Note: expr is a calculator command, you can read more about it later in<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 this tutorial.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>This in plain English reads the following:<\/p>\n<p>make variable &#8220;count&#8221; hold the number 0<br \/>\nmake variable &#8220;max&#8221; hold the number 10<\/p>\n<p>while 0 is not 10, do add 1 to 0 (each loop until it is 10)<br \/>\nsay &#8220;We are now at number: $count&#8221; (each time 1 is added as long as we are<br \/>\nin the loop)<br \/>\nend the loop<br \/>\nreturn to the prompt command line.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Which executed looks like, (you guessed it), this:<\/p>\n<p>alien:~$ .\/count.sh<br \/>\nWe are now at number: 1<br \/>\nWe are now at number: 2<br \/>\nWe are now at number: 3<br \/>\nWe are now at number: 4<br \/>\nWe are now at number: 5<br \/>\nWe are now at number: 6<br \/>\nWe are now at number: 7<br \/>\nWe are now at number: 8<br \/>\nWe are now at number: 9<br \/>\nWe are now at number: 10<br \/>\nalien:~$<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Here is another example of a while loop.<\/p>\n<p>#!\/bin\/bash<\/p>\n<p>agreement=<br \/>\nwhile [ x$agreement = x ]; do<br \/>\n\u00a0\u00a0\u00a0 echo<br \/>\n\u00a0\u00a0\u00a0 echo -n &#8220;Do you agree with this ? [yes or no]: &#8221;<br \/>\n\u00a0\u00a0\u00a0 read yesnoanswer<br \/>\n\u00a0\u00a0\u00a0 case $yesnoanswer in<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 y* | Y*)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 agreement=1<br \/>\n\u00a0 ;;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 n* | n*)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 echo &#8220;If you don&#8217;t agree, you can&#8217;t install this sofware&#8221;;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 echo<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 exit 1<br \/>\n\u00a0 ;;<br \/>\n\u00a0\u00a0\u00a0 esac<br \/>\ndone<\/p>\n<p>echo &#8220;agreed&#8221;<br \/>\necho<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>This in plain English reads the following:<\/p>\n<p>Make an unknown variable named agreement<br \/>\nwhile the unknown variable is unknown and doesnt match the case,<br \/>\nsay &#8220;Do you agree with this ? [yes or no]: &#8221;<br \/>\nread the the answer into the &#8220;yesnoanswer&#8221; variable.<br \/>\nmake a case and check the &#8220;yesnoanswer&#8221; variable for any words beginning<br \/>\nwith y or Y, and if so, skip the rest and go on with the script<br \/>\nand say &#8220;agreed&#8221;.<br \/>\nif it doesnt begin with y or Y, check if it starts with n or N.<br \/>\nIf it does start with a n or N, then say:<br \/>\n&#8220;If you don&#8217;t agree, you can&#8217;t install this sofware&#8221;<br \/>\nand quit the script.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Which executed looks like this:<\/p>\n<p>alien:~$ .\/agree.sh<\/p>\n<p>Do you agree with this ? [yes or no]: something<\/p>\n<p>Do you agree with this ? [yes or no]: yes<br \/>\nagreed<\/p>\n<p>Again executed, but with &#8216;no&#8217; as answer:<\/p>\n<p>alien:~$ .\/agree.sh<\/p>\n<p>Do you agree with this ? [yes or no]: nothing<br \/>\nIf you don&#8217;t agree, you can&#8217;t install this sofware<\/p>\n<p>alien:~$<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Note that &#8220;nothing&#8221; begins with &#8216;n&#8217; and therfor matches what the script is<br \/>\nlooking for, y or Y, and n or N.<\/p>\n<p>Also see later in the tutorial about `case` statements.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Now I&#8217;m going to explain shortly about functions in bash.<\/p>\n<p>A function is like a script within the script, or you could say that<br \/>\nyou make your own little command that can be used in a script.<br \/>\nIt&#8217;s not as hard as it sounds though.<\/p>\n<p>So here we go on a example:<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>#!\/bin\/bash<\/p>\n<p>function myfunk {<br \/>\necho<br \/>\necho &#8220;hello&#8221;<br \/>\necho &#8220;this is my function&#8221;<br \/>\necho &#8220;which I will display twice&#8221;<br \/>\n}<\/p>\n<p>myfunk<br \/>\nmyfunk<\/p>\n<p>exit 0<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Which executed looks like this:<\/p>\n<p>alien:~$ .\/funk.sh<\/p>\n<p>hello<br \/>\nthis is my function<br \/>\nwhich I will display twice<\/p>\n<p>hello<br \/>\nthis is my function<br \/>\nwhich I will display twice<br \/>\nalien:~$<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Another example of functions can look like this:<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>#!\/bin\/bash<\/p>\n<p>myvar=&#8221;$1&#8243;<br \/>\nvar2=&#8221;$2&#8243;<\/p>\n<p>if [ &#8220;$myvar&#8221; = &#8220;&#8221; ]; then<br \/>\necho &#8220;Usage: $0 &lt;integer&gt; &lt;integer&gt;&#8221;<br \/>\nexit 0<br \/>\nfi<\/p>\n<p>function myfunk {<br \/>\nexpr $1 + $2<br \/>\n}<\/p>\n<p>myfunk $myvar $var2<\/p>\n<p>exit 0<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Which executed looks like this:<\/p>\n<p>Without any arguments:<\/p>\n<p>alien:~$ .\/funk.sh<br \/>\nUsage: .\/funk.sh &lt;integer&gt; &lt;integer&gt;<\/p>\n<p>With arguments:<\/p>\n<p>alien:~$ .\/funk.sh 12 3<br \/>\n15<br \/>\nalien:~$<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>Note: the $1 and $2 in the function is infact the first and second argument<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 supplied after the function name when it&#8217;s called for within the script,<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 so you could say that a function is like a separate scrip in<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 the main script.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>Yet another example of a function is this:<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>#!\/bin\/bash<\/p>\n<p>myvar=&#8221;$1&#8243;<\/p>\n<p>if [ &#8220;$myvar&#8221; = &#8220;&#8221; ]; then<br \/>\necho &#8220;Usage: $0 &lt;number&gt;&#8221;<br \/>\nexit 0<br \/>\nfi<\/p>\n<p>function calcfunc { expr 12 + $1 ; }<\/p>\n<p>myvar2=`calcfunc 5`<\/p>\n<p>echo &#8220;welcome&#8221;<br \/>\necho &#8220;Now we will calculate 12 + 5 * $myvar&#8221;<\/p>\n<p>echo &#8220;the answer is `expr $myvar2 &#8216;*&#8217; $myvar`&#8221;<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Which executed looks like this:<\/p>\n<p>Without any arguments:<\/p>\n<p>alien:~$ .\/funk.sh<br \/>\nUsage: .\/funk.sh &lt;number&gt;<br \/>\nalien:~$<\/p>\n<p>And with arguments:<\/p>\n<p>alien:~$ .\/funk.sh 23<br \/>\nwelcome<br \/>\nNow we will calculate 12 + 5 * 23<br \/>\nthe answer is 391<br \/>\nalien:~$<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>And for the sake of knowlidge it should also be said that a function can be<br \/>\ndeclared in the following ways aswell:<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>#!\/bin\/bash<\/p>\n<p>function foo() {<br \/>\necho &#8220;hello world&#8221;<br \/>\n}<\/p>\n<p>foo<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>#!\/bin\/bash<\/p>\n<p>foo () {<br \/>\necho &#8220;hello world&#8221;<br \/>\n}<\/p>\n<p>foo<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>Note that the paranteses after the funtion name are the new thing here.<br \/>\nIt&#8217;s used exactly the same way as without the paranteses, I just<br \/>\nadded that here so that you wont get confused if you see it made that<br \/>\nway sometime.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>So if you make a function, to call for it (to make use of it), just use the<br \/>\nthe functions name just as if it had been a command.<\/p>\n<p>If there is anything that&#8217;s uncertain at this point, go back and read it again,<br \/>\nuntil you understand it, or at least get the basic idea. =)<\/p>\n<p>===============================================================================<br \/>\n3 &#8211; Other techniques.<br \/>\n===============================================================================<\/p>\n<p>Now let&#8217;s move on to a little bit more advanced shell scripting.<br \/>\nActually it&#8217;s not that advanced, just more hard to keep in order, but let us<br \/>\nleave that to the head of the beholder&#8230;.. errr<br \/>\nAnyway, let&#8217;s not make this harder then it is, so here we go, with a script<br \/>\nexample:<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\n#!\/bin\/bash<\/p>\n<p>&gt; file1.c<\/p>\n<p>cat &gt;&gt; file1.c &lt;&lt; EOF<br \/>\n#include &lt;stdio.h&gt;<br \/>\nint main ( void )<br \/>\n{<br \/>\n\u00a0 printf(&#8220;Hello world\\n&#8221;);<br \/>\n\u00a0 return 0;<br \/>\n}<br \/>\nEOF<\/p>\n<p>cc file1.c -o file1 || gcc -o file1 file1.c<br \/>\n.\/file1<\/p>\n<p>rm -f file1.c file1<\/p>\n<p>exit 0<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>And here as follows, is an semi-english translation of the script:<\/p>\n<p>echo nothing to file1.c to create it.<\/p>\n<p>cat to file1.c what comes here after in between the &#8220;EOF&#8221;&#8216;s<br \/>\n\/\/ &#8212; a short hello world program in C code &#8212; \/\/<\/p>\n<p>try if there is a &#8216;cc&#8217;, if not then use &#8216;gcc&#8217;<br \/>\nExecute the newly compiled file<\/p>\n<p>remove file1.c and file1<\/p>\n<p>exit the script.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>This can be very useful, since bash do have it&#8217;s limitations, so if you<br \/>\never need something more powerful or just something else, you can always<br \/>\ndo like the script told.<\/p>\n<p>Another little trick with the same thing in a script is:<\/p>\n<p>more &lt;&lt; EOF<br \/>\nHere you can type whatever,<br \/>\nlike an agreement text or something.<br \/>\nEOF<\/p>\n<p>Play around with it.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Here let&#8217;s have a look at the &#8220;case&#8221; command, case is like &#8220;if&#8221; ended<br \/>\nwith it self backwards.<br \/>\nSo that what starts with &#8220;case&#8221; ends with &#8220;esac&#8221;, here&#8217;s an example of &#8220;case&#8221;:<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>#!\/bin\/bash<\/p>\n<p>case &#8220;$1&#8221; in<br \/>\n\u00a0\u00a0\u00a0 foo)<br \/>\n\u00a0\u00a0\u00a0 echo &#8220;foo was written&#8221;<br \/>\n\u00a0\u00a0\u00a0 ;;<br \/>\n\u00a0\u00a0\u00a0 bar)<br \/>\n\u00a0\u00a0\u00a0 echo &#8220;bar was written&#8221;<br \/>\n\u00a0\u00a0\u00a0 ;;<br \/>\n\u00a0\u00a0\u00a0 something-else)<br \/>\n\u00a0\u00a0\u00a0 echo &#8220;something-else was written&#8221;<br \/>\n\u00a0\u00a0\u00a0 ;;<br \/>\nesac<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>This is the same as saying:<\/p>\n<p>&#8230;.<br \/>\nif [ &#8220;$1&#8221; = &#8220;foo&#8221; ];then<br \/>\necho &#8220;foo written&#8221;<br \/>\nfi<br \/>\nif [ &#8220;$1&#8221; = &#8220;bar&#8221; ];then<br \/>\necho &#8220;bar was written&#8221;<br \/>\nfi<\/p>\n<p>etc.<br \/>\n&#8230;.<\/p>\n<p>so case is far shorter if you have alot of arguments.<\/p>\n<p>Here&#8217;s a better example:<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\n#!\/bin\/bash<\/p>\n<p>case &#8220;$1&#8221; in<br \/>\n\u00a0\u00a0\u00a0 &#8211;help)<br \/>\n\u00a0\u00a0\u00a0 echo &#8220;Usage: $0 [&#8211;help] [&#8211;port &lt;port&gt;] &lt;host&gt; [&#8211;time]&#8221;<br \/>\n\u00a0\u00a0\u00a0 ;;<br \/>\n\u00a0\u00a0\u00a0 &#8211;port)<br \/>\n\u00a0\u00a0\u00a0 telnet $3 $2<br \/>\n\u00a0\u00a0\u00a0 ;;<br \/>\n\u00a0\u00a0\u00a0 &#8211;time)<br \/>\n\u00a0\u00a0\u00a0 date<br \/>\n\u00a0\u00a0\u00a0 ;;<br \/>\nesac<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>This is not very hard to learn,<br \/>\ncase the first argument vector ($1) in<br \/>\nfirt-possible-match)<br \/>\nif it matches do &#8230;&#8230;..<br \/>\nclose the ) with ;;<br \/>\netc. down to &#8220;esac&#8221;<\/p>\n<p>Really not much more to say about the case command at this point.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Now let&#8217;s have a REALLY quick look at the command `sed`, which is used<br \/>\nto format text. say now that you have a file called &#8220;tmp&#8221; that<br \/>\ncontains the following:<\/p>\n<p><a href=\"http:\/\/www.metacrawler.com\">http:\/\/www.metacrawler.com<\/a><br \/>\n<a href=\"http:\/\/www.yahoo.com\">http:\/\/www.yahoo.com<\/a><br \/>\n<a href=\"http:\/\/www.webcrawler.com\">http:\/\/www.webcrawler.com<\/a><\/p>\n<p>and you want to change all the &#8220;www&#8221;&#8216;s to &#8220;ftp&#8221;, then you do like this:<\/p>\n<p>sed &#8216;s\/www\/ftp\/g&#8217; tmp<\/p>\n<p>and if you want to store the changes to a file you can do:<\/p>\n<p>sed &#8216;s\/www\/ftp\/g&#8217; tmp &gt; tmp2<\/p>\n<p>This is not sed&#8217;s only use, but for sure it&#8217;s what it&#8217;s most used for.<\/p>\n<p>Here&#8217;s just one other really simple thing sed could be used as:<\/p>\n<p>sed -n 3 p \/etc\/passwd<\/p>\n<p>This will print out the 3&#8217;d line of the \/etc\/passwd file.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Now let&#8217;s take up a really interesting command `dialog`, that is a command<br \/>\nwith which you can create ncurses dialog boxes.<br \/>\nNcurses dialog boxes are what one would call &#8216;console graphics&#8217; or<br \/>\n&#8216;ascii color graphics&#8217;, if you ever seen a blue background and a gray box<br \/>\nasking questions, with an &lt;OK&gt; and &lt;Cancel&gt; button, while running<br \/>\nsomething in a console you have seen an ncurses dialog box.<\/p>\n<p>Now here is a small script example of a dialog box:<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>#!\/bin\/bash<\/p>\n<p>dialog &#8211;backtitle &#8220;My first dialog&#8221; \\<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;title &#8220;Main menu&#8221; \\<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;menu &#8220;Make your choice&#8221; 13 60 6 \\<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1 &#8220;First option&#8221; \\<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 2 &#8220;Second option&#8221; \\<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 3 &#8220;Exit&#8221; 2&gt; .tempfile<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 output=`cat .tempfile`<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 rm -f .tempfile<\/p>\n<p>if [ &#8220;$output&#8221; = &#8220;1&#8221; ]; then<br \/>\ndialog &#8211;msgbox &#8220;First option was entered&#8221; 5 40<br \/>\nfi<\/p>\n<p>if [ &#8220;$output&#8221; = &#8220;2&#8221; ]; then<br \/>\ndialog &#8211;msgbox &#8220;Second option was entered&#8221; 5 40<br \/>\nfi<\/p>\n<p>exit 0<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Here is another very small example with dialog boxes:<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>#!\/bin\/bash<\/p>\n<p>dialog &#8211;yesno &#8220;Do you agree, jada jada&#8221; 10 50 &amp;&amp; \\<br \/>\ndialog &#8211;yesno &#8220;ok you agreed&#8221; 10 50 || \\<br \/>\ndialog &#8211;yesno &#8220;ok fine, leav then &#8230;&#8221; 10 50<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>If the first one (Do you agree, jada jada) returns &#8216;true&#8217; (yes)<br \/>\nthen it walks on to the next (ok you agreed),<br \/>\nand if any of those first two returns &#8216;false&#8217; (no) it will display<br \/>\nthe last (ok fine, leav then &#8230;).<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Notes: The back slashes &#8220;\\&#8221; are used to say &#8220;no new line&#8221; as in what comes<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 on the next line will be treated as if it were on the same line as<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 the last line, the &#8220;\\&#8221; really means that the next character&#8217;s<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (in this case the new lines) special meaning is overlocked.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Just in case you didnt understand, the numbers after, like 10 50:<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 dialog &#8211;yesno &#8220;ok fine, leav then &#8230;&#8221; 10 50<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 is the geometry of the window.<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 First number is height and the second width.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Another note being that the command `Xdialog` works the same as<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 dialog, but I wont take that up here because it doesn&#8217;t come as default<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 with any other Linux distribution then Mandrake, as far as I know.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 A final note is that the `dialog` command is getting to be out dated<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 but is still the most used, the newer version of it is named `whiptail`<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 and works the same as `dialog`, but looks slightly different.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Now we have covered most of it, so let&#8217;s take up some small tricks, that bash<br \/>\nallows you to do, here follows what it does, and then the code example:<\/p>\n<p>Here we wanna check if you have a directory called &#8220;\/usr\/local\/bin&#8221;:<\/p>\n<p>if [ -d \/usr\/local\/bin ]; then<br \/>\ncp file \/usr\/local\/bin\/<br \/>\nelse<br \/>\necho &#8220;NO !!&#8221;<br \/>\nfi<\/p>\n<p>Another way of doing the same thing is this:<\/p>\n<p>test -d \/usr\/local\/bin &amp;&amp; cp file \/usr\/local\/bin\/ || echo &#8220;NO !!&#8221;<\/p>\n<p>Or:<\/p>\n<p>ls \/usr\/local\/bin\/ &amp;&amp; cp file \/usr\/local\/bin\/ || echo &#8220;NO !!&#8221;<\/p>\n<p>The last way is a bit messy, but alot smaller then the first one,<br \/>\nbut here&#8217;s yet another way that&#8217;s small and less messy:<\/p>\n<p>ls \/usr\/local\/bin\/ 1&gt;\/dev\/null 2&gt;&amp;1 &amp;&amp; cp file \/usr\/local\/bin\/ || echo &#8220;NO !!&#8221;<\/p>\n<p>That might look really weird at first sight, but it&#8217;s easy if you break it<br \/>\ndown and look at it:<\/p>\n<p>ls \/usr\/local\/bin\/ &lt;&lt;==== lists \/usr\/local\/bin\/<br \/>\n1&gt;\/dev\/null\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;&lt;==== sends the contents of the listing to &#8216;the black hole&#8217;<br \/>\n2&gt;&amp;1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;&lt;==== sends any errors the same way&#8230; to &#8216;the black hole&#8217;<br \/>\n\u00a0\u00a0\u00a0\u00a0 (same thing as to say 2&gt;\/dev\/null)<br \/>\n&amp;&amp;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;&lt;==== if the first command worked, we will go on here.<br \/>\ncp file \/usr\/local\/bin\/\u00a0\u00a0 &lt;&lt;==== copy file to \/usr\/local\/bin\/<br \/>\n||\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;&lt;==== if the\u00a0 first command didn&#8217;t work&#8230;<br \/>\n\u00a0\u00a0\u00a0\u00a0 we go on here instead.<br \/>\necho &#8220;NO !!&#8221;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;&lt;==== what it says &#8230; say NO !!<\/p>\n<p>as this:<br \/>\nIf `ls` can list \/usr\/local\/bin\/ next command can be executed, OR if not<br \/>\nit will echo &#8220;NO !!&#8221;, and all listings\/errors are being sent to \/dev\/null<br \/>\nthe &#8216;black hole&#8217; of a UNIX\/Linux.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>To prevent that a script is being executed more the once at the same time<br \/>\nfor some reason you may wanna let the script make a &#8216;lock&#8217; file.<br \/>\nThis is very easy to do:<\/p>\n<p>#!\/bin\/bash<br \/>\nls script.lock 1&gt;\/dev\/null 2&gt;&amp;1 &amp;&amp; exit 0 &amp;&amp; echo &#8220;lockfile detected&#8221;<br \/>\n&gt; script.lock<br \/>\necho &#8220;Here is where the script should be&#8221;<br \/>\nrm -f script.lock<br \/>\nexit 0<\/p>\n<p>Here we first check if there is a lockfile, and if there is we terminate<br \/>\nthe script and say that a lockfile was detected.<br \/>\nIf there is no lockfile, we create one and start to execute the rest of the<br \/>\nscript.<br \/>\nAt the end of the script we remove the lockfile, so that the script can<br \/>\nbe executed again.<br \/>\nAll this is just to prevent the same script to be run twice at the same time,<br \/>\nwhich can be a good thing if your script does something that cant be done<br \/>\ntwice at the same time, as mounting a hard drive\/cd-rom, using sound or<br \/>\nanything like that.<\/p>\n<p>Another neat little trick is if you from within a script are going to<br \/>\ncreate temporary files that you want unique (to not overwrite some other<br \/>\nfiles anywhere, wherever the script may get executed) you can do like this:<\/p>\n<p>#!\/bin\/bash<br \/>\necho &#8220;ls&#8221; &gt;.tmp.$$<br \/>\necho &#8220;-la&#8221; &gt;.tmp2.$$<br \/>\none=`cat .tmp.$$`<br \/>\ntwo=`cat .tmp2.$$`<br \/>\n$one $two<br \/>\nrm -f .tmp.$$ .tmp2.$$<\/p>\n<p>This will make a file called .tmp.&lt;pid of script&gt; containing the word &#8220;ls&#8221;,<br \/>\nthen it will make a file called .tmp2.&lt;pid of script&gt; containing &#8220;-la&#8221;.<br \/>\nAfter that it make 2 variables, each one when being called will `cat` one<br \/>\nof the .tmp.* files each.<br \/>\nAt the end we have &#8220;$one $two&#8221; that will work the same as if we had printed:<\/p>\n<p>ls -la<\/p>\n<p>And last we remove the temporary files.<\/p>\n<p>This is useful if your doing a script that requires you to move around alot<br \/>\nof text from one file to another and back, as this example:<\/p>\n<p>#!\/bin\/bash<\/p>\n<p>sed &#8216;s\/www\/ftp\/g&#8217; tmp &gt; .tmp.$$<br \/>\nsed &#8216;s\/com\/org\/g&#8217; .tmp.$$ &gt; .tmp2.$$<br \/>\nsed &#8216;s\/ \/_\/g&#8217; .tmp2.$$ &gt; .tmp3.$$<br \/>\nmv -f .tmp3.$$ tmp<br \/>\nrm -f .tmp.$$ .tmp2.$$ .tmp3.$$<\/p>\n<p>exit 0<\/p>\n<p>Here we change all www&#8217;s in a file (tmp) to ftp, then we change all com&#8217;s<br \/>\nto org, and then all spaces to underscores.<br \/>\nAfter that we move the fully changed file so it overwrites the original file.<br \/>\nThen removing the temporary files and exit the script.<\/p>\n<p>If you have a good look at it, it&#8217;s really easy.<\/p>\n<p>Another nice trick is as I showed in the example prior to the last one:<\/p>\n<p>&#8230;<br \/>\none=`cat .tmp.$$`<br \/>\ntwo=`cat .tmp2.$$`<br \/>\n&#8230;<\/p>\n<p>That a variable can hold a command can prove to be useful, like this:<\/p>\n<p>#!\/bin\/bash<br \/>\ntime=`date +%H:%M:%S`<\/p>\n<p>echo &#8220;$time&#8221; &gt;&gt; log<br \/>\necho &#8220;some input to the log&#8221; &gt;&gt; log<br \/>\nsleep 60<br \/>\necho &#8220;$time&#8221; &gt;&gt; log<br \/>\necho &#8220;some input to the log a minute later&#8221; &gt;&gt; log<\/p>\n<p>exit 0<\/p>\n<p>But, it can hold more then just a command, it can actually *hold* the contents<br \/>\nof a whole file.<br \/>\nSay now that you made a script and have a pretty large readme file, and want<br \/>\nto display that as a &#8216;man page&#8217; to the script if the argument `&#8211;help`<br \/>\nis used to execute the script, then you can do like this:<\/p>\n<p>#!\/bin\/bash<br \/>\none=&#8221;$1&#8243;<br \/>\nhelp=`cat README`<\/p>\n<p>if [ &#8220;$one&#8221; = &#8220;&#8211;help&#8221; ]; then<br \/>\n$help | more<br \/>\n&#8230;<\/p>\n<p>Ofcorce it would be easier to say:<\/p>\n<p>#!\/bin\/bash<br \/>\nif [ &#8220;$?&#8221; = &#8220;&#8211;help&#8221; ]; then<br \/>\nmore README<br \/>\nfi<\/p>\n<p>But these examples are just here for illustration so you get the point<br \/>\nof usage for commands and so.<\/p>\n<p>Another trick is, if you wanna hide script\/program you can rename it to:<br \/>\n-bash, that way it will look as a normal bash running in the `ps`<br \/>\n(process list), you rename it by doing:<\/p>\n<p>mv script .\/-bash<\/p>\n<p>Then execute it like normal .\/-bash<\/p>\n<p>Yet another trick, is if you&#8217;re doing a script where you want each line<br \/>\nof a file as a variable, unlike for that takes each word as a variable.<br \/>\nThis can be done like this:<\/p>\n<p>#!\/bin\/bash<br \/>\nfile=&#8221;$1&#8243;<br \/>\nmin=&#8221;0&#8243;<br \/>\nmax=`cat $file | wc -l`<\/p>\n<p>if [ &#8220;$1&#8221; = &#8220;&#8221; ]; then<br \/>\necho &#8220;Usage: $0 &lt;file&gt;&#8221;<br \/>\nexit -1<br \/>\nfi<\/p>\n<p>while [ &#8220;$min&#8221; != &#8220;$max&#8221; ]; do min=`expr $min + 1`<br \/>\ncurline=`head -$min $file | tail -1`<br \/>\necho $curline<br \/>\ntest $min -eq $max &amp;&amp; exit 0<br \/>\ndone<\/p>\n<p>The `test` is there to make sure that it will end when $min and $max are the<br \/>\nsame.<br \/>\nNow this can be done with `for` if you change IFS (described later), but that<br \/>\nis not recomended, especially if you export IFS since that would change the<br \/>\nenviorment and hence screw with the system scripts if they were to be runned<br \/>\nbefore changing IFS back to normal, but enough about that now, just keep<br \/>\nit somewhere far back in your head, dont change IFS unless you know what<br \/>\nyou&#8217;re doing.<\/p>\n<p>If you dont understand this little script at this point, dont worry, you<br \/>\nwill understand it the second time you read this tutorial =)<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Now let&#8217;s take a quick look at arrays in shell scripting.<br \/>\nFirst off, an array is what it says, it&#8217;s an array of something,<br \/>\nnow, to declare a variable that can hold an array we create it with the<br \/>\ncommand `declare`, let&#8217;s make a short example:<\/p>\n<p>alien:~$ declare -a foo=(1 2 3 4 5)<br \/>\nalien:~$ echo ${foo[0]}<br \/>\n1<br \/>\nalien:~$ echo ${foo[1]}<br \/>\n2<br \/>\nalien:~$ foo[1]=bar<br \/>\nalien:~$ echo ${foo[1]}<br \/>\nbar<br \/>\nalien:~$<\/p>\n<p>First of all, to understand the declare command better do `help declare`<br \/>\nat a console and it&#8217;ll desplay this:<\/p>\n<p>declare: declare [-afFrxi] [-p] name[=value] &#8230;<br \/>\n\u00a0\u00a0\u00a0 Declare variables and\/or give them attributes.\u00a0 If no NAMEs are<br \/>\n\u00a0\u00a0\u00a0 given, then display the values of variables instead.\u00a0 The -p option<br \/>\n\u00a0\u00a0\u00a0 will display the attributes and values of each NAME.<\/p>\n<p>\u00a0\u00a0\u00a0 The flags are:<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0 -a\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 to make NAMEs arrays (if supported)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 -f\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 to select from among function names only<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 -F\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 to display function names without definitions<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 -r\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 to make NAMEs readonly<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 -x\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 to make NAMEs export<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 -i\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 to make NAMEs have the `integer&#8217; attribute set<\/p>\n<p>\u00a0\u00a0\u00a0 Variables with the integer attribute have arithmetic evaluation (see<br \/>\n\u00a0\u00a0\u00a0 `let&#8217;) done when the variable is assigned to.<\/p>\n<p>\u00a0\u00a0\u00a0 When displaying values of variables, -f displays a function&#8217;s name<br \/>\n\u00a0\u00a0\u00a0 and definition.\u00a0 The -F option restricts the display to function<br \/>\n\u00a0\u00a0\u00a0 name only.<\/p>\n<p>\u00a0\u00a0\u00a0 Using `+&#8217; instead of `-&#8216; turns off the given attribute instead.\u00a0 When<br \/>\n\u00a0\u00a0\u00a0 used in a function, makes NAMEs local, as with the `local&#8217; command.<\/p>\n<p>So here we see that the -a switch to declare makes the variable an array.<br \/>\nSo after getting that `declare -a` we declare the variable as an array,<br \/>\nwith the array within paranteses.<\/p>\n<p>And then to make use of it, we use the way to write a variable like this:<br \/>\n${ variable name here }<br \/>\nand the number inside the []&#8217;s is the number that points to which part of<br \/>\nthe array it should use, begining from 0 which is the first.<\/p>\n<p>Let&#8217;s make another short example:<br \/>\ndeclare -a foo=(this is another example)<br \/>\necho &#8220;The array (${foo[*]}) has (${foo[0]}) as first, and (${foo[3]}) as last.&#8221;<\/p>\n<p>The output of this would be:<br \/>\nThe array (this is another example) has (this) as first, and (example) as last.<\/p>\n<p>Now, this isn&#8217;t something you&#8217;ll use in every day scripting, but it&#8217;s still<br \/>\nsomething you should know the existance of, just in case you see it or need<br \/>\nit at some point.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Now here&#8217;s a less common way of using bash, CGI scripts.<br \/>\nMost people dont assosiate shell scripting with cgi, but it works<br \/>\njust as well as any other language, so here I&#8217;d like to to show<br \/>\nyou how to make CGI scripts in bash.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Here is the first example which is a simple cgi counter in bash.<br \/>\nA note is that all CGI scripts should be in the servers cgi-bin directory<br \/>\nor any subdirectory there off, unless the server is configured to see<br \/>\nany other directorys as cgi directorys.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>#!\/bin\/bash<\/p>\n<p>test -f date.txt || echo `date &#8220;+%B %d %Y&#8221;` &gt; date.txt<br \/>\ntest -f counter.txt || echo &#8216;0&#8217; &gt; counter.txt<br \/>\ncurrent=`cat counter.txt`<br \/>\ndate=`cat date.txt`<br \/>\nvisitor=`expr $current + 1`<\/p>\n<p>echo &#8220;$visitor&#8221; &gt; counter.txt<br \/>\necho &#8216;Content-type: text\/html&#8217;<br \/>\necho &#8221;<br \/>\necho &#8216;&lt;br&gt;Vitor:&#8217;<br \/>\necho &#8216;&lt;br&gt;&#8217;$visitor'&lt;br&gt;Since&#8217;<br \/>\necho &#8216;&lt;br&gt;&#8217;$date'&lt;\/br&gt;&#8217;<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Let&#8217;s take this one line by line here:<\/p>\n<p>First the shell &#8230;.<br \/>\n#!\/bin\/bash<\/p>\n<p>Then we test if there is a file called date.txt, if not then we echo the<br \/>\ncurrent date to it and hence creating it.<br \/>\ntest -f date.txt || echo `date &#8220;+%B %d %Y&#8221;` &gt; date.txt<\/p>\n<p>Then we test if there is a file called counter.txt and if not we echo a 0<br \/>\nto it and so create that one too.<br \/>\ntest -f counter.txt || echo &#8216;0&#8217; &gt; counter.txt<\/p>\n<p>Now we declare the variables, current is the contents of counter.txt.<br \/>\ncurrent=`cat counter.txt`<\/p>\n<p>The date variable is the contents of date.txt.<br \/>\ndate=`cat date.txt`<\/p>\n<p>And visitor is the sum of the contents of counter.txt + 1.<br \/>\nvisitor=`expr $current + 1`<\/p>\n<p>And then we echo the new increased number to counter.txt.<br \/>\necho &#8220;$visitor&#8221; &gt; counter.txt<\/p>\n<p>And here comes the HTML part. the first to line is the &#8216;cgi header&#8217;<br \/>\nthose should ALWAYS be there:<br \/>\necho &#8216;Content-type: text\/html&#8217;<br \/>\necho &#8221;<\/p>\n<p>Then we move on to the *real* html:<br \/>\necho &#8216;&lt;br&gt;Vitor:&#8217;<br \/>\necho &#8216;&lt;br&gt;&#8217;$visitor'&lt;br&gt;Since&#8217;<br \/>\necho &#8216;&lt;br&gt;&#8217;$date'&lt;\/br&gt;&#8217;<\/p>\n<p>The &lt;br&gt; is a linebreak in html<br \/>\nThe bash variables have to be *ouside* the &#8216;s else they will simply show<br \/>\nup as $visitor or $date litterly, that&#8217;s why it&#8217;s made like this:<br \/>\necho &#8216;text&#8217; $variable &#8216;some more text&#8217;<br \/>\nSo that the text is enclosed with &#8216;s, but the variables are between or rather<br \/>\noutside of them.<br \/>\nAnyway, this cgi will create a section that looks like this on a webpage:<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\n\u00a0\u00a0 Vitor:<br \/>\n\u00a0\u00a0\u00a0\u00a0 1<br \/>\n\u00a0\u00a0 Since<br \/>\nMay 29 2001<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>To add that to a html code you add this tag to your html\/shtml page:<br \/>\n&lt;!&#8211;#exec cgi=&#8221;&lt;path to counter&gt;&#8221; &#8211;&gt;<\/p>\n<p>With the path to the counter it could look like this:<\/p>\n<p>&lt;!&#8211;#exec cgi=&#8221;\/cgi-bin\/counter\/counter.cgi&#8221; &#8211;&gt;<\/p>\n<p>Not so hard is it ?<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Here is another example of a CGI script in bash (actually the second CGI<br \/>\nscript I ever made).<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>#!\/bin\/bash<\/p>\n<p>method=`echo $QUERY_STRING | awk -F&#8217;=&#8217; &#8216;{print $1}&#8217;`<br \/>\nhost=`echo $QUERY_STRING | awk -F&#8217;=&#8217; &#8216;{print $2}&#8217;`<\/p>\n<p>if [ &#8220;$method&#8221; = &#8220;nslookup&#8221; ]; then<br \/>\necho &#8216;Content-type: text\/html&#8217;<br \/>\necho &#8221;<br \/>\necho &#8216;&lt;html&gt;&#8217;<br \/>\necho &#8216;&lt;body bgcolor=&#8221;white&#8221;&gt;&#8217;<br \/>\necho &#8216;&lt;center&gt;&#8217;<br \/>\necho &#8216;&lt;br&gt;nslookup &#8216;$host&#8217; (This might take a second)&lt;br&gt;&#8217;<br \/>\necho &#8216;&lt;hr width=&#8221;100%&#8221;&gt;&#8217;<br \/>\necho &#8216;&lt;\/center&gt;&#8217;<br \/>\necho &#8216;&lt;pre&gt;&#8217;<br \/>\nnslookup $host<br \/>\necho &#8216;&lt;\/pre&gt;&#8217;<br \/>\necho &#8216;&lt;center&gt;&#8217;<br \/>\necho &#8216;&lt;hr width=&#8221;100%&#8221;&gt;&#8217;<br \/>\necho &#8216;&lt;br&gt;nslookup compleat&#8217;<br \/>\necho &#8216;&lt;\/center&gt;&#8217;<br \/>\necho &#8216;&lt;\/body&gt;&#8217;<br \/>\necho &#8216;&lt;\/html&gt;&#8217;<br \/>\nfi<\/p>\n<p>if [ &#8220;$method&#8221; = &#8220;ping&#8221; ]; then<br \/>\necho &#8216;Content-type: text\/html&#8217;<br \/>\necho &#8221;<br \/>\necho &#8216;&lt;html&gt;&#8217;<br \/>\necho &#8216;&lt;body bgcolor=&#8221;white&#8221;&gt;&#8217;<br \/>\necho &#8216;&lt;center&gt;&#8217;<br \/>\necho &#8216;&lt;br&gt;ping &#8216;$host&#8217; (This might take a second)&lt;br&gt;&#8217;<br \/>\necho &#8216;&lt;hr width=&#8221;100%&#8221;&gt;&#8217;<br \/>\necho &#8216;&lt;\/center&gt;&#8217;<br \/>\necho &#8216;&lt;pre&gt;&#8217;<br \/>\nping -c 5 $host<br \/>\necho &#8216;&lt;\/pre&gt;&#8217;<br \/>\necho &#8216;&lt;center&gt;&#8217;<br \/>\necho &#8216;&lt;hr width=&#8221;100%&#8221;&gt;&#8217;<br \/>\necho &#8216;&lt;br&gt;ping compleat&#8217;<br \/>\necho &#8216;&lt;\/center&gt;&#8217;<br \/>\necho &#8216;&lt;\/body&gt;&#8217;<br \/>\necho &#8216;&lt;\/html&gt;&#8217;<br \/>\nfi<\/p>\n<p>if [ &#8220;$method&#8221; = &#8220;scan&#8221; ]; then<br \/>\necho &#8216;Content-type: text\/html&#8217;<br \/>\necho &#8221;<br \/>\necho &#8216;&lt;html&gt;&#8217;<br \/>\necho &#8216;&lt;body bgcolor=&#8221;white&#8221;&gt;&#8217;<br \/>\necho &#8216;&lt;center&gt;&#8217;<br \/>\necho &#8216;&lt;br&gt;Scanning host &#8216;$host&#8217; (This might take a minute)&lt;br&gt;&#8217;<br \/>\necho &#8216;&lt;hr width=&#8221;100%&#8221;&gt;&#8217;<br \/>\necho &#8216;&lt;\/center&gt;&#8217;<br \/>\necho &#8216;&lt;pre&gt;&#8217;<br \/>\nnmap $host<br \/>\necho &#8216;&lt;\/pre&gt;&#8217;<br \/>\necho &#8216;&lt;center&gt;&#8217;<br \/>\necho &#8216;&lt;hr width=&#8221;100%&#8221;&gt;&#8217;<br \/>\necho &#8216;&lt;br&gt;Scan compleat&#8217;<br \/>\necho &#8216;&lt;\/center&gt;&#8217;<br \/>\necho &#8216;&lt;\/body&gt;&#8217;<br \/>\necho &#8216;&lt;\/html&gt;&#8217;<br \/>\nfi<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Now let&#8217;s take a look at what that means:<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>This time it wont be all the lines, but all the new parts:<\/p>\n<p>First the 2 variables:<br \/>\nmethod=`echo $QUERY_STRING | awk -F&#8217;=&#8217; &#8216;{print $1}&#8217;`<br \/>\nhost=`echo $QUERY_STRING | awk -F&#8217;=&#8217; &#8216;{print $2}&#8217;`<\/p>\n<p>These are made this way because of how the CGI script imports the variables<br \/>\nfrom a form (I&#8217;ll come back to this), the $QUERY_STRING variable is<br \/>\nfrom the webservers enviorment, and so is one of the httpds env variables.<\/p>\n<p>And what you do with the $QUERY_STRING is depending on how you create<br \/>\nyour web form &#8230;. but as I said I&#8217;ll get back to that.<\/p>\n<p>Now the rest:<\/p>\n<p>if [ &#8220;$method&#8221; = &#8220;nslookup&#8221; ]; then<\/p>\n<p>That was pretty obvious &#8230;. if the first feild of $QUERY_STRING (separated<br \/>\nby a =, is &#8220;nslookup&#8221;, then go ahead here:<\/p>\n<p>echo &#8216;Content-type: text\/html&#8217;<br \/>\necho &#8221;<\/p>\n<p>Yes the header &#8230;.<\/p>\n<p>echo &#8216;&lt;html&gt;&#8217;<br \/>\necho &#8216;&lt;body bgcolor=&#8221;white&#8221;&gt;&#8217;<br \/>\necho &#8216;&lt;center&gt;&#8217;<br \/>\necho &#8216;&lt;br&gt;nslookup &#8216;$host&#8217; (This might take a second)&lt;br&gt;&#8217;<br \/>\necho &#8216;&lt;hr width=&#8221;100%&#8221;&gt;&#8217;<br \/>\necho &#8216;&lt;\/center&gt;&#8217;<br \/>\necho &#8216;&lt;pre&gt;&#8217;<\/p>\n<p>Create a HTML page &#8230; and then after the &lt;pre&gt; we do the actual center part<br \/>\nof the script:<\/p>\n<p>nslookup $host<\/p>\n<p>Which will resolve the DNS of the host (try the command and see),<br \/>\nAnd after that we end the html page:<\/p>\n<p>echo &#8216;&lt;\/pre&gt;&#8217;<br \/>\necho &#8216;&lt;center&gt;&#8217;<br \/>\necho &#8216;&lt;hr width=&#8221;100%&#8221;&gt;&#8217;<br \/>\necho &#8216;&lt;br&gt;nslookup compleat&#8217;<br \/>\necho &#8216;&lt;\/center&gt;&#8217;<br \/>\necho &#8216;&lt;\/body&gt;&#8217;<br \/>\necho &#8216;&lt;\/html&gt;&#8217;<\/p>\n<p>and then end the if statement:<\/p>\n<p>fi<\/p>\n<p>and then the same for the others, just diffent objects at what they should<br \/>\ndo, as this was nslookup, the other sections will mnap (portscan) and ping<br \/>\nthe host instead.<\/p>\n<p>Now how would a full HTML page look to make use of this cgi script ?<br \/>\nAs we this time need input to get the host or IP to scan\/ping\/nmap.<\/p>\n<p>Well like this:<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>&lt;html&gt;<br \/>\n&lt;body bgcolor=&#8221;white&#8221;&gt;<br \/>\n&lt;center&gt;<br \/>\n&lt;p&gt;&lt;font size=&#8221;+1&#8243;&gt;Enter host or IP&lt;\/font&gt;&lt;\/p&gt;<br \/>\n&lt;hr width=&#8221;100%&#8221;&gt;<br \/>\n&lt;br&gt;<br \/>\n&lt;form action=&#8221;<a href=\"http:\/\/www.yourdomain.com\/cgi-bin\/scan.cgi\">http:\/\/www.yourdomain.com\/cgi-bin\/scan.cgi<\/a>&#8221; method=&#8221;get&#8221;&gt;<br \/>\n&lt;input type=&#8221;text&#8221; name=&#8221;scan&#8221; value=&#8221;&#8221; size=&#8221;30&#8243;&gt;<br \/>\n&lt;input type=&#8221;submit&#8221; value=&#8221;portscan&#8221;&gt;<br \/>\n&lt;\/form&gt;<br \/>\n&lt;p&gt;<br \/>\n&lt;form action=&#8221;<a href=\"http:\/\/www.yourdomain.com\/cgi-bin\/scan.cgi\">http:\/\/www.yourdomain.com\/cgi-bin\/scan.cgi<\/a>&#8221; method=&#8221;get&#8221;&gt;<br \/>\n&lt;input type=&#8221;text&#8221; name=&#8221;nslookup&#8221; value=&#8221;&#8221; size=&#8221;30&#8243;&gt;<br \/>\n&lt;input type=&#8221;submit&#8221; value=&#8221;nslookup&#8221;&gt;<br \/>\n&lt;\/form&gt;<br \/>\n&lt;p&gt;<br \/>\n&lt;form action=&#8221;<a href=\"http:\/\/www.yourdomain.com\/cgi-bin\/scan.cgi\">http:\/\/www.yourdomain.com\/cgi-bin\/scan.cgi<\/a>&#8221; method=&#8221;get&#8221;&gt;<br \/>\n&lt;input type=&#8221;text&#8221; name=&#8221;ping&#8221; value=&#8221;&#8221; size=&#8221;30&#8243;&gt;<br \/>\n&lt;input type=&#8221;submit&#8221; value=&#8221;ping -c 5&#8243;&gt;<br \/>\n&lt;\/form&gt;<br \/>\n&lt;\/center&gt;<br \/>\n&lt;\/body&gt;<br \/>\n&lt;\/html&gt;<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Now what does all this mean ? &#8230;.<br \/>\nWell, I wont turn this into a HTML tutorial, but I&#8217;ll explain this so you<br \/>\ncan make use of bash for CGI.<\/p>\n<p>Right to the important HTML part here:<\/p>\n<p>&lt;form action=&#8221;<a href=\"http:\/\/www.yourdomain.com\/cgi-bin\/scan.cgi\">http:\/\/www.yourdomain.com\/cgi-bin\/scan.cgi<\/a>&#8221; method=&#8221;get&#8221;&gt;<br \/>\n&lt;input type=&#8221;text&#8221; name=&#8221;scan&#8221; value=&#8221;&#8221; size=&#8221;30&#8243;&gt;<br \/>\n&lt;input type=&#8221;submit&#8221; value=&#8221;portscan&#8221;&gt;<br \/>\n&lt;\/form&gt;<\/p>\n<p>Here we create a form, as in an input feild, which will add it&#8217;s input<br \/>\n(in a specific way) to the end of the url in action=&#8221;&#8221;.<br \/>\nthe method is get since we&#8217;re getting the output of the cgi script.<br \/>\nwe name this feild scan so we get the output this way:<br \/>\n?scan=&lt;input&gt;<br \/>\nWhere the &lt;input&gt; is what you typed in the input box.<br \/>\nAnd then we make an &#8220;ok&#8221; button that says &#8220;portscan&#8221;.<br \/>\nSo if you type say 127.0.0.1 and press the portscan button the URL it will<br \/>\nbe directed to is this:<\/p>\n<p><a href=\"http:\/\/www.yourdomain.com\/cgi-bin\/scan.cgi?scan=127.0.0.1\">http:\/\/www.yourdomain.com\/cgi-bin\/scan.cgi?scan=127.0.0.1<\/a><\/p>\n<p>And this &#8220;scan=127.0.0.1&#8243; will be the $QUERY_STRING enviormental variable.<\/p>\n<p>And so the script is starting to make sense.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Here&#8217;s a REALLY simple cgi script just for the illustration aswell.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>#!\/bin\/bash<\/p>\n<p>string=&#8221;Hello World&#8221;<\/p>\n<p>echo &#8216;Content-type: text\/html&#8217;<br \/>\necho &#8221;<br \/>\necho &#8216;&lt;html&gt;&#8217;<br \/>\necho &#8216;&lt;br&gt;&#8217;$string'&lt;\/br&gt;&#8217;<br \/>\necho &#8216;&lt;\/html&gt;&#8217;<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>And the html to call that &#8230;.. just a normal hyper link.<\/p>\n<p>&lt;a href=&#8221;<a href=\"http:\/\/www.yourdomain.com\/cgi-bin\/yourscript.cgi&quot;&gt;Link&lt;\/a\">http:\/\/www.yourdomain.com\/cgi-bin\/yourscript.cgi&#8221;&gt;Link&lt;\/a<\/a>&gt;<\/p>\n<p>And that&#8217;s it.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>That&#8217;s it on the tricks, now let&#8217;s move on to practical examples so you get<br \/>\na little bit of feel for how you can use bash to make things easier for you.<\/p>\n<p>===============================================================================<br \/>\n5 &#8211; Practical Scripting Examples.<br \/>\n===============================================================================<\/p>\n<p>I&#8217;d first like to add a note which you already probably knows:<br \/>\n.\/ == look in current directory instead of the &#8220;PATH&#8221;.<br \/>\nTo give that an example, say now that you have a script in your home<br \/>\ndirectory called &#8220;ls&#8221; or &#8220;dir&#8221;, how would you execute that without<br \/>\ngetting the contents of the directory ?<br \/>\nwell, that&#8217;s why you use &#8220;.\/&#8221;\u00a0 before a name to execute it if it&#8217;s in the<br \/>\ncurrent directory.<br \/>\n..\/ == previous directory (one directory further up towards &#8220;\/&#8221; then you are<br \/>\ncurrently in), this can be used as this, say that you have a script called<br \/>\n&#8220;script&#8221; in &#8220;\/home\/user\/&#8221; and you are standing in &#8220;\/home\/user\/nice\/&#8221; and<br \/>\nyou don&#8217;t want to leave the directory but still want to execute the script.<br \/>\nThen you do, &#8220;..\/script&#8221; and if you are in &#8220;\/home\/user\/nice\/blah\/&#8221; you<br \/>\nyou would do, &#8220;..\/..\/script&#8221; &#8212;&#8211; &#8220;..\/..\/&#8221; == 2 directory&#8217;s back.<br \/>\nGet the idea ?<\/p>\n<p>Anyway, now to the practical examples, which are working scripts for<br \/>\nvarious purposes, to give an idea about what you can do with shell scripting.<br \/>\nNew things previously not explained will show up in this section, but<br \/>\nI will explain them as we go along.<\/p>\n<p>Let&#8217;s start with simple examples and move on to harder parts.<br \/>\nAs for first I&#8217;ll stick to useless scripts =) just for illustration.<br \/>\nExplanation on the scripts follow after them, as usual.<br \/>\nSo here we go on that.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>#!\/bin\/bash<\/p>\n<p>one=&#8221;$1&#8243;<br \/>\nsomething=&#8221;$2&#8243;<\/p>\n<p>if [ &#8220;$one&#8221; = &#8220;&#8221; ]; then<br \/>\necho &#8220;Usage: $0 [name] &lt;anything goes here&gt;&#8221;<br \/>\nexit 0<br \/>\nfi<\/p>\n<p>function first {<br \/>\nclear<br \/>\necho &#8220;this is a test script !&#8221;<br \/>\necho<br \/>\necho &#8220;name followed on $0 was &#8211; $one &#8211; &#8221;<br \/>\necho<br \/>\necho &#8220;if you typed anything after the name it was: $something&#8221;<br \/>\necho<br \/>\n}<\/p>\n<p>first<\/p>\n<p>exit 0<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Executed without any thing after the script name it looks like this:<\/p>\n<p>alien:~$ .\/script<br \/>\nUsage: .\/script [name] &lt;anything goes here&gt;<br \/>\nalien:~$<\/p>\n<p>Executed with a name it looks like this:<\/p>\n<p>alien:~$ .\/script Jerry<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\nthis is a test script !<\/p>\n<p>name followed on .\/script was &#8211; Jerry &#8211;<\/p>\n<p>if you typed anything after the name it was:<\/p>\n<p>alien:~$<\/p>\n<p>Executed with a name and something else it looks like this:<\/p>\n<p>alien:~$ .\/script Jerry homer<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br \/>\nthis is a test script !<\/p>\n<p>name followed on .\/script was &#8211; Jerry &#8211;<\/p>\n<p>if you typed anything after the name it was: homer<\/p>\n<p>alien:~$<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Notes: $0 == the script name&#8217;s variable so you can do a &#8220;Usage: &lt;scriptname&gt;&#8221;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 whatever the script is named after you made it.<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $1 == the first thing that&#8217;s typed after the script in the command line<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $2 == the second thing that&#8217;s typed after the script in the command line<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $3, $4 and so on &#8230;..<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 one=&#8221;$1&#8243; this puts the contents of &#8220;$1&#8221; into the variable $one<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 which can be very useful to avoid errors.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 clear == clears the screen<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>This next example is a script which you really shouldn&#8217;t use&#8230;<br \/>\nIt&#8217;s here as an example for a working help script, but *could*<br \/>\ncause harm if not used correctly.<br \/>\nSo if you loose anything because of using it, it&#8217;s all on you.<br \/>\nand don&#8217;t say I didn&#8217;t warn you.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>#!\/bin\/bash<\/p>\n<p>if whoami | grep -v root &gt;&gt; \/dev\/null; then<br \/>\n\u00a0\u00a0\u00a0 echo &#8220;you have to be root to use this&#8221;<br \/>\n\u00a0exit 1<br \/>\nelse<\/p>\n<p>cat \/etc\/passwd | cut -f1 -d : | grep -v halt | grep -v operator | \\<br \/>\n\u00a0grep -v root | grep -v shutdown | grep -v sync | grep -v bin | \\<br \/>\n\u00a0grep -v ftp | grep -v daemon | grep -v adm | grep -v lp | \\<br \/>\n\u00a0grep -v mail | grep -v postmaster | grep -v news\u00a0 | grep -v uucp | \\<br \/>\n\u00a0grep -v man | grep -v games | grep -v guest | grep -v nobody &gt; user.list<br \/>\nfi<\/p>\n<p>for USER in `cat user.list`; do<br \/>\n\u00a0if cat \/home\/$USER\/.bash_history | grep passwd &gt;&gt; \/dev\/null; then<br \/>\n\u00a0\u00a0\u00a0 echo<br \/>\n\u00a0\u00a0\u00a0 echo &#8220;user $USER have tried to access the passwd file&#8221;<br \/>\n\u00a0\u00a0\u00a0 echo &#8220;do you want to remove $USER from your system [y\/n] &#8221;<br \/>\nread YN<br \/>\n\u00a0if [ &#8220;$YN&#8221; = &#8220;y&#8221; ]; then<br \/>\n\u00a0\u00a0\u00a0 echo &#8220;user $USER is being deleted&#8221;<br \/>\n\u00a0\u00a0\u00a0 echo &#8220;home dir of user $USER is however intact&#8221;<br \/>\n\u00a0\u00a0\u00a0 echo<br \/>\n\u00a0\u00a0\u00a0 remuser $USER<br \/>\n\u00a0else<br \/>\n\u00a0\u00a0\u00a0 echo &#8220;user $USER is not deleted&#8221;<br \/>\n\u00a0\u00a0\u00a0 echo<br \/>\n\u00a0fi<br \/>\nelse<br \/>\n\u00a0\u00a0\u00a0 echo &#8220;$USER haven&#8217;t tried to access the passwd file&#8221;<br \/>\n\u00a0fi<br \/>\ndone<\/p>\n<p>\u00a0rm user.list<br \/>\n\u00a0\u00a0\u00a0 echo<br \/>\n\u00a0\u00a0\u00a0 echo &#8220;Script finished&#8221;<br \/>\n\u00a0\u00a0\u00a0 echo<br \/>\nexit 0<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>I will just translate this script into real\/clear English:<\/p>\n<p>if (check own user-name) is anything else but root &gt;&gt; send output to a black hole<br \/>\nsay, &#8220;you have to be root to use this&#8221;<br \/>\nterminate program.<br \/>\nin other cases (in this case that can only be if the user is root)<\/p>\n<p>list the contents of the file &#8220;\/etc\/passwd&#8221; combined with &#8211; cut out the<br \/>\nuser names (field 1 separated by &#8220;:&#8221;) grep everything except lines containing the<br \/>\nfollowing words\/names: halt operator root shutdown sync bin ftp daemon<br \/>\nadm lp mail postmaster news uucp man games guest nobody and send it<br \/>\nto the file &#8220;user.list&#8221;<br \/>\nend &#8220;if&#8221; statement<\/p>\n<p>for each user in the &#8220;user.list&#8221; file do the following<br \/>\nif the word &#8220;passwd&#8221; is present in &#8220;\/home\/$USER\/.bash_history&#8221; &gt;&gt; output to<br \/>\nthe systems black hole<br \/>\nsay nothing<br \/>\nsay &#8220;user $USER haver tried to access the passwd file&#8221;<br \/>\nsay &#8220;do you want to remove $USER from your system [y\/n]&#8221;<br \/>\nread if the input from the keyboard is a &#8220;y&#8221; or &#8220;n&#8221;<\/p>\n<p>if the variable for the answer of the input is &#8220;y&#8221; then<br \/>\nsay &#8220;user $USER is being deleted&#8221;<br \/>\nsay &#8220;home dir of user $USER is however intact&#8221;<br \/>\nsay nothing<br \/>\nremoving the user from the system that tried to access the passwd file<br \/>\nin other cases<br \/>\nsay &#8220;user $USER is not deleted&#8221;<br \/>\nsay nothing<br \/>\nend &#8220;if&#8221; statement<br \/>\nin other cases<br \/>\nsay $USER haven&#8217;t tried to access the passwd file<br \/>\nend &#8220;if&#8221; statement<br \/>\nexit the for-loop<\/p>\n<p>remove the &#8220;user.list&#8221; file<br \/>\nsay nothing<br \/>\nsay &#8220;Script finished&#8221;<br \/>\nsay nothing<\/p>\n<p>exit and return to the shell command line.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Note: grep -v == show everything *except* what comes after the -v<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Here is another way of doing the exact same script, just to illustrate that<br \/>\nthe same thing can be done in several different ways:<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>#!\/bin\/bash<\/p>\n<p>if [ &#8220;$UID&#8221; != &#8220;0&#8221; ]; then<br \/>\n\u00a0\u00a0\u00a0 echo &#8220;you have to be root to use this&#8221;<br \/>\n\u00a0\u00a0\u00a0 exit -1<br \/>\nfi<\/p>\n<p>for uids in `cat \/etc\/passwd`; do<br \/>\n\u00a0\u00a0\u00a0 useruid=`echo &#8220;$uids&#8221; | awk -F&#8217;:&#8217; &#8216;{print $(3)}&#8217;`<br \/>\n\u00a0\u00a0\u00a0 test &#8220;$useruid&#8221; -ge &#8220;500&#8221; 2&gt;\/dev\/null &amp;&amp;<br \/>\n\u00a0\u00a0\u00a0 echo &#8220;$uids&#8221; | awk -F&#8217;:&#8217; &#8216;{print $(1)}&#8217; &gt; user.list<br \/>\ndone<\/p>\n<p>for USER in `cat user.list`; do<br \/>\n\u00a0\u00a0\u00a0 if (grep passwd \/home\/$USER\/.bash_history &gt;\/dev\/null); then<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 echo<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 echo &#8220;user $USER have tried to access the passwd file&#8221;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 echo &#8220;do you want to remove $USER from your system [y\/n] &#8221;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 read YN<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 case $YN in<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 y* | Y*)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 echo &#8220;user $USER is being deleted&#8221;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 echo &#8220;home dir of user $USER is however intact&#8221;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 remuser $USER<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 echo<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ;;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 n* | N*)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 echo &#8220;user $USER is not deleted&#8221;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 echo<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ;;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 esac<br \/>\n\u00a0\u00a0\u00a0 else<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 echo &#8220;$USER haven&#8217;t tried to access the passwd file&#8221;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 rm -f user.list<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 echo<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 echo &#8220;Script finished&#8221;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 echo<br \/>\n\u00a0\u00a0\u00a0 fi<br \/>\ndone<\/p>\n<p>exit 0<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Since this script does the exact same thing, but in another way, I&#8217;ll leav you<br \/>\nwith the experiance of trying to figure out the differences and how it<br \/>\nworks with the help of this tutorial, you might not get this right until<br \/>\nyou&#8217;ve read this tutorial twice.<\/p>\n<p>A tip is: try to make a comment to each line with what it does and why.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>This below script is a &#8220;Wingate&#8221; scanner, to scan for wingates that can<br \/>\nbe used to bounce off and such things, don&#8217;t know if that&#8217;s really legal<br \/>\nso take that on your own risk.<\/p>\n<p>Anyway here comes the script:<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>#!\/bin\/bash<br \/>\necho &gt; .log.tmp<br \/>\necho &gt; .log2.tmp<br \/>\necho &#8220;sleep 7&#8221; &gt; wg.config<br \/>\necho &#8220;killall -2 telnet&#8221; &gt;&gt; wg.config<\/p>\n<p>scan=&#8221;$1&#8243;<br \/>\ncount=&#8221;0&#8243;<br \/>\nmax=&#8221;255&#8243;<\/p>\n<p>clear<\/p>\n<p>if whoami | grep root &gt;&gt; \/dev\/null ; then<br \/>\n\u00a0\u00a0 echo &#8220;please use this as user and not root, since it would kill all users&#8221;<br \/>\n\u00a0\u00a0 echo &#8220;telnet sessions&#8221;<br \/>\n\u00a0else<br \/>\nclear<br \/>\nfi<\/p>\n<p>if [ &#8220;$1&#8221; = &#8220;&#8221; ]; then<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 echo &#8221; usage is: $0 &lt;C host&gt; &#8221;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 echo &#8221;\u00a0 examples:&#8221;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 echo &#8221;\u00a0 $0 127.0.0&#8243;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 echo &#8221; That will scan from 127.0.0.0 to 127.0.0.255&#8243;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 echo<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 echo &#8220;be aware though, while it scans it also kills any other telnet&#8221;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 echo &#8220;sessions you might have &#8230;.&#8221;<br \/>\n\u00a0exit 0<br \/>\nfi<\/p>\n<p>while [ &#8220;$count&#8221; != &#8220;$max&#8221; ]; do count=`expr $count + 1`<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 echo &#8220;Attempting connection to $1.$count &#8221;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 echo &gt; .log2.tmp<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 .\/wg.config &amp;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 telnet $scan.$count &gt;&gt; .log.tmp<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 cat .log.tmp | grep -v refused | grep -v closed | grep -v Connected | grep -v Escape | grep -v login &gt;&gt; .log2.tmp<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 echo &gt;&gt; .log.tmp<br \/>\n\u00a0\u00a0\u00a0 done<br \/>\n\u00a0 echo &#8220;Script Finished, results stored in .log.tmp and .log2.tmp&#8221;<br \/>\nexit 0<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>This time I will not translate the script into clear English and I will<br \/>\nnot show how it looks executed, I leave that for you to do =)<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>Now a final practical example of a script, this is a small graphical front end<br \/>\nto the console mp3 player `mpg123` so you got to have that to work<br \/>\nand you need to execute this script in a directly where you have mp3&#8217;s &#8230;.<br \/>\nAlso if you want the X-windows part of it to work you need to get and<br \/>\ninstall Xdialog, you can get that from <a href=\"http:\/\/www.freshmeat.net\">www.freshmeat.net<\/a> &#8230;<br \/>\nHowever if you have Linux Mandrake you should be good anyway, Xdialog<br \/>\ncomes as default in Mandrake.<br \/>\nThis script should be named `xmpg123`.<br \/>\nSo here we go:<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>#!\/bin\/bash<br \/>\ndialog &#8211;backtitle &#8220;xmpg123&#8221; \\<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;title &#8220;Main menu&#8221; \\<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;menu &#8220;Make your choice&#8221; 13 60 6 \\<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1 &#8220;X-windows&#8221; \\<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 2 &#8220;Ncurses&#8221; \\<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 3 &#8220;Exit&#8221; 2&gt; .tempfile<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 output=`cat .tempfile`<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 echo $output<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 rm -f .tempfile<\/p>\n<p>if [ &#8220;$output&#8221; = &#8220;1&#8221; ]; then<br \/>\nfor songs in `ls -1 *.mp3`; do<br \/>\necho &#8220;$songs mp3-file&#8221; &gt;&gt; .tempfile<br \/>\ndone<br \/>\noutput=`cat .tempfile`<br \/>\nXdialog &#8211;menu 2 2 2 1 $output\u00a0 \\<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 2&gt; .tempfile<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 output=`cat .tempfile`<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 mpg123 $output<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 rm -f .tempfile<br \/>\nfi<\/p>\n<p>if [ &#8220;$output&#8221; = &#8220;2&#8221; ]; then<br \/>\nfor songs in `ls -1 *.mp3`; do<br \/>\necho &#8220;$songs mp3-file&#8221; &gt;&gt; .tempfile<br \/>\ndone<br \/>\nmenu=`cat .tempfile`<br \/>\ndialog &#8211;menu &#8220;Make your choice&#8221; 13 70 6 $menu 2&gt; .tempfile<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 output=`cat .tempfile`<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 mpg123 $output<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 rm -f .tempfile<br \/>\nfi<\/p>\n<p>exit 0<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>A note being that dialog and Xdialog seems to be in early stages, so this<br \/>\nmay look sort of buggy if you don&#8217;t have the great dialog god at your side&#8230;<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>And don&#8217;t forget to &#8220;chmod u+x &lt;script name&gt; or chmod a+x &lt;script name&gt;<br \/>\nto make your scripts executable.<\/p>\n<p>===============================================================================<br \/>\n6 &#8211; Customize your system and shell.<br \/>\n===============================================================================<\/p>\n<p>This section is dedicated to how you can customize your system in various<br \/>\nways, this section was never planned to be in this tutorial, but since<br \/>\nI have received so many questions on how to do all this, I might as well<br \/>\ninclude it in the tutorial.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>First of I&#8217;m going to explain the local settings, this means the settings<br \/>\nthat will only affect a single user and not the whole &#8216;global&#8217; system.<br \/>\nAnd the most logical way to start this is (I think) to talk about the shell.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>At the very top of this tutorial you will find the various types of shells,<br \/>\ndefault for most systems is \/bin\/bash, this is set in the \/etc\/passwd file<br \/>\nso a normal user can not change that.<\/p>\n<p>What a normal user can do if he wants to use another shell is to start it from<br \/>\nhis ~\/.bashrc file.<br \/>\nSo say now that you feel the urge to run tcsh, then just add the<br \/>\nline \/bin\/tcsh in your ~\/.bashrc, this may be done by doing:<br \/>\necho &#8220;\/bin\/tcsh&#8221; &gt;&gt; ~\/.bashrc<br \/>\npersonally I prefer the standard bash.<\/p>\n<p>But if you do have root (super user) access to the system, you can change<br \/>\nthe shell type correctly in the \/etc\/passwd file.<\/p>\n<p>here&#8217;s a user account with \/bin\/bash from \/etc\/passwd<\/p>\n<p>User:x:500:500:my real name:\/home\/user:\/bin\/bash<\/p>\n<p>And here the same line changed to \/bin\/tcsh (tenex C shell)<\/p>\n<p>User:x:500:500:my real name:\/home\/user:\/bin\/tcsh<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Here are the system variables you can use to change your enviorment,<br \/>\nthese can be set and exported from your ~\/.bash_profile or \/etc\/profile<br \/>\nIt&#8217;s not all of the\u00a0 variables but all the really interesting ones,<br \/>\nso here we go:<\/p>\n<p>BASH= this can also set your shell type, it&#8217;s most commonly defaulted<br \/>\n\u00a0to BASH=\/bin\/bash<\/p>\n<p>BASH_VERSION= this can change the version reply of bash, on my system<br \/>\n\u00a0 this is defaulted to BASH_VERSION=&#8217;2.03.19(1)-release&#8217;<\/p>\n<p>ENV=\u00a0 this should point to a file containing your enviorment,<br \/>\n\u00a0 this is by default: ENV=~\/.bashrc<\/p>\n<p>HISTFILE= this should point to a file that will contain your shell<br \/>\n\u00a0 &#8216;history&#8217;, as in your previously used commands.<br \/>\n\u00a0 this is by default set to: HISTFILE=~\/.bash_history<\/p>\n<p>HISTFILESIZE= the max aloowed size of the history file, usually around 1000<\/p>\n<p>HISTSIZE= about the same as HISTFILESIZE<\/p>\n<p>HOME=\u00a0 this should point to your home dir<\/p>\n<p>HOSTNAME= this is your hostname<\/p>\n<p>HOSTTYPE= this should return the same as the `arch` command.<\/p>\n<p>IFS=\u00a0 Internal Feild Separator &#8230;. this is a delimeter,<br \/>\n\u00a0 often defaulted to a new line as this:<br \/>\n&#8230;&#8230;<br \/>\nIFS=&#8217;<br \/>\n&#8216;<br \/>\n&#8230;&#8230;<\/p>\n<p>INPUTRC= defaulted to INPUTRC=\/etc\/inputrc<\/p>\n<p>LANG=\u00a0 language variable, default is en for english<\/p>\n<p>LANGUAGE=\u00a0 about the same as LANG, also defaulted to en for english<\/p>\n<p>LINGUAS= defaulted to\u00a0 en_US:en\u00a0 also a language variable.<\/p>\n<p>LS_COLORS= sets colors to the `ls` command. this on my system<br \/>\n\u00a0 is defaulted to this:<\/p>\n<p>&#8230;&#8230;<br \/>\nLS_COLORS=&#8217;no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:\\<br \/>\ncd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=01;32:*.cmd=01;32:*.exe=01;32:\\<br \/>\n*.com=01;32:*.btm=01;32:*.bat=01;32:*.tar=01;31:*.tgz=01;31:*.tbz2=01;31:\\<br \/>\n*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lha=01;31:*.zip=01;31:\\<br \/>\n*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tz=01;31:*.rpm=01;31:\\<br \/>\n*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.xbm=01;35:*.xpm=01;35:\\<br \/>\n*.png=01;35:*.tif=01;35:*.tiff=01;35:&#8217;<br \/>\n&#8230;&#8230;<br \/>\n\u00a0 So just add what you want here, and colors are the same<br \/>\n\u00a0 as explained about how to set the prompt later down, but<br \/>\n\u00a0 without the \u001b[ infront and m on the end.<\/p>\n<p>MAIL=\u00a0 mail file, usually MAIL=\/var\/spool\/mail\/&lt;username&gt;<\/p>\n<p>OSTYPE=\u00a0 This can change your OS reply, it&#8217;s on a linux defaulted<br \/>\n\u00a0 to: OSTYPE=linux-gnu<\/p>\n<p>PATH=\u00a0 changes your path, this variable is explained in<br \/>\n\u00a0 the explanation of the \/etc\/profile file<\/p>\n<p>PPID=\u00a0 parent pid &#8230;. this is a read-only variable &#8230;<br \/>\n\u00a0 so you cant change it.<\/p>\n<p>PS1=\u00a0 the prompt variable, explained later down.<\/p>\n<p>PS2=\u00a0 the *more to come* variable, as if you type an unfinished<br \/>\n\u00a0 command string, it will bring you a new prompt where<br \/>\n\u00a0 you can finish it, this is usually defaulted to: PS2=&#8217;&gt; &#8216;<\/p>\n<p>SHELL=\u00a0 another way to change your shell type &#8230;<\/p>\n<p>TERM=\u00a0 terminal type, usually defaulted to: TERM=linux<br \/>\n\u00a0 but can also be like: TERM=vt100<br \/>\n\u00a0 there are more video terminals then 100 though.<\/p>\n<p>UID=\u00a0 your user ID, if your root this will be 0,<br \/>\n\u00a0 this is a readonly variable.<\/p>\n<p>USER=\u00a0 your user name &#8230;.<\/p>\n<p>USERNAME= same as $USER<\/p>\n<p>Say that you want to change your shell to \/bin\/csh and your path to just \/bin<br \/>\n(you dont), but just if you would in your: .bash_profile add:<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>SHELL=\/bin\/csh<br \/>\nPATH=\/bin<\/p>\n<p>export PATH SHELL<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Not so hard huh ?<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>The next thing here is a question that I&#8217;ve heard alot, and that is &#8220;how do I<br \/>\nchange my command prompt ?&#8221;.<\/p>\n<p>The command Prompts variable is named PS1 ($PS1)<\/p>\n<p>for a prompt that looks like this:<br \/>\n[alien@localhost alien]$<br \/>\nthe contents of the PS1 variable would be this:<br \/>\n[\\u@\\h \\W]\\$<\/p>\n<p>All the prompts internal variables starts with a \\ (backslash)<\/p>\n<p>useful:<\/p>\n<p>\\$ = the prompt ($ for user and # for root)<br \/>\n\\d = date<br \/>\n\\h = abbreviated hostname (root.host.com would become root)<br \/>\n\\H = full hostname<br \/>\n\\s = shell type<br \/>\n\\t = time<br \/>\n\\T = time with seconds<br \/>\n\\u = username<br \/>\n\\v = shell version (short)<br \/>\n\\V = shell version (long)<br \/>\n\\w = full path<br \/>\n\\W = current directory name<\/p>\n<p>less useful:<br \/>\n\\e = erase rest of line &#8230;. not very useful<br \/>\n\\n = new line &#8230; not very useful<br \/>\n\\r = whatever comes after \\r is displayed before the first character.<\/p>\n<p>A couple of examples would be:<\/p>\n<p>*BSD like.<br \/>\nPS1=&#8221;\\u: \\w&gt; &#8221;<\/p>\n<p>DOS like.<br \/>\nPS1=&#8221;C:\\w &gt; &#8221;<\/p>\n<p>RedHat like.<br \/>\nPS1=&#8221;[\\u@\\h \\W]\\$ &#8221;<\/p>\n<p>Init 1 like.<br \/>\nPS1=&#8221;\\s-\\v \\$ &#8221;<\/p>\n<p>How do I use colors in the prompt ?<\/p>\n<p>To use colors in the prompt you need to be familiar with the escape sequence<br \/>\ncolor codings, those are as follows:<\/p>\n<p>reset\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 = ^[[0m<br \/>\nflashing\u00a0\u00a0\u00a0\u00a0\u00a0 = ^[[5m<br \/>\nblack\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 = ^[[0;30m<br \/>\nred\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 = ^[[0;31m<br \/>\ngreen\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 = ^[[0;32m<br \/>\nyellow\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 = ^[[0;33m<br \/>\nblue\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 = ^[[0;34m<br \/>\nmagenta\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 = ^[[0;35m<br \/>\ncyan\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 = ^[[0;36m<br \/>\nwhite\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 = ^[[0;37m<br \/>\nhighblack\u00a0\u00a0\u00a0\u00a0 = ^[[1;30m<br \/>\nhighred\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 = ^[[1;31m<br \/>\nhighgreen\u00a0\u00a0\u00a0\u00a0 = ^[[1;32m<br \/>\nhighyellow\u00a0\u00a0\u00a0 = ^[[1;33m<br \/>\nhighblue\u00a0\u00a0\u00a0\u00a0\u00a0 = ^[[1;34m<br \/>\nhighmagenta\u00a0\u00a0 = ^[[1;35m<br \/>\nhighcyan\u00a0\u00a0\u00a0\u00a0\u00a0 = ^[[1;36m<br \/>\nhighwhite\u00a0\u00a0\u00a0\u00a0 = ^[[1;37m<br \/>\nbg-white\u00a0\u00a0\u00a0\u00a0\u00a0 = ^[[47m<br \/>\nbg-magenta\u00a0\u00a0\u00a0 = ^[[45m<br \/>\nbg-blue\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 = ^[[44m<br \/>\nbg-red\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 = ^[[41m<br \/>\nbg-black\u00a0\u00a0\u00a0\u00a0\u00a0 = ^[[40m<br \/>\nbg-green\u00a0\u00a0\u00a0\u00a0\u00a0 = ^[[42m<br \/>\nbg-yellow\u00a0\u00a0\u00a0\u00a0 = ^[[43m<br \/>\nbg-cyan\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 = ^[[46m<\/p>\n<p>Important to know is that the leading `^[` is NOT 2 characters, it&#8217;s ONE<br \/>\ncontrol character that that takes up the space of 2 characters, or is<br \/>\ndescribed by 2 characters, if you have a real ^[ and you try to delete the<br \/>\n[ do it it will delete both the [ and the ^ at the same time.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br \/>\nNot really sure where to put this note but here,<br \/>\n^[[&lt;number&gt;G<br \/>\nPuts the cursor at column &lt;number&gt;, as this:<\/p>\n<p>echo -n &#8220;Starting myprog:&#8221; &amp;&amp; echo -e &#8220;^[[50G OK&#8221; || echo -e &#8220;^[[50G FAILD&#8221;<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>So how do you get a real control character ?<\/p>\n<p>Either you use the very old line editor &#8216;ed&#8217; and press Ctrl+[ to get the<br \/>\ncontrol character (ed commands are described at the end of this tutorial),<br \/>\nor you can use &#8217;emacs&#8217; or the text editor &#8216;joe&#8217;.<\/p>\n<p>To get control characters in emacs you press ^Q and ^&lt;what you want&gt;,<br \/>\nas if you want a ^[ you press ^Q^3, and then ^X^S^X^C to save and quit.<\/p>\n<p>To get control characters in joe you press ` and then the character to make<br \/>\na control character, in this case [, when you do this in joe the ^[<br \/>\nshould look like a bold [.<br \/>\nTo save and quit in joe you press: Ctrl+K followed by Ctrl+X<\/p>\n<p>It&#8217;s only the ^[ that is a control character the rest is normal [&#8216;s and<br \/>\nnumbers and so on.<\/p>\n<p>Don&#8217;t forget to enclose all your colors codes in \\[ \\], this means that<br \/>\n^[[0;31m (red) would be written as \\[^[[0;31m\\].<\/p>\n<p>Where do I write this and how does an example look ?<\/p>\n<p>You add this in your ~\/.bash_profile, you can put it at the end of the file.<\/p>\n<p>Some examples are:<\/p>\n<p>[ highblue-user red-@ highblue-host green-dir ] highblue-$<br \/>\nPS1=&#8221;\\[^[[1;34m\\u^[[0;31m@^[[1;34m\\h ^[[0;32m\\W^[[0m\\]^[[1;34m\\$ \\[^[[0m\\] &#8221;<\/p>\n<p>highblue-user highwhite-: highblue-path &gt;<br \/>\nPS1=&#8221;\\[^[[1;34m\\]\\u\\[^[[1;37m\\]: \\[^[[0;31m\\]\\w \\[^[[0m\\]&gt; &#8221;<\/p>\n<p>(you can not cut and paste these examples without editing the ^[&#8216;s to real<br \/>\ncontrol characters, and know that a color prompt is almost always buggy)<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>The next thing to take up is how to set aliases and to change system variables.<\/p>\n<p>An alias is set in the ~\/.bashrc file, if you use \/bin\/bash else, it&#8217;s most<br \/>\nlikely in your .`shell type`rc as .zshrc .csh .tcsh etc.<\/p>\n<p>An alias means that you can make a short command for a longer command,<br \/>\nas the alias `l` can mean `ls` and the alias `la` can mean `ls -la`, and<br \/>\nso on, an alias is written like this (also a list of useful aliases):<\/p>\n<p>alias rm=&#8217;rm -i&#8217;<br \/>\nalias mv=&#8217;mv -i&#8217;<br \/>\nalias cp=&#8217;cp -i&#8217;<br \/>\nalias s=&#8217;cd ..&#8217;<br \/>\nalias d=&#8217;ls&#8217;<br \/>\nalias p=&#8217;cd -&#8216;<br \/>\nalias ll=&#8217;ls -laF &#8211;color&#8217;<br \/>\nalias lsrpm=&#8217;rpm -qlp&#8217;<br \/>\nalias lstgz=&#8217;tar -tzf&#8217;<br \/>\nalias lstar=&#8217;tar -tf&#8217;<br \/>\nalias mktgz=&#8217;tar -cfz&#8217;<br \/>\nalias untar=&#8217;tar -vxf&#8217;<br \/>\nalias untgz=&#8217;tar -vzxf&#8217;<\/p>\n<p>rm will now ask before removing anything.<\/p>\n<p>mv will now ask before overwriting anything.<\/p>\n<p>cp will now ask before overwriting anything.<\/p>\n<p>s will now work as cd ..<\/p>\n<p>d will now work as ls.<\/p>\n<p>p will now work as cd &#8211; (cd &#8211; == takes you to your last dir ie.<br \/>\nyou are in \/usr\/local\/bin\/ and does a cd \/, if you from here wanna go back<br \/>\nto \/usr\/local\/bin\/ you simply type `cd -`, or now just `p`.)<\/p>\n<p>ll will do a ls -la with colors and ending * after executable files and ending<br \/>\nan ending \/ after dirs.<\/p>\n<p>lsrpm will list the contents (where the files will end up if you install it) of<br \/>\nany rpm file.<\/p>\n<p>lstgz will list the contents of a .tar.gz or .tgz file.<\/p>\n<p>lstar will list the contents of a plain .tar file.<\/p>\n<p>mkgz will make a tgz archive (mktar archive.tgz directory).<\/p>\n<p>untar will untar a .tar file.<\/p>\n<p>untgz will unzip and untar a\u00a0 .tar.gz or a .tgz file.<\/p>\n<p>There is more alias like things you can set in the ~\/.bashrc file, like<br \/>\nsmaller functions that works as aliases, like this:<\/p>\n<p>function whichrpm { rpm -qf `&#8217;which&#8217; $1`; }<\/p>\n<p>typing &#8220;whichrpm &lt;command&gt;&#8221; at a prompt will name the rpm file it came with.<\/p>\n<p>the rpm -qf command works like this:<\/p>\n<p>alien:~$ rpm -qf \/usr\/bin\/dir<br \/>\nfileutils-4.0i-1mdk<br \/>\nalien:~$<\/p>\n<p>And the function works like this:<\/p>\n<p>alien:~$ whichrpm dir<br \/>\nfileutils-4.0i-1mdk<br \/>\nalien:~$<\/p>\n<p>function &#8211; tells bash that it&#8217;s function.<br \/>\nwhichrpm &#8211; user defined name of the function.<br \/>\n{ \/ } &#8211; starts\/ends the function<br \/>\nrpm -qf &#8211; command<br \/>\n` command quote<br \/>\n&#8216; precise quote<br \/>\nwhich &#8211; command to locate a file in your path<br \/>\n$1 &#8211; first argument after the function (the command after the function name<br \/>\nwhen you execute it).<br \/>\n; &#8211; end line<br \/>\nfunction whichrpm { rpm -qf `&#8217;which&#8217; $1`; }<\/p>\n<p>So when you execute this, the system will think.<br \/>\naaah, a function within those {}&#8217;s, which I should call for when I hear<br \/>\nthe word &#8220;whichrpm&#8221;, and what&#8217;s after that word ($1) will be used as<br \/>\nargument to &#8220;which&#8221;, and what that returns will be used after &#8220;rpm -qf&#8221;.<\/p>\n<p>which works like this:<\/p>\n<p>alien:~$ which dir<br \/>\n\/usr\/bin\/dir<br \/>\nalien:~$<\/p>\n<p>So &#8220;`&#8217;which&#8217; $1`&#8221; (when executed with the word &#8216;dir&#8217;) returns &#8220;\/usr\/bin\/dir&#8221;,<br \/>\nand so the whole function will finally execute: rpm -qf \/usr\/bin\/dir<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Now more about the files in \/etc, here you cant be user anymore,<br \/>\nto edit the files in \/etc requires you to be root.<\/p>\n<p>Fist here I&#8217;m going to talk about the \/etc\/crontab configuration file.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>The \/etc\/crontab is the global system file for cron jobs.<br \/>\ncron is short for chronological, and as the name tells it&#8217;s doing things<br \/>\nin a chronological order, as you can tell it to run a script or a program<br \/>\nonce every 1 minutes, or you can tell it to run something annually, and<br \/>\nanything in between.<\/p>\n<p>On RedHat like systems you have the dirs:<\/p>\n<p>\/etc\/cron.daily\/<br \/>\n\/etc\/cron.hourly\/<br \/>\n\/etc\/cron.monthly\/<br \/>\n\/etc\/cron.weekly\/<\/p>\n<p>Any script or program that lives in those files will execute by the last<br \/>\nname of the file, as if you put a script in \/etc\/cron.weekly\/, the script<br \/>\nwill execute weekly.<\/p>\n<p>The \/etc\/crontab looks like this:<\/p>\n<p>SHELL=\/bin\/bash<br \/>\nPATH=\/sbin:\/bin:\/usr\/sbin:\/usr\/bin<br \/>\nMAILTO=root<br \/>\nHOME=\/<\/p>\n<p># run-parts<br \/>\n01 * * * * root run-parts \/etc\/cron.hourly<br \/>\n02 4 * * * root run-parts \/etc\/cron.daily<br \/>\n22 4 * * 0 root run-parts \/etc\/cron.weekly<br \/>\n42 4 1 * * root run-parts \/etc\/cron.monthly<\/p>\n<p>The SHELL determens what shell that should be used to execute the things<br \/>\nin the crontab.<\/p>\n<p>The PATH determens what directory&#8217;s it should look in for commands\/programs<br \/>\nif no other specific path is given to a program, command or script.<\/p>\n<p>The MAILTO variable determens to what user cron should send mails to on errors.<\/p>\n<p>And the HOME variable determens crons root\/home\/base directory.<\/p>\n<p>The first 5 fields determens when to run a job, here&#8217;s what they mean:<\/p>\n<p>Field 1: minutes (0-59)<br \/>\nField 2: hours (0-23)<br \/>\nField 3: day of month (1-31)<br \/>\nField 4: month (1-12 &#8211; or names)<br \/>\nField 5: weekday (0-7 &#8211; 0 or 7 is Sun, or use names)<\/p>\n<p>The next field is the user that owns the execution process.<\/p>\n<p>Then we have run-parts, and after that the file to execute.<br \/>\n(if the file to execute is a dir, it will execute everything in it)<\/p>\n<p>To use the crontab as a user (root included) simply type: crontab -e<br \/>\nThis brings you to a VI like editor (see VI commands later in this tutorial).<br \/>\nSay now that you have a script \/home\/user\/check.sh that you wanna run<br \/>\nevery 5&#8217;th minute. then you type &#8220;crontab -e&#8221;<br \/>\nPress &#8216;Esc&#8217; followed by &#8216;o&#8217; to get to &#8220;insert&#8221; or &#8220;edit&#8221; mode.<br \/>\nIn there make the following line:<\/p>\n<p>0,5,10,15,20,25,30,35,40,45,50,55 * * * *\u00a0 \/home\/user\/check.sh &#8211;flag<\/p>\n<p>Then press &#8216;Esc&#8217; followed by &#8216;:&#8217; and then type &#8216;wq&#8217; followed by enter to<br \/>\nwrite\/save and, quit the file, and that&#8217;s it.<\/p>\n<p>When you run crontab as user you don&#8217;t have to specify what user that should<br \/>\nown the process, &#8220;* * * * * file&#8221; should be enough.<\/p>\n<p>Another way of writing:<br \/>\n0,5,10,15,20,25,30,35,40,45,50,55 * * * *\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/home\/user\/check.sh &#8211;flag<br \/>\nIs this:<br \/>\n0-59\/5 * * * *\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/home\/user\/check.sh &#8211;flag<br \/>\nThat means do this (\/home\/user\/check.sh &#8211;flag) from 0-59 with 5 as an<br \/>\nintervall.<br \/>\nThis means that:<br \/>\n* 0-23\/2 * * *\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/home\/user\/check.sh &#8211;flag<br \/>\nWould run the same script every other hour.<\/p>\n<p>Not very hard is it ?<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Then we have the\u00a0 \/etc\/fstab is a list of the HD partitions the system<br \/>\nshould mount as what when the system boots.<br \/>\nThis may look like this:<\/p>\n<p>\/dev\/hda1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ext2\u00a0\u00a0\u00a0 defaults\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1 1<br \/>\n\/dev\/hda3\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 none\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 swap\u00a0\u00a0\u00a0 sw\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0 0<br \/>\n\/dev\/hda4\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/home\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ext2\u00a0\u00a0\u00a0 defaults\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1 2<br \/>\n\/dev\/hda6\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/tmp\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ext2\u00a0\u00a0\u00a0 defaults\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1 2<br \/>\n\/dev\/hdc1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/windows\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 vfat\u00a0\u00a0\u00a0 defaults\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0 0<br \/>\n\/dev\/fd0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/mnt\/floppy\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 auto\u00a0\u00a0\u00a0 noauto,nosuid\u00a0\u00a0 0 0<br \/>\n\/dev\/hdb\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/mnt\/cdrom\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 auto\u00a0\u00a0\u00a0 noauto,ro\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0 0<\/p>\n<p>Fist it&#8217;s the HD partition, then (a few tabs in) the mount point (where the<br \/>\neventual contents of the HD partition should end up), then what file system<br \/>\nthe partition has, further is if it should be mounted by default etc.<br \/>\nand the last 2 numbers is fs_freq and fs_passno (see the man page for fstab).<\/p>\n<p>The possible HD partitions you have to find for your self or know&#8230;<br \/>\na tip is to go over the HD&#8217;s with fdisk, and check for free space.<\/p>\n<p>The possible mount points is only limited by your imagination, though<br \/>\nthere must always be a \/<br \/>\nA good disk usage should have these partitions:<br \/>\n\/ 5%<br \/>\n\/usr 30%<br \/>\n\/home 30%<br \/>\n\/tmp 10%<br \/>\nAnd 25% over for other partitions, like \/sources, or whatever.<\/p>\n<p>The possible and supported file systems are currenty:<br \/>\nminix,ext,ext2,xiafs,msdos,hpfs,iso9660,nfs,swap,vfat, and perhaps ntfs<\/p>\n<p>The possible mount options are:<br \/>\nsync,user,noauto,nosuid,nodev,unhide,user,noauto,nosuid,exec,nodev,ro etc.<br \/>\nsee the man mount page.<\/p>\n<p>So say that you are going to add another cdrom that you want user to be able<br \/>\nto mount, and the cdrom is on \/dev\/hdd, then the line to add would look like<br \/>\nthis (make sure you have the mount point dir, like here you have to<br \/>\nmkdir \/cdrom):<\/p>\n<p>\/dev\/hdd\u00a0 \/cdrom\u00a0\u00a0 auto noauto,user,ro 0 0<\/p>\n<p>And that&#8217;s about it for the \/etc\/fstab<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Now I&#8217;d like to explain one of the very important files, the \/etc\/profile file.<br \/>\nIn this file is the Global profile settings, that will apply for all users.<\/p>\n<p>Fist in this file we should have the PATH variable.<br \/>\nThe directory&#8217;s in the PATH is the directory&#8217;s the system will look in if you<br \/>\ntype a command, for that command to execute it.<\/p>\n<p>Say now that your path looks like this:<br \/>\nPATH=&#8221;$PATH:\/usr\/X11R6\/bin:\/bin&#8221;<\/p>\n<p>And you type &#8220;ls&#8221;, then the system will first look in \/usr\/X11R6\/bin if it can<br \/>\nfind any file named &#8220;ls&#8221;, and if it doesn&#8217;t find it there, it will look in \/bin,<br \/>\nand if it finds it there it will execute it.<\/p>\n<p>The most common places on a system to store commands and programs is in these<br \/>\ndirectory&#8217;s:<br \/>\n\/usr\/X11R6\/bin<br \/>\n\/bin<br \/>\n\/sbin<br \/>\n\/usr\/bin<br \/>\n\/usr\/sbin<br \/>\n\/usr\/local\/bin<br \/>\n\/usr\/local\/sbin<\/p>\n<p>A path with all those directory&#8217;s in it would look like this:<br \/>\nPATH=&#8221;$PATH:\/usr\/X11R6\/bin:\/bin:\/sbin:\/usr\/local\/bin:\/usr\/local\/sbin:\/usr\/bin:\/usr\/sbin&#8221;<\/p>\n<p>The next thing in there can\/should be the PS1 (the prompt), I&#8217;ve already<br \/>\ntaken up how to customize the prompt, so no need to do that again.<\/p>\n<p>Then (at least in RedHat like systems) we have this:<\/p>\n<p>[ &#8220;$UID&#8221; = &#8220;0&#8221; ] &amp;&amp; {<br \/>\nulimit -c 1000000<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 } || {<br \/>\nulimit -c 0<br \/>\n}<\/p>\n<p>This says: if the UID of the user is 0 (root) then do: ulimit -c 1000000<br \/>\nor if that doesn&#8217;t work, do: ulimit -c 0.<\/p>\n<p>Then we have an if statement about umask on the user&#8230;<\/p>\n<p>After that we define some system variables, where after we export them.<\/p>\n<p>Then we load all the .sh scripts in \/etc\/profile.d\/<\/p>\n<p>And that&#8217;s it, in that file.<\/p>\n<p>This is an important file if you wanna add any system variables, or if you<br \/>\nwant to change anything globally for the whole system.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Now on to the \/etc\/hosts.allow and \/etc\/hosts.deny files.<\/p>\n<p>Those hosts who are in hosts.allow are always allowed to connect to the system<br \/>\nunder the condition that they have valid login and password ofcorse.<\/p>\n<p>Those hosts who are in hosts.deny can never establish a lasting connection<br \/>\nto your system, even if they have a valid login and password.<\/p>\n<p>If you don&#8217;t want anyone to connect to your computer at all, you simply add<br \/>\nthe following to \/etc\/hosts.deny:<\/p>\n<p>ALL: ALL<\/p>\n<p>And this to \/etc\/hosts.allow:<\/p>\n<p>ALL: LOCAL<\/p>\n<p>Or if you have a network, you may wanna add this in \/etc\/hosts.allow:<\/p>\n<p>ALL: LOCAL, 192.168.1.<\/p>\n<p>Where 192.168.1. is your network call C network.<\/p>\n<p>\/etc\/hosts.allow and \/etc\/hosts.deny understands the following wildcards:<\/p>\n<p>ALL\u00a0\u00a0\u00a0\u00a0\u00a0 The universal wildcard, always matches.<br \/>\nLOCAL\u00a0\u00a0\u00a0 Matches\u00a0 any host whose name does not contain a dot character.<br \/>\nUNKNOWN\u00a0 Matches any user whose name is unknown.<br \/>\nKNOWN\u00a0\u00a0\u00a0 Matches any user whose name is known.<br \/>\nPARANOID Matches any host whose\u00a0 name\u00a0 does\u00a0 not\u00a0 match\u00a0 its address.<\/p>\n<p>Read man hosts.allow or man hosts.deny (should be the same man file), to find<br \/>\nout more about this.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Next up is the \/etc\/inputrc file, which contains breaf keyboad confirurations.<br \/>\nIf you want to something like Ctrl+W or something to a function of any kind<br \/>\nhere is the place to do that.<br \/>\nThe example from the file looks like this:<\/p>\n<p># Just a little exemple, how do you can configure your keyboard<br \/>\n# If you type Control-x s it&#8217;s add a su -c &#8221; &#8221; around the command<br \/>\n# See the info files (readline) for more details.<br \/>\n#<br \/>\n# &#8220;\\C-xs&#8221;: &#8220;\\C-e\\&#8221;\\C-asu -c \\&#8221;&#8221;<\/p>\n<p>This would mean that if you want to add say: Ctrl+W to add the command<br \/>\n`time` before another command you would do:<\/p>\n<p>&#8220;\\C-w&#8221;: &#8220;\\C-e\\ \\C-atime \\<\/p>\n<p>Another example would be, if you want to add: Ctrl+W Q to add: echo &#8220;&lt;command&gt;&#8221;<br \/>\naround the &lt;command&gt; you would do:<\/p>\n<p>&#8220;\\C-wq&#8221;: &#8220;\\C-e\\&#8221;\\C-aecho \\&#8221;&#8221;<\/p>\n<p>This means that if you type &#8216;word&#8217; and then press Ctrl+W followed by Q you<br \/>\nwill end up with: echo &#8220;word&#8221;, pretty handy.<\/p>\n<p>You can also add a .inputrc in your home dir with the same functions,<br \/>\nbut only for that user.<\/p>\n<p>Just make sure you dont overwrite some other function, test the Ctrl+&lt;key(s)&gt;<br \/>\nfunction that you wanna use so they dont already do something.<\/p>\n<p>If you want to bind keys to functions or characters, this is not the place<br \/>\nto do that, then you need to find your keymap like this one:<br \/>\n\/usr\/lib\/kbd\/keymaps\/i386\/qwerty\/se-latin1.kmap.gz<br \/>\ngunzip it, edit it and then zip it up again.<\/p>\n<p>I will not explain how to edit a keymap here, but it&#8217;s not that hard,<br \/>\njust read the contnts of the unziped keymap a few times and use the<br \/>\npower of deduction.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>The \/etc\/passwd holds the login information which looks something like this:<\/p>\n<p>root:x:0:0:root:\/root:\/bin\/bash<br \/>\nbin:x:1:1:bin:\/bin:<br \/>\ndaemon:x:2:2:daemon:\/sbin:<br \/>\nadm:x:3:4:adm:\/var\/adm:<br \/>\nlp:x:4:7:lp:\/var\/spool\/lpd:<br \/>\nshutdown:x:6:0:shutdown:\/sbin:\/sbin\/shutdown<br \/>\nalien:x:500:500:Me:\/home\/alien:\/bin\/bash<br \/>\nuser:x:501:501::\/home\/user:\/bin\/csh<\/p>\n<p>You are looking on 7 accounts, nameley: root, bin, daemon, adm, lp, shutdown,<br \/>\nalien and user.<\/p>\n<p>each of the lines have 7 feilds separated by &#8216;:&#8217;.<br \/>\nThe fields from left to right are:<\/p>\n<p>1 login-name<br \/>\n2 encrypted-password (this field contains only &#8216;x&#8217; if there is an \/etc\/shadow)<br \/>\n3 uid (user id)<br \/>\n4 gid (group id)<br \/>\n5 user-information<br \/>\n6 home-directory<br \/>\n7 shell-type<\/p>\n<p>If you make an account by hand in the \/etc\/passwd file, put a &#8216;*&#8217; in the<br \/>\nencrypted-password field and use the `passwd` command to set the password.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>The \/etc\/shadow file, if this file exists, this is where the real<br \/>\nencrypted passwords are located, this file can only be read by the super-user<br \/>\n(root), and it looks like this:<\/p>\n<p>root:$1$UrbUdguK$yrO3U\/dlwKC5K3y2ON\/YM.:11056:0:21:7:::<br \/>\nbin:*:11056:0:99999:7:::<br \/>\ndaemon:*:11056:0:99999:7:::<br \/>\nadm:*:11056:0:99999:7:::<br \/>\nlp:*:11056:0:99999:7:::<br \/>\nshutdown:$1$hu86lnLIhnklY8ijnHui7.nn\/jYg\/mU:11056:1:365:14:::<br \/>\nalien:$1$vf3tGCFF$YRoFUgFDR8CVK6hHOwU\/p0:11056:0:50:14:31::<br \/>\nuser:$1$asd8kiLY76JNdskDkj97kMiyBujy\/jD:11074:2:100:14:3::<\/p>\n<p>(I&#8217;ve changed the characters in the encrypted-password, so they are not valid)<\/p>\n<p>The manual page (man 5 shadow) tells the following about the 9 fields:<\/p>\n<p>Login name<br \/>\nEncrypted password<br \/>\nDays since Jan 1, 1970 that password was last changed<br \/>\nDays before password may be changed<br \/>\nDays after which password must be changed<br \/>\nDays before password is to expire that user is warned<br \/>\nDays after password expires that account is disabled<br \/>\nDays since Jan 1, 1970 that account is disabled<br \/>\nA reserved field<\/p>\n<p>If anyone knows what the last field (after the final &#8216;:&#8217;) is reserved for &#8230;<br \/>\nplease drop me a mail.<\/p>\n<p>Read the lines from the files, and compare them with what the 9 fields<br \/>\nmean, and see if you can make out how the accounts for each user is set up.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Now the \/etc\/motd file.<\/p>\n<p>The \/etc\/motd contains whatever you want to display to the user<br \/>\nthat logs into the system, this can be a set of rules for your system,<br \/>\nor some ascii graphics or whatever you want.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>And now the \/etc\/skel\/ which is a dir and contains the basic files<br \/>\nthat will be given to any new user account.<\/p>\n<p>Say that you add a file called, \/etc\/skel\/.ircrc then all new useraccounts<br \/>\nthat are added will have a ~\/.ircrc file in there home directory.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>And last the \/etc\/issue and \/etc\/issue.net file.<br \/>\nOn most systems there is only an \/etc\/issue file that works as both<br \/>\n\/etc\/issue and \/etc\/issue.net, the issue file holds the information<br \/>\nor rather text that is displayed to the user just before the<br \/>\nlogin prompt, usually it is the system specifications, like operating system<br \/>\nversion and things like that.<\/p>\n<p>The \/etc\/issue (if there is any \/etc\/issue.net) is the issue file for the<br \/>\nlocal users, and the \/etc\/issue.net is for users that logs in<br \/>\nfrom a remote host.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>There is alot more in the \/etc directory, but what I&#8217;ve written this<br \/>\nfar is about what you need to customize your system to your needs.<\/p>\n<p>===============================================================================<br \/>\n7 &#8211; Networking.<br \/>\n===============================================================================<\/p>\n<p>Linux is known to be one of the best networking operating systems in the<br \/>\nworld, perhaps even THE best, unfortionally it&#8217;s not the easiest OS to<br \/>\nset up a good network in, but I hope that this section will make<br \/>\nexclamation marks out of some question marks.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>The first thing you need to do networking is 2 computers and<br \/>\nnetwork cards attached with a crossed network cable, or connected via a hub,<br \/>\nwith normal network cable (doh?).<\/p>\n<p>The next step is to make sure the network cards work properly.<\/p>\n<p>Make sure you have the networking support compiled into the kernel, you need<br \/>\nto have the following checked in the kernel (example is from the Linux 2.2.14<br \/>\nkernel, using `make menuconfig`, you can read more about how you<br \/>\ncompile\/recompile your kernel in \/usr\/doc\/HOWTO\/Kernel-HOWTO):<\/p>\n<p>General setup\u00a0 &#8212;&gt;<br \/>\n\u00a0[*] Networking support<br \/>\nNetworking options\u00a0 &#8212;&gt;<br \/>\n\u00a0[*] Kernel\/User netlink socket<br \/>\n\u00a0[*] Network firewalls<br \/>\n\u00a0&lt;*&gt; Unix domain sockets<br \/>\n\u00a0[*] TCP\/IP networking<br \/>\n\u00a0[*] IP: advanced router<br \/>\n\u00a0[*] IP: firewalling<br \/>\n\u00a0[*] IP: transparent proxy support<br \/>\n\u00a0[*] IP: masquerading<br \/>\n\u00a0[*] IP: ICMP masquerading<br \/>\n\u00a0[*] IP: aliasing support<br \/>\n\u00a0&lt;*&gt; IP: Reverse ARP<br \/>\n\u00a0[*] IP: Allow large windows (not recommended if &lt;16Mb of memory)<br \/>\nNetwork device support\u00a0 &#8212;&gt;<br \/>\n\u00a0[*] Network device support<br \/>\n\u00a0Ethernet (10 or 100Mbit)\u00a0 &#8212;&gt;<br \/>\n\u00a0 [*] Ethernet (10 or 100Mbit)<br \/>\n\u00a0 (In here find your network card and check it.)<br \/>\nFilesystems\u00a0 &#8212;&gt;<br \/>\n\u00a0[*] \/proc filesystem support<\/p>\n<p>Then you add this line in your \/etc\/rc.d\/rc.local<\/p>\n<p>echo &#8220;1&#8221; &gt; \/proc\/sys\/net\/ipv4\/ip_forward () at boot time<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>If you have more then one network card, you may wanna add one as Module and<br \/>\none hard compiled (*) into the kernel, so that the kernel knows that it&#8217;s<br \/>\n2 network cards.<\/p>\n<p>Then you need to name then eth0 and eth1, this you *may* have to do<br \/>\neven if you only have 1 network card, but it&#8217;s not likely.<\/p>\n<p>I have 2 network cards, one &#8220;3com 509 B&#8221; and one &#8220;3com 905&#8221;<br \/>\nThe first thing I need to do is to is to find the module name for<br \/>\nthe network cards.<br \/>\nGo to \/lib\/modules\/2.2.14\/misc\/ and do an &#8220;ls&#8221;<br \/>\n(the 2.2.14\/ dir will be named after whatever kernel version you have,<br \/>\n`uname -r` to find out)<br \/>\nIn there I found a file called 3c59x.o (that&#8217;s the one I compiled as module),<br \/>\nthen I set that as eth0, like this:<br \/>\nI open the file \/etc\/conf.modules (or \/etc\/modules.conf depending on the<br \/>\nkernel and\u00a0 system) and add:<\/p>\n<p>alias eth0 3c59x<\/p>\n<p>Then I know the other card is a &#8220;3com 509 B&#8221; so I go to:<br \/>\n\/lib\/modules\/2.2.14\/net\/ and in there I find a 3c509.o, so I again<br \/>\nadd an alias in \/etc\/conf.modules:<\/p>\n<p>alias eth1 3c509<\/p>\n<p>Basicly, you will find the network cards you added from the kernel in either<br \/>\n\/lib\/modules\/2.2.14\/net\/ or \/lib\/modules\/2.2.14\/misc\/, or say now<br \/>\nthat you had a Linux 2.2.15 kernel then it would be:<br \/>\n\/lib\/modules\/2.2.15\/net\/ and \/lib\/modules\/2.2.15\/misc\/<\/p>\n<p>And remember to add the cardnames without the .o in the module name, as<br \/>\n3c509.o will be named 3c509 as an alias in \/etc\/conf.modules.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Now you wanna add the network card so it starts at boot time and get an IP.<br \/>\nNow you must decide what network IP it should have<br \/>\n(either 192.168.1.* or 10.0.0.* in this example I&#8217;ve used 10.0.0.*)<br \/>\nOpen or crate a file called: \/etc\/sysconfig\/network-scripts\/ifcfg-eth0<br \/>\n(if it doesn&#8217;t exist when you open it it will be created.)<\/p>\n<p>In this file type the following:<\/p>\n<p>ONBOOT=yes<br \/>\nDEVICE=eth0<br \/>\nIPADDR=10.0.0.1<br \/>\nNETMASK=255.255.255.0<br \/>\nNETWORK=10.0.0.0<br \/>\nBROADCAST=10.255.255.255<br \/>\nBOOTPROTO=none<\/p>\n<p>The save and quit.<\/p>\n<p>ifcfg-eth0 goes if this is your first network card, if it were your second<br \/>\nnetwork card on the same computer it would be ifcfg-eth1, and then the<br \/>\nDEVICE variable would say DEVICE=eth1.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>After this you need to tell your computer what IP, network name and nick name<br \/>\nit has. This you do in \/etc\/hosts.<br \/>\nBy default you should have this line in your \/etc\/hosts:<\/p>\n<p>127.0.0.1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 localhost\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 localhost.localdomain<\/p>\n<p>Now you add your new hosts, the current computer and the other computer(s),<br \/>\nhere I have used the 10.0.0.* IP range.<\/p>\n<p>10.0.0.1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 main.bogus.com main<br \/>\n10.0.0.2\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 sidekick.bogus.com sidekick<\/p>\n<p>Note that there is a TAB separating each of the 3 fields (IP hostname nick).<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>After that it&#8217;s time to set up the forwarding and everything like that using<br \/>\nipchains.<br \/>\nThis you do by adding the following lines to your \/etc\/rc.d\/rc.local<\/p>\n<p>\/sbin\/ipchains -P forward DENY<br \/>\n\/sbin\/ipchains -A forward -i eth0 -j MASQ<\/p>\n<p>You may also wanna execute the lines since \/etc\/rc.d\/rc.local only<br \/>\nloads at boot time.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>At this time you may also wanna set up a caching nameserver on your system,<br \/>\nBoth to speed up your surfing and to get your LAN (Local Area Network)<br \/>\nto interact in a proper way.<\/p>\n<p>In the following example I&#8217;ve used:<\/p>\n<p>bind-8.2.2P5-1mdk.i586.rpm<br \/>\nand<br \/>\ncaching-nameserver-6.0-3mdk.noarch.rpm<\/p>\n<p>(A nameserver is depending on bind)<\/p>\n<p>So after you installed bind and a caching-nameserver this is what you wanna do,<br \/>\n(everything in this example is based on the previously written network<br \/>\nconfigurations):<\/p>\n<p>First you need to edit a file named \/etc\/named.conf, where in you add a &#8220;zone&#8221;.<br \/>\nThe zones in this example to add, looks like this:<\/p>\n<p>zone &#8220;bogus.com&#8221; {<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 type master;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 file &#8220;bogus.com&#8221;;<br \/>\n};<\/p>\n<p>zone &#8220;0.0.10.in-addr.arpa&#8221; {<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 type master;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 file &#8220;10.0.0&#8221;;<br \/>\n};<\/p>\n<p>The first one is for the networked computers hostnames, and the second for<br \/>\nthere IP&#8217;s.<\/p>\n<p>In this example I use 10.0.0.* as the network IP, but another common network<br \/>\nIP is also 192.168.0.* &#8230;. those are the two most common\/accepted ones.<\/p>\n<p>Then you save and quit that, to go and create the files bogus.com and 10.0.0,<br \/>\nwhich you do in: \/var\/named\/<\/p>\n<p>First we can create \/var\/named\/bogus.com, and in there type the following:<\/p>\n<p>@\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 IN\u00a0\u00a0\u00a0\u00a0\u00a0 SOA\u00a0\u00a0\u00a0\u00a0 ns.bogus.com. main.bogus.com.\u00a0 (<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 2000020100 ; Serial<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 28800\u00a0\u00a0\u00a0\u00a0\u00a0 ; Refresh<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 14400\u00a0\u00a0\u00a0\u00a0\u00a0 ; Retry<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 3600000\u00a0\u00a0\u00a0 ; Expire<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 86400 )\u00a0\u00a0\u00a0 ; Minimum<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 IN\u00a0\u00a0\u00a0\u00a0\u00a0 NS\u00a0\u00a0\u00a0\u00a0\u00a0 localhost.<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 ;1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 IN\u00a0\u00a0\u00a0\u00a0\u00a0 PTR\u00a0\u00a0\u00a0\u00a0 localhost.<br \/>\nlocalhost\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 A\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 127.0.0.1<br \/>\nns\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 A\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 10.0.0.1<br \/>\nsidekick\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 A\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 10.0.0.2<br \/>\nmain\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 A\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 10.0.0.1<br \/>\nmail\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 A\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 10.0.0.1<\/p>\n<p>(What comes before the Serial, 2000020100 is a date, 2000-02-01-00, so<br \/>\nyou can type that as your current date.)<\/p>\n<p>Then you save and quit that, and crate the file: \/var\/named\/10.0.0, and in<br \/>\nthere you type this:<\/p>\n<p>@\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 IN\u00a0\u00a0\u00a0\u00a0\u00a0 SOA\u00a0\u00a0\u00a0\u00a0 ns.bogus.com. main.bogus.com.\u00a0 (<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 2000020100 ; Serial<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 28800\u00a0\u00a0\u00a0\u00a0\u00a0 ; Refresh<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 14400\u00a0\u00a0\u00a0\u00a0\u00a0 ; Retry<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 3600000\u00a0\u00a0\u00a0 ; Expire<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 86400 )\u00a0\u00a0\u00a0 ; Minimum<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 NS\u00a0\u00a0\u00a0\u00a0\u00a0 ns.bogus.com.<br \/>\n1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 PTR\u00a0\u00a0\u00a0\u00a0 main.bogus.com.<br \/>\n2\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 PTR\u00a0\u00a0\u00a0\u00a0 sidekick.bogus.com.<\/p>\n<p>Now it&#8217;s almost time to start the nameserver, but first you wanna add the<br \/>\nnameserver to your \/etc\/resolv.conf so you have any use of it.<\/p>\n<p>Open \/etc\/resolv.conf and at the top of it add:<\/p>\n<p>nameserver 10.0.0.1<\/p>\n<p>and leav the rest of the file entry&#8217;s as they are if there is any, then<br \/>\nsave and quit that.<\/p>\n<p>And now it&#8217;s time to start the nameserver.<br \/>\nTo be sure that everything works normally, do these commands:<\/p>\n<p>\/usr\/sbin\/named<br \/>\n\/usr\/sbin\/ndc restart<\/p>\n<p>And then type `nslookup`, that should look like this:<\/p>\n<p>root:~# nslookup<br \/>\nDefault Server:\u00a0 main.bogus.com<br \/>\nAddress:\u00a0 10.0.0.1<\/p>\n<p>&gt;<\/p>\n<p>If you get that, just type exit at the &#8220;&gt;&#8221;, and then add the following lines<br \/>\nto \/etc\/rc.d\/rc.local<\/p>\n<p>if<br \/>\nps aux | grep named | grep -v grep &gt;\/dev\/null ; then<br \/>\necho &gt;\/dev\/null<br \/>\nelse<br \/>\n\/usr\/sbin\/named<br \/>\n\/usr\/sbin\/ndc restart<br \/>\nfi<\/p>\n<p>This will check if you have a named running, and if not, it will start it,<br \/>\nnote that this is not the 100% correct way to do it, but it&#8217;s by far they<br \/>\nmost lazy way to do it, and it works.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>That was the basics of making a network at home and setting up a nameserver.<br \/>\nI hope it&#8217;s enough so that anyone can set up a little network at home.<\/p>\n<p>===============================================================================<br \/>\n8 &#8211; The Init and system scripts.<br \/>\n===============================================================================<\/p>\n<p>In this section I will cover the system V init, which is the most used<br \/>\ninit in Linux.<br \/>\nBeside the Syst V inti, there are also the BSD init, which is used by<br \/>\nSlackware and Debian and in some smaller distributions of Linux.<br \/>\nThe rest, as far as I know, uses the Syst V init.<br \/>\nThere are not so much difference of the two, I&#8217;ll try to cover the<br \/>\ndifferences later.<br \/>\nThe example and files here are taken from SysVinit-2.78-6 &amp; initscripts-5.27-37<br \/>\nwhich is compatible in some ways with the BSD init, I&#8217;ll come back to that<br \/>\nlater.<\/p>\n<p>So here we go:<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>The basic Syst V init comes with the following commands &amp; devices:<\/p>\n<p>\/dev\/initctl\u00a0 This is the init controll device.<br \/>\n\/sbin\/halt\u00a0 This is to shut down the system.<br \/>\n\/sbin\/init\u00a0 This is to change the init runlevel.<br \/>\n\/sbin\/killall5\u00a0 This will kill everything but the script that runs it.<br \/>\n\/sbin\/pidof\u00a0 This will get the PID of a Process name.<br \/>\n\/sbin\/poweroff\u00a0 This will power down the system.<br \/>\n\/sbin\/reboot\u00a0 This will reboot the system.<br \/>\n\/sbin\/runlevel\u00a0 This will tell the init runlevel.<br \/>\n\/sbin\/shutdown\u00a0 This will shut down the system.<br \/>\n\/sbin\/sulogin\u00a0 This is the single user mode login.<br \/>\n\/sbin\/telinit\u00a0 This is the init process control initialization.<br \/>\n\/usr\/bin\/last\u00a0 This shows who was in the system last.<br \/>\n\/usr\/bin\/lastb\u00a0 This is about the same as last.<br \/>\n\/usr\/bin\/mesg\u00a0 This is to toggle writeble mode on your tty.<br \/>\n\/usr\/bin\/utmpdump This dumps a file for utmp (this lacks documentation)<br \/>\n\/usr\/bin\/wall\u00a0 This sends a message to all ttys.<\/p>\n<p>And then the init needs the following extra files\/dirs and commands from<br \/>\nthe initscripts package:<\/p>\n<p>\/bin\/doexec\u00a0 This lets you run a program under another name.<br \/>\n\/bin\/ipcalc\u00a0 This lets you manipulate IP addresses.<br \/>\n\/bin\/usleep\u00a0 This sleeps for microseconds.<br \/>\n\/etc\/X11\/prefdm\u00a0 This is the display manager preferrence file for X.<br \/>\n\/etc\/adjtime\u00a0 This is the Kernel Clock Config file.<br \/>\n\/etc\/init.d\u00a0 BSD init compatibilety directory.<br \/>\n\/etc\/initlog.conf This is the initlog configuration file.<br \/>\n\/etc\/inittab\u00a0 This is the main init configuration file.<br \/>\n\/etc\/modules\u00a0 This is where the kernel loads modules from at boot.<br \/>\n\/etc\/ppp\/ip-down This is a script for dialup internet connections.<br \/>\n\/etc\/ppp\/ip-up\u00a0 This is a script for dialup internet connections.<br \/>\n\/etc\/profile.d\/inputrc.csh Shell Key bindings for csh and tcsh.<br \/>\n\/etc\/profile.d\/inputrc.sh Shell Key bindings for sh and bash.<br \/>\n\/etc\/profile.d\/lang.csh\u00a0 Language files &#8211; i18n stuff for csh and tcsh.<br \/>\n\/etc\/profile.d\/lang.sh\u00a0 Language files &#8211; i18n stuff for sh and bash.<br \/>\n\/etc\/profile.d\/tmpdir.csh Set temporary directory for csh and tcsh.<br \/>\n\/etc\/profile.d\/tmpdir.sh Set temporary directory for sh and bash.<br \/>\n\/etc\/rc.d\/init.d\/functions Functions for scripts in init.d<br \/>\n\/etc\/rc.d\/init.d\/halt\u00a0 Runlevel 0 (shutdown\/halt) script.<br \/>\n\/etc\/rc.d\/init.d\/kheader Script to regenerate the \/boot\/kernel.h file.<br \/>\n\/etc\/rc.d\/init.d\/killall Script to make sure everything is shut off.<br \/>\n\/etc\/rc.d\/init.d\/mandrake_everytime Mandrake specific stuff.<br \/>\n\/etc\/rc.d\/init.d\/mandrake_firstime Mandrake post install stuff.<br \/>\n\/etc\/rc.d\/init.d\/netfs\u00a0 Mounts network filesystems.<br \/>\n\/etc\/rc.d\/init.d\/network Bring up\/down networking.<br \/>\n\/etc\/rc.d\/init.d\/random\u00a0 Script to help random number generation.<br \/>\n\/etc\/rc.d\/init.d\/rawdevices Device stuff for applications such as Oracle.<br \/>\n\/etc\/rc.d\/init.d\/single\u00a0 Single user script (runlevel 1)<br \/>\n\/etc\/rc.d\/init.d\/sound\u00a0 Launch sound.<br \/>\n\/etc\/rc.d\/init.d\/usb\u00a0 Launch USB support.<br \/>\n\/etc\/rc.d\/rc.local\u00a0 Boot time script, (like autoexec.bat in DOS).<br \/>\n\/etc\/rc.d\/rc.modules\u00a0 Bootup script for modules.<br \/>\n\/etc\/rc.d\/rc.sysinit\u00a0 Main system startup script.<br \/>\n\/etc\/rc.d\/rc0.d\/S00killall Runlevel 0 killall script link.<br \/>\n\/etc\/rc.d\/rc0.d\/S01halt\u00a0 Runlevel 0 halt script link.<br \/>\n\/etc\/rc.d\/rc1.d\/S00single Runlevel 1 single script link.<br \/>\n\/etc\/rc.d\/rc2.d\/S99local Runlevel 2 local script link. (rc.local)<br \/>\n\/etc\/rc.d\/rc3.d\/S99local Runlevel 3 local script link. (rc.local)<br \/>\n\/etc\/rc.d\/rc4.d\u00a0\u00a0 Runlevel 4 directory.<br \/>\n\/etc\/rc.d\/rc5.d\/S99local Runlevel 5 local script link. (rc.local)<br \/>\n\/etc\/rc.d\/rc6.d\/S00killall Runlevel 6 killall script link.<br \/>\n\/etc\/rc.d\/rc6.d\/S01reboot Runlevel 6 reboot script link.<br \/>\n\/etc\/rc.local\u00a0\u00a0 BSD init compatibilety file&#8230;. ?<br \/>\n\/etc\/rc.sysinit\u00a0\u00a0 BSD init compatibilety file&#8230;. ?<br \/>\n\/etc\/rc0.d\u00a0\u00a0 BSD init compatibilety directory.<br \/>\n\/etc\/rc1.d\u00a0\u00a0 BSD init compatibilety directory.<br \/>\n\/etc\/rc2.d\u00a0\u00a0 BSD init compatibilety directory.<br \/>\n\/etc\/rc3.d\u00a0\u00a0 BSD init compatibilety directory.<br \/>\n\/etc\/rc4.d\u00a0\u00a0 BSD init compatibilety directory.<br \/>\n\/etc\/rc5.d\u00a0\u00a0 BSD init compatibilety directory.<br \/>\n\/etc\/rc6.d\u00a0\u00a0 BSD init compatibilety directory.<br \/>\n\/etc\/sysconfig\/console\u00a0 Directory for console stuff, like the keymap.<br \/>\n\/etc\/sysconfig\/init\u00a0 Basic init boot configurations.<br \/>\n\/etc\/sysconfig\/network-scripts\/ifcfg-lo\u00a0 Network config for localhost.<br \/>\n\/etc\/sysconfig\/network-scripts\/ifdown\u00a0 Turning off interfaces script.<br \/>\n\/etc\/sysconfig\/network-scripts\/ifdown-post Post stuff for ifdown.<br \/>\n\/etc\/sysconfig\/network-scripts\/ifdown-ppp Turning off ppp.<br \/>\n\/etc\/sysconfig\/network-scripts\/ifdown-sl Turning off SLIP.<br \/>\n\/etc\/sysconfig\/network-scripts\/ifup\u00a0 Turning on interfaces script.<br \/>\n\/etc\/sysconfig\/network-scripts\/ifup-aliases Turning on alias interfaces.<br \/>\n\/etc\/sysconfig\/network-scripts\/ifup-ipx\u00a0 Turning on IPX.<br \/>\n\/etc\/sysconfig\/network-scripts\/ifup-plip Turning on PLIP.<br \/>\n\/etc\/sysconfig\/network-scripts\/ifup-post Post stuff for ifup.<br \/>\n\/etc\/sysconfig\/network-scripts\/ifup-ppp\u00a0 Turning on ppp.<br \/>\n\/etc\/sysconfig\/network-scripts\/ifup-routes Turning on routes.<br \/>\n\/etc\/sysconfig\/network-scripts\/ifup-sl\u00a0 Turning on SLIP.<br \/>\n\/etc\/sysconfig\/network-scripts\/network-functions\u00a0\u00a0\u00a0\u00a0 Functions for the scripts.<br \/>\n\/etc\/sysconfig\/rawdevices Raw device bindings.<br \/>\n\/etc\/sysctl.conf\u00a0 System Control configurations.<br \/>\n\/sbin\/consoletype\u00a0 This prints the console type.<br \/>\n\/sbin\/getkey\u00a0\u00a0 Prints the key strokes&#8230;.<br \/>\n\/sbin\/ifdown\u00a0\u00a0 Application for the previous config files.<br \/>\n\/sbin\/ifup\u00a0\u00a0 Application for the previous config files.<br \/>\n\/sbin\/initlog\u00a0\u00a0 Logs msgs and events to the system logger.<br \/>\n\/sbin\/installkernel\u00a0 Installs a kernel (not for manual use).<br \/>\n\/sbin\/minilogd\u00a0\u00a0 * Totally lacking documentation.<br \/>\n\/sbin\/netreport\u00a0\u00a0 Reports changes of the network interface.<br \/>\n\/sbin\/ppp-watch\u00a0\u00a0 Application used by ifup-ppp.<br \/>\n\/sbin\/service\u00a0\u00a0 Can send commands to all services etc.<br \/>\n\/sbin\/setsysfont\u00a0 Sets the system font.<br \/>\n\/usr\/bin\/listhome\u00a0 Lists the users home directorys.<br \/>\n\/usr\/sbin\/detectloader\u00a0 Detect the current boot loader.<br \/>\n\/usr\/sbin\/supermount\u00a0 Automatic mount\/umount application.<br \/>\n\/usr\/sbin\/sys-unconfig\u00a0 System reconfiguration tool.<br \/>\n\/usr\/sbin\/usernetctl\u00a0 User Network interface control application.<br \/>\n\/var\/log\/wtmp\u00a0\u00a0 Previously logged in users entrys.<br \/>\n\/var\/run\/netreport\u00a0 Directory for the netreport application.<br \/>\n\/var\/run\/utmp\u00a0\u00a0 Currently logged in users entrys.<\/p>\n<p>So what do you really need to know of all that ?<\/p>\n<p>Well, here&#8217;s the simple basics of how it works and what you need to remember.<\/p>\n<p>The \/etc\/inittab is already explained.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Here is how the runlevels works:<\/p>\n<p>The Runlevel can be one of 1 to 6 and the number means this:<\/p>\n<p>0 &#8211; halt<br \/>\n1 &#8211; Single user mode<br \/>\n2 &#8211; Multiuser, without NFS<br \/>\n3 &#8211; Full multiuser mode<br \/>\n4 &#8211; Unused<br \/>\n5 &#8211; X11<br \/>\n6 &#8211; reboot<\/p>\n<p>You change the runlevel with the `init` command, so say that you are<br \/>\nint runlevel 3 and you wanna go to single user mode for some reason,<br \/>\nthen you can do: init 1<br \/>\nIn a single user mode you can only be one user, root.<br \/>\nAnd in a single user enviorment you can&#8217;t do networking and<br \/>\nother tasks, the runlevel 1 is meant to be there for system maintenence.<\/p>\n<p>The two mostly used runlevels as default is 3 and 5.<br \/>\nMandrake and RedHat etc. uses Runlevel 5 as default, and so they<br \/>\nstart up with a GUI in X Windows.<\/p>\n<p>Typing init 0 will shut down the system, and typing runlevel 6 will<br \/>\nreboot the system.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>What determes what the various runlevels actually start at boot time<br \/>\nis what is in there respective directory:<\/p>\n<p>Runlevel 0: \/etc\/rc.d\/rc0.d\/<br \/>\nRunlevel 1: \/etc\/rc.d\/rc1.d\/<br \/>\nRunlevel 2: \/etc\/rc.d\/rc2.d\/<br \/>\nRunlevel 3: \/etc\/rc.d\/rc3.d\/<br \/>\nRunlevel 4: \/etc\/rc.d\/rc4.d\/<br \/>\nRunlevel 5: \/etc\/rc.d\/rc5.d\/<br \/>\nRunlevel 6: \/etc\/rc.d\/rc6.d\/<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>So, here say that you wanna stop your web server from starting at boot time.<br \/>\nThe first thing you wanna do is to find out what runlevel you are in, that<br \/>\nyou do with the runlevel command like this:<\/p>\n<p>alien:~$ runlevel<br \/>\nN 3<br \/>\nalien:~$<\/p>\n<p>This means that you are in runlevel 3.<br \/>\nSo from here go to \/etc\/rc.d\/rc3.d\/ which is the directory for runlevel 3.<\/p>\n<p>alien:~$ cd \/etc\/rc.d\/rc3.d\/<br \/>\nalien: \/etc\/rc.d\/rc3.d\/ $<\/p>\n<p>Here you find the file that starts the webserver (this file is usually<br \/>\ncalled httpd with a character and a number infront of it (I&#8217;ll explain the<br \/>\ncharacter and the numbers soon), so list the contents of the current<br \/>\ndirectory and find it, or just do like this:<\/p>\n<p>alien: \/etc\/rc.d\/rc3.d\/ $ ls -l *httpd<br \/>\nlrwxrwxrwx\u00a0\u00a0\u00a0 1 root\u00a0\u00a0\u00a0\u00a0 root\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 15 Dec\u00a0 5 06:14 S85httpd -&gt; ..\/init.d\/httpd<br \/>\nalien: \/etc\/rc.d\/rc3.d\/ $<\/p>\n<p>This says that S85httpd is a link to \/etc\/rc.d\/init.d\/httpd<br \/>\n(..\/init.d\/ if you&#8217;re standing in \/etc\/rc.d\/init.d\/ mean \/etc\/rc.d\/init.d\/)<\/p>\n<p>So just remove the link like this:<\/p>\n<p>alien: \/etc\/rc.d\/rc3.d\/ $ rm -f S85httpd<br \/>\nalien: \/etc\/rc.d\/rc3.d\/ $<\/p>\n<p>And that&#8217;s how you stop something from starting with the runlevel.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Now, if you rather would have something more start with the runlevel<br \/>\nat boot time you do like this:<\/p>\n<p>You make a simple script that starts what you wanna have started and<br \/>\nput it in \/etc\/rc.d\/init.d\/.<br \/>\nSay that your scripts name is &#8220;mystart&#8221;, you are in runlevel 3 and you have<br \/>\nmade your script executable (chmod a+x mystart), and you have it<br \/>\nin your own home directory, then you do like this:<\/p>\n<p>alien: ~$ cp mystart \/etc\/rc.d\/init.d\/<br \/>\nalien: ~$ cd \/etc\/rc.d\/rc3.d<br \/>\nalien: \/etc\/rc.d\/rc3.d\/ $ ln -s ..\/init.d\/mystart Z00mystart<br \/>\nalien: \/etc\/rc.d\/rc3.d\/ $<\/p>\n<p>And that&#8217;s all of that.<\/p>\n<p>So now, what does the Z00 in Z00mystart or S85 in S85httpd mean ?<br \/>\nWell, as the system starts it will read file after file in it&#8217;s runlevels<br \/>\ndirectory in alphabetical order, so to get them to start in a preticular<br \/>\norder, the link names are made to determen that order.<br \/>\nSo the later in the alphabet the first character is the later it will boot,<br \/>\nand the same for for the number, the higher number the later it will start.<\/p>\n<p>So A00something will start before A01something<br \/>\nAnd Z99something will start later then X99something and so on.<\/p>\n<p>To get something to start at boot time you can also add it as a command<br \/>\nin the \/etc\/rc.d\/rc.local (or for some systems \/etc\/rc.local) file.<br \/>\nThat file is meant to be used for single commands and not to start up<br \/>\nmajor things like a server etc.<\/p>\n<p>Always try to load things with the actual runlevel which is the more correct<br \/>\nway, rather then adding them to the rc.local file<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>So what&#8217;s the difference between the BSD init and the System V init ?<br \/>\nThe only thing that differs them that you need to rememer is that they<br \/>\nstore the startup scripts in different places.<\/p>\n<p>The startup scripts for the BSD init is mainly in the following places:<\/p>\n<p>\/etc\/rc0.d\/<br \/>\n\/etc\/rc1.d\/<br \/>\n\/etc\/rc2.d\/<br \/>\n\/etc\/rc3.d\/<br \/>\n\/etc\/rc4.d\/<br \/>\n\/etc\/rc5.d\/<br \/>\n\/etc\/rc6.d\/<br \/>\n\/etc\/rc.boot\/<br \/>\n\/etc\/rcS.d\/<br \/>\n\/etc\/init.d\/<\/p>\n<p>While the Syst V init stores its scripts mainly in:<\/p>\n<p>\/etc\/rc.d\/rc0.d\/<br \/>\n\/etc\/rc.d\/rc1.d\/<br \/>\n\/etc\/rc.d\/rc2.d\/<br \/>\n\/etc\/rc.d\/rc3.d\/<br \/>\n\/etc\/rc.d\/rc4.d\/<br \/>\n\/etc\/rc.d\/rc5.d\/<br \/>\n\/etc\/rc.d\/rc6.d\/<br \/>\n\/etc\/rc.d\/init.d\/<\/p>\n<p>In the BSD init the \/etc\/rc.boot\/ and the \/etc\/rcS.d\/ directorys<br \/>\nare more or less substitutes for the rc.local file since you can<br \/>\nput things in them that starts up at boot time&#8230;<br \/>\nwhat you put in \/etc\/rcS.d\/ will even start at single user mode,<br \/>\nso be careful what you put there.<\/p>\n<p>So basically, the actual scripts goes in the init.d directory<br \/>\nand you link them to the runlevel directory with a prefix to determen where<br \/>\nin the bootup they should be loaded.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Here is an example of how an init script can be made.<br \/>\nHere I made a script that would start a daemon named &#8220;daemon&#8221;<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>#!\/bin\/sh<br \/>\n# example Example init script that would load &#8216;daemon&#8217;<br \/>\n#<br \/>\n# Version: @(#) \/etc\/rc.d\/inet.d\/example 0.01 19-Feb-2001<br \/>\n#<br \/>\n# Author: Billy (Alien), &lt;<a href=\"mailto:alien@ktv.koping.se\">alien@ktv.koping.se<\/a>&gt;<br \/>\n#<\/p>\n<p>. \/etc\/rc.d\/init.d\/functions<\/p>\n<p>function status() {<br \/>\n\u00a0 ps aux | grep daemon &amp;&amp;<br \/>\n\u00a0 echo &#8220;Daemon is running.&#8221; ||<br \/>\n\u00a0 echo &#8220;Daemon is not running.&#8221;<br \/>\n}<\/p>\n<p>case &#8220;$1&#8221; in<br \/>\n\u00a0\u00a0\u00a0 start)<br \/>\n\u00a0\u00a0\u00a0 # Check if daemon is in our path.<br \/>\n\u00a0\u00a0\u00a0 if `which daemon` &gt; \/dev\/null; then success || failure; fi<br \/>\n\u00a0\u00a0\u00a0 echo -n &#8220;Starting Daemon&#8221;<br \/>\n\u00a0daemon<br \/>\n\u00a0\u00a0\u00a0 echo<br \/>\n\u00a0\u00a0 ;;<br \/>\n\u00a0\u00a0\u00a0 stop)<br \/>\n\u00a0\u00a0\u00a0 # Check if daemon is in our path again.<br \/>\n\u00a0\u00a0\u00a0 if `which daemon` &gt; \/dev\/null; then success || failure; fi<br \/>\n\u00a0\u00a0\u00a0 echo &#8220;Stopping Daemon&#8221;<br \/>\n\u00a0killall -15 daemon<br \/>\n\u00a0\u00a0 ;;<br \/>\n\u00a0\u00a0\u00a0 status)<br \/>\n\u00a0\u00a0\u00a0 echo &#8220;Status of Daemon:&#8221;<br \/>\n\u00a0status<br \/>\n\u00a0\u00a0 ;;<br \/>\n\u00a0\u00a0\u00a0 reload)<br \/>\n\u00a0\u00a0\u00a0 echo &#8220;Restarting Daemon.&#8221;<br \/>\n\u00a0killall -1 daemon<br \/>\n\u00a0\u00a0 ;;<br \/>\n\u00a0\u00a0\u00a0 restart)<br \/>\n\u00a0\u00a0\u00a0 if `which echo` &gt; \/dev\/null; then success || failure; fi<br \/>\n\u00a0\u00a0\u00a0 $0 stop<br \/>\n\u00a0\u00a0\u00a0 $0 start<br \/>\n\u00a0\u00a0 ;;<br \/>\n\u00a0\u00a0\u00a0 *)<br \/>\n\u00a0\u00a0\u00a0 echo &#8220;Usage: $0 start|stop|restart|status&#8221;<br \/>\n\u00a0\u00a0\u00a0 exit 0<br \/>\nesac<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>A note is that the success and failure functions\/commands come from<br \/>\nthe \/etc\/rc.d\/init.d\/functions file, which may not be present in all<br \/>\ndistributions of Linux, since it as far as I know only comes with<br \/>\nRedHat and Mandrake.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>The inits main configuration file is the \/etc\/inittab file, here is where<br \/>\nyou set which runlevel you you wanna have, and how many consoles you want<br \/>\netc, so here we go:<\/p>\n<p>The line where you actually set the runlevel looks like this (here runlevel 3):<\/p>\n<p>id:3:initdefault:<\/p>\n<p>Most RedHat like systems have runlevel 3 or 5 as default, but if you don&#8217;t<br \/>\nhave any networking, you may find it better to change to runlevel 2.<\/p>\n<p>Next in this file should be the system initialization.<\/p>\n<p>si::sysinit:\/etc\/rc.d\/rc.sysinit<\/p>\n<p>This line tells the system the path to the rc.sysinit where it loads<br \/>\nalot in the system, as system clock, sets the hostname, and<br \/>\nperforms a number of checks.<\/p>\n<p>Next in line is this:<\/p>\n<p>l0:0:wait:\/etc\/rc.d\/rc 0<br \/>\nl1:1:wait:\/etc\/rc.d\/rc 1<br \/>\nl2:2:wait:\/etc\/rc.d\/rc 2<br \/>\nl3:3:wait:\/etc\/rc.d\/rc 3<br \/>\nl4:4:wait:\/etc\/rc.d\/rc 4<br \/>\nl5:5:wait:\/etc\/rc.d\/rc 5<br \/>\nl6:6:wait:\/etc\/rc.d\/rc 6<\/p>\n<p>This tells the system where to load the programs and daemons it should load<br \/>\nfor the runlevel it&#8217;s in.<br \/>\nSay that we are in runlevel 3 (Default) then it looks at this line:<\/p>\n<p>l3:3:wait:\/etc\/rc.d\/rc 3<\/p>\n<p>And there after goes to load all what&#8217;s in \/etc\/rc.d\/rc3.d\/<br \/>\n(rc3.d or any rc?.d contains links to the real files or scripts<br \/>\nthat&#8217;s located in \/etc\/rc.d\/init.d, so if you wanna add something to<br \/>\nyour runlevel, just look how they have done it and do it in a similar fashion.<br \/>\nand make sure to not start any network dependent application before the<br \/>\nnetwork starts and so on&#8230;)<\/p>\n<p>Then it comes some other various stuff as trap the Ctrl+Alt+Del etc.<\/p>\n<p>After this comes the tty&#8217;s (Terminal Types), and there locations.<\/p>\n<p>1:2345:respawn:\/sbin\/mingetty tty1<br \/>\n2:2345:respawn:\/sbin\/mingetty tty2<br \/>\n3:2345:respawn:\/sbin\/mingetty tty3<br \/>\n4:2345:respawn:\/sbin\/mingetty tty4<br \/>\n5:2345:respawn:\/sbin\/mingetty tty5<br \/>\n6:2345:respawn:\/sbin\/mingetty tty6<\/p>\n<p>If you wanna add some more you can add like this:<\/p>\n<p>8:2345:respawn:\/sbin\/mingetty tty8<br \/>\n9:2345:respawn:\/sbin\/mingetty tty9<br \/>\n10:2345:respawn:\/sbin\/mingetty tty10<br \/>\n11:2345:respawn:\/sbin\/mingetty tty11<\/p>\n<p>And leav tty7 reserved for X-windows.<\/p>\n<p>Last in the file should only be some line about xdm and it&#8217;s location,<br \/>\nthis is if you have xdm installed&#8230;<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>And if you have read the tutorial to this point you shouldent need any real<br \/>\nexplanation of this script.<\/p>\n<p>If you still dont understand how the init scripts work, read the<br \/>\nscripts in your system and try to understand them.<br \/>\nAnd also read this section about the init and the init scripts again.<\/p>\n<p>===============================================================================<br \/>\n9 &#8211; Basic Linux\/UNIX commands and operations.<br \/>\n===============================================================================<\/p>\n<p>This section is about Linux and UNIX basic commands and operations, and some<br \/>\nother explanations and tricks, since this is not a command bible,<br \/>\nI&#8217;ll explain each command breafly, with alot of help from the<br \/>\nman pages and the &#8211;help argument (let&#8217;s all thank the maker for cut &amp; paste).<br \/>\nThen again, I&#8217;ve seen files that have claimed to be UNIX command bibles<br \/>\nthat are even breafer and hold less commands&#8230; though most of the authors<br \/>\nof those seems to be totally uncapeble of handling a UNIX and cant even spell,<br \/>\none of the worst examples I&#8217;ve seen was something like this:<br \/>\n&#8220;The UNIX bible, in this phile is all the UNIX commandz j00 need&#8221;<br \/>\nAnd after that was a list of commands without arguments&#8230; needless to say<br \/>\nis also that 99% of all UNIX commands were missing.<br \/>\nAnyway, enough of me making fun of those people now, and on with the tutorial.<br \/>\n(Which isn&#8217;t a UNIX command bible, just a note)<br \/>\nI will refer to &#8220;*nix&#8221; here, and that means any sort of UNIX system,<br \/>\nLinux, BSD, Solaris, SunOS, Xenix and so on included.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>Here are the basic *nix commands, with breaf explanations.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>adduser<br \/>\n\u00a0Syntax: adduser [arguments] &lt;user&gt;<br \/>\n\u00a0And can be used with the following arguments:<br \/>\n\u00a0-u uid<br \/>\n\u00a0-g group<br \/>\n\u00a0-G group,&#8230;<br \/>\n\u00a0-d home directory<br \/>\n\u00a0-s shell<br \/>\n\u00a0-c comment<br \/>\n\u00a0-k template<br \/>\n\u00a0-f inactive<br \/>\n\u00a0-e expire mm\/dd\/yy<br \/>\n\u00a0-p passwd<br \/>\n\u00a0Then there are a few arguments with no explanation:<br \/>\n\u00a0-o, -m, -n, and -r<br \/>\n\u00a0So say that you wanna add a user named &#8220;user&#8221; with password &#8220;resu&#8221;<br \/>\n\u00a0belonging to the group root with \/ as home directory using \/bin\/tcsh<br \/>\n\u00a0as shell, that would look as this:<\/p>\n<p>\u00a0adduser -p resu -g root -d \/ -s \/bin\/tcsh user<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>alias<br \/>\n\u00a0The alias command set&#8217;s an alias, as this: alias du=&#8217;du -h&#8217;<br \/>\n\u00a0This means that whenever you type: du<br \/>\n\u00a0it will really do: du -h<\/p>\n<p>\u00a0Typing alias by it self will display all set aliases.<\/p>\n<p>\u00a0For more information on the alias command do: help alias<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>apropos<br \/>\n\u00a0apropos checks for strings in the whatis database. say that you<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 are looking for a manual page about the `shutdown` command.<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Then you can do: apropos shutdown<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 for more information, do: man whatis<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Or: man apropos<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>awk<br \/>\n\u00a0awk is a text formatting tool, that is HUGE, it&#8217;s actually a whole<br \/>\n\u00a0language, some say it&#8217;s not totally wrong to say that awk is not<br \/>\n\u00a0far off from a scripting version of C.<br \/>\n\u00a0However I wouldent go as far as to say that there resemblance<br \/>\n\u00a0is that great.<br \/>\n\u00a0awk&#8217;s most common use is about the same as &#8216;cut&#8217;, and it works like<br \/>\n\u00a0this: awk [argument-1] [argument-2] &#8230;.<br \/>\n\u00a0Here&#8217;s some example&#8217;s of converting an URL:<\/p>\n<p>\u00a0echo &#8220;<a href=\"http:\/\/www.bogus.com\/one\/two.htm\">http:\/\/www.bogus.com\/one\/two.htm<\/a>&#8221; | awk -F&#8217;\/&#8217; &#8216;{print $3}&#8217;<br \/>\n\u00a0This will return: <a href=\"http:\/\/www.bogus.com\">www.bogus.com<\/a><br \/>\n\u00a0The -F will set a delimiter, and the &#8216;{print $3}&#8217; will print the<br \/>\n\u00a0third feild, separated by the delimiter, which is <a href=\"http:\/\/www.bogus.com\">www.bogus.com<\/a>,<br \/>\n\u00a0because there is 2 slashes, which makes the second slash the second<br \/>\n\u00a0feild, and so <a href=\"http:\/\/www.bogus.com\">www.bogus.com<\/a> is the third feild.<br \/>\n\u00a0Here&#8217;s another example:<\/p>\n<p>\u00a0echo &#8220;<a href=\"http:\/\/www.bogus.com\/one\/two.htm\">http:\/\/www.bogus.com\/one\/two.htm<\/a>&#8221; | awk -F&#8217;\/&#8217; &#8216;{print $(NF)}&#8217;<br \/>\n\u00a0This will return: two.htm<br \/>\n\u00a0The -F set&#8217;s the delimiter, which once again is \/, but this time<br \/>\n\u00a0we have used $NF which always resembles the last feild.<br \/>\n\u00a0Another example with NF is this:<\/p>\n<p>\u00a0echo &#8220;<a href=\"http:\/\/www.bogus.com\/one\/two.htm\">http:\/\/www.bogus.com\/one\/two.htm<\/a>&#8221; | awk -F&#8217;\/&#8217; &#8216;{print $(NF &#8211; 1)}&#8217;<br \/>\n\u00a0This will return: one<br \/>\n\u00a0Because $(NF &#8211; 1) means the last feild minus one feild, which always<br \/>\n\u00a0will be the next last feild.<\/p>\n<p>\u00a0You only have to use the ()&#8217;s around variables when you do something<br \/>\n\u00a0with them like here &#8220;$(NF &#8211; 1)&#8221;, but you can use $(var) all the time<br \/>\n\u00a0if you want.<\/p>\n<p>\u00a0Here&#8217;s another example:<\/p>\n<p>echo &#8220;<a href=\"http:\/\/www.bogus.com\/one\/two.htm\">http:\/\/www.bogus.com\/one\/two.htm<\/a>&#8221; | awk -F&#8217;\/&#8217; &#8216;{print $3 &#8220;\/&#8221; $(NF &#8211; 1)}&#8217;<\/p>\n<p>\u00a0This will return: <a href=\"http:\/\/www.bogus.com\/one\">www.bogus.com\/one<\/a><br \/>\n\u00a0It will first print out the third feild separated by \/&#8217;s, which is<br \/>\n\u00a0<a href=\"http:\/\/www.bogus.com\">www.bogus.com<\/a>, then it will print a \/, and then it will print out<br \/>\n\u00a0the next last feild which is one.<\/p>\n<p>\u00a0Here is a very shoer final example of awk:<\/p>\n<p>echo &#8220;<a href=\"http:\/\/www.bogus.com\/one\/two.htm\">http:\/\/www.bogus.com\/one\/two.htm<\/a>&#8221; | awk &#8216;{ while\u00a0 ( $(1) ) print }&#8217;<\/p>\n<p>\u00a0This will return: &#8220;<a href=\"http:\/\/www.bogus.com\/one\/two.htm\">http:\/\/www.bogus.com\/one\/two.htm<\/a>&#8221; forever.<br \/>\n\u00a0The &#8220;while ( $(1) )&#8221; means that as long as there is first feild,<br \/>\n\u00a0it will print the line line.<br \/>\n\u00a0And since there will always be a first feild it will continue<br \/>\n\u00a0forever.<br \/>\n\u00a0while in awk works as this: while ( condition ) action<\/p>\n<p>\u00a0As I said, awk is huge and is actually a whole language, so<br \/>\n\u00a0to explain all of it it would need a tutorial of it&#8217;s own.<br \/>\n\u00a0So I will not go any deeper into awk here, but you can as always<br \/>\n\u00a0read it&#8217;s manual page which is quite large.<\/p>\n<p>\u00a0So, for more info do: man awk<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>basename<br \/>\n\u00a0basename will strip directory and suffix from filenames.<br \/>\n\u00a0This command only have the two following flags:<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;help\u00a0\u00a0\u00a0\u00a0\u00a0 display this help and exit<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;version\u00a0\u00a0 output version information and exit<\/p>\n<p>\u00a0It works like this:<br \/>\n\u00a0alien:~$ basename \/usr\/local\/bin\/BitchX -a<br \/>\n\u00a0BitchX<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 alien:~$ basename <a href=\"http:\/\/www.domain.com\/path\/to\/file.html\">http:\/\/www.domain.com\/path\/to\/file.html<\/a><br \/>\n\u00a0file.html<br \/>\n\u00a0alien:~$<\/p>\n<p>\u00a0For more info do: man basename<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>bc<br \/>\n\u00a0A precision calculator, can be used with the following arguments:<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -l\u00a0\u00a0\u00a0\u00a0 Define the standard math library.<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -w\u00a0\u00a0\u00a0\u00a0 Give warnings for extensions to POSIX bc.<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -s\u00a0\u00a0\u00a0\u00a0 Process exactly the POSIX bc language.<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -q\u00a0\u00a0\u00a0\u00a0 Do not print the normal GNU bc welcome.<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -v\u00a0\u00a0\u00a0\u00a0 Print the version number and copyright and quit.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>BitchX<br \/>\n\u00a0BitchX is usually not default on any system, but it&#8217;s the far<br \/>\n\u00a0msot advanced IRC client to *nix.<br \/>\n\u00a0BitchX started as a script to ircii (ircii is irc2 an extended<br \/>\n\u00a0irc protocol, also EPIC which is more bareboned then BitchX is<br \/>\n\u00a0made from ircii), until BitchX got hard coded to the protocol<br \/>\n\u00a0in C, by panasync I belive.<\/p>\n<p>\u00a0BitchX has alot of arguments but can be executed without any<br \/>\n\u00a0arguments.<br \/>\n\u00a0This is the synatx: BitchX [arguments] &lt;nickname&gt; &lt;server list&gt;<br \/>\n\u00a0And here are the arguments anyway:<\/p>\n<p>\u00a0-H &lt;hostname&gt; this is if you have a virtual host.<br \/>\n\u00a0-c &lt;#channel&gt; auto join a channel, use a \\ infront of the #<br \/>\n\u00a0-b\u00a0 load .bitchxrc or .ircrc after connecting to a server<br \/>\n\u00a0-p &lt;port&gt; connect on port (default is 6667)<br \/>\n\u00a0-f\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 your terminal uses flow controls (^S\/^Q),<br \/>\n\u00a0\u00a0 so BitchX shouldn&#8217;t<br \/>\n\u00a0-F\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 your terminal doesn&#8217;t use flow control (default)<br \/>\n\u00a0-d\u00a0 dumb terminal mode (no ncurses)<br \/>\n\u00a0-q\u00a0 dont load the rc file ~\/.ircrc<br \/>\n\u00a0-r &lt;file&gt;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 loads file as list of servers to connect to<br \/>\n\u00a0-n &lt;nickname&gt; set the nickname to use<br \/>\n\u00a0-a\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 adds default servers and command line servers<br \/>\n\u00a0\u00a0 to server list<br \/>\n\u00a0-x\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 runs BitchX in &#8220;debug&#8221; mode<br \/>\n\u00a0-Z\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 use NAT address when doing dcc<br \/>\n\u00a0-P\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 toggle check pid.nickname for running program<br \/>\n\u00a0-v\u00a0 show client version<br \/>\n\u00a0-B\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 fork BitchX and return you to shell. pid check on.<br \/>\n\u00a0-l &lt;file&gt;\u00a0\u00a0\u00a0\u00a0 loads &lt;file&gt; in place of your ~\/.ircrc<br \/>\n\u00a0-L &lt;file&gt;\u00a0\u00a0\u00a0\u00a0 loads &lt;file&gt; in place of your .ircrc and<br \/>\n\u00a0\u00a0 expands $ expandos<\/p>\n<p>\u00a0The most common way of starting BitchX is this, say that you want<br \/>\n\u00a0to have the nick &#8216;Bash&#8217; on server irc.bogus.com, then you can do:<\/p>\n<p>\u00a0BitchX Bash irc.bogus.com<\/p>\n<p>\u00a0There is so much to say about BitchX that it would need a tutorial<br \/>\n\u00a0of it&#8217;s own, I&#8217;m currently writing a BitchX script, so maybe<br \/>\n\u00a0I&#8217;ll write a BitchX tutorial some time =)<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>bzcat<\/p>\n<p>\u00a0bzcat will uncompress a .bz2 file &#8216;on the fly&#8217; as it cat&#8217;s it.<br \/>\n\u00a0the actual file will remain compressed after bzcat has displayed<br \/>\n\u00a0the contents.<br \/>\n\u00a0bzcat has to my knowlidge only one switch, and that&#8217;s<br \/>\n\u00a0-s, that uses less memory.<br \/>\n\u00a0bzcat works like this:<\/p>\n<p>\u00a0bzcat file.bz2<\/p>\n<p>\u00a0This can be good if you wanna search something in a text file<br \/>\n\u00a0that has been bzip2&#8217;d.<br \/>\n\u00a0Examples:<\/p>\n<p>\u00a0bzcat file.bz2 | grep &#8216;text string&#8217;<br \/>\n\u00a0bzcat file.bz2 | wc -l<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>bzip2<\/p>\n<p>\u00a0Compression tool, compresses harder then the standard gzip.<br \/>\n\u00a0bzip2 can be used with the following arguments:<br \/>\n\u00a0-h &#8211;help\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 print this message<br \/>\n\u00a0-d &#8211;decompress\u00a0\u00a0\u00a0\u00a0 force decompression<br \/>\n\u00a0-z &#8211;compress\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 force compression<br \/>\n\u00a0-k &#8211;keep\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 keep (don&#8217;t delete) input files<br \/>\n\u00a0-f &#8211;force\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 overwrite existing output files<br \/>\n\u00a0-t &#8211;test\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 test compressed file integrity<br \/>\n\u00a0-c &#8211;stdout\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 output to standard out<br \/>\n\u00a0-q &#8211;quiet\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 suppress noncritical error messages<br \/>\n\u00a0-v &#8211;verbose\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 be verbose (a 2nd -v gives more)<br \/>\n\u00a0-L &#8211;license\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 display software version &amp; license<br \/>\n\u00a0-V &#8211;version\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 display software version &amp; license<br \/>\n\u00a0-s &#8211;small\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 use less memory (at most 2500k)<br \/>\n\u00a0-1 .. -9\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 set block size to 100k .. 900k<br \/>\n\u00a0Normally used as: bzip2 -d file.bz2 (to decompress a file)<br \/>\n\u00a0or bzip2 -z file (to compress a file)<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>cat<br \/>\n\u00a0cat followed by a filename will bring the contents of the file<br \/>\n\u00a0out to the screen (stdout), and can be used with the following<br \/>\n\u00a0arguments:<br \/>\n\u00a0-A, &#8211;show-all\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 equivalent to -vET<br \/>\n\u00a0-b, &#8211;number-nonblank\u00a0\u00a0\u00a0 number nonblank output lines<br \/>\n\u00a0-e\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 equivalent to -vE<br \/>\n\u00a0-E, &#8211;show-ends\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 display $ at end of each line<br \/>\n\u00a0-n, &#8211;number\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 number all output lines<br \/>\n\u00a0-s, &#8211;squeeze-blank\u00a0\u00a0\u00a0\u00a0\u00a0 never more than one single blank line<br \/>\n\u00a0-t\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 equivalent to -vT<br \/>\n\u00a0-T, &#8211;show-tabs\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 display TAB characters as ^I<br \/>\n\u00a0-u\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (ignored)<br \/>\n\u00a0-v, &#8211;show-nonprinting\u00a0\u00a0 use ^ and M- notation, except for LFD and TAB<br \/>\n\u00a0&#8211;help\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 display this help and exit<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;version\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 output version information and exit<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>cc<br \/>\n\u00a0C compiler, can be used with ALOT of arguments, do a man cc to find<br \/>\n\u00a0out just how many, it&#8217;s normally used to compile a .c source file to an<br \/>\n\u00a0executable binary, like this:<br \/>\n\u00a0cc -o program program.c<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>cd<br \/>\n\u00a0change directory, works as this:<br \/>\n\u00a0cd \/way\/to\/directory\/I_want_to\/be\/in\/<\/p>\n<p>\u00a0No further explanation needed.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>chattr<br \/>\n\u00a0This is a very powerful command with which you can change the<br \/>\n\u00a0attributes on an ext2 file system.<br \/>\n\u00a0This means that you can make a file impossible to remove<br \/>\n\u00a0for as long as the attributes are there.<\/p>\n<p>\u00a0The attributes that can be added or removed are the follwoing:<\/p>\n<p>\u00a0A Don&#8217;t update atime.<br \/>\n\u00a0S Synchronous updates.<br \/>\n\u00a0a Append only.<br \/>\n\u00a0c Compressed.<br \/>\n\u00a0i Immutable.<br \/>\n\u00a0d No dump.<br \/>\n\u00a0s Secure deletion.<br \/>\n\u00a0u Undeletable.<\/p>\n<p>\u00a0So here is an example:<\/p>\n<p>\u00a0chattr +iu \/etc\/passwd<\/p>\n<p>\u00a0This makes it impossible to remove the \/etc\/passwd file unless<br \/>\n\u00a0you first do:<\/p>\n<p>\u00a0chattr -iu \/etc\/passwd<\/p>\n<p>\u00a0This can also be good for the logs, esecially, with the a attribute.<br \/>\n\u00a0To see the attributes, use: lsattr<\/p>\n<p>\u00a0For more info do: man chattr<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>chmod<br \/>\n\u00a0chmod is a very useful command, it changes the rights of any file.<br \/>\n\u00a0To understand this command you need to understand how the permission<br \/>\n\u00a0line works:<\/p>\n<p>\u00a0-rwxr-xr-x\u00a0\u00a0\u00a0 1 alien\u00a0\u00a0\u00a0 users\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 58 Feb\u00a0 7 13:19 file1<br \/>\n\u00a0-rw-r&#8211;r&#8211;\u00a0\u00a0\u00a0 1 alien\u00a0\u00a0\u00a0 users\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 3.1k Feb\u00a0 3 15:47 file2<\/p>\n<p>\u00a0Let&#8217;s break the -rwxr-xr-x down into 4 sections:<br \/>\n\u00a0&#8211; rwx r-x r-x<br \/>\n\u00a0The first &#8211; you can not change, that tells what sort of file it is,<br \/>\n\u00a0as if it&#8217;s a special file, a directory or a normal file.<br \/>\n\u00a0The second rwx is the rights of the owner of the file.<br \/>\n\u00a0The third r-x is the rights the group of the file has.<br \/>\n\u00a0And the fourth r-x tells us what right others\/anyone else has.<br \/>\n\u00a0The rights can be:<\/p>\n<p>\u00a0r read rights.<br \/>\n\u00a0w write rights.<br \/>\n\u00a0x\u00a0 execute rights.<br \/>\n\u00a0s\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 suid (su id, execute with someome else&#8217;s uid, usually root)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 t\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 saves the programs text on the swap device<br \/>\n\u00a0X executes file only if it&#8217;s in a dir that has execute rights<\/p>\n<p>\u00a0Then we need to know in what of those 3 last fields to set those<br \/>\n\u00a0rights, they can be set to:<\/p>\n<p>\u00a0a all (changes the 3 fields syncroniously)<br \/>\n\u00a0u user<br \/>\n\u00a0g group<br \/>\n\u00a0o others\/anyone else<\/p>\n<p>\u00a0You can add or remove rights with the following arguments:<\/p>\n<p>\u00a0+ add a right<br \/>\n\u00a0&#8211; remove a right<br \/>\n\u00a0= absolute right<\/p>\n<p>\u00a0So say now that we have a file called file1, that looks like this:<\/p>\n<p>\u00a0-rwxr-xr-x\u00a0\u00a0\u00a0 1 alien\u00a0\u00a0\u00a0 users\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 58 Feb\u00a0 7 13:19 file1<\/p>\n<p>\u00a0And we wanna take away all execution rights.<br \/>\n\u00a0Then we can either do:<br \/>\n\u00a0chmod a-x file1<br \/>\n\u00a0or<br \/>\n\u00a0chmod ugo-x file1<br \/>\n\u00a0And if we wanna make a file executable to everyone in it&#8217;s group,<br \/>\n\u00a0in this case the group &#8220;users&#8221;, then we do:<br \/>\n\u00a0chmod g+x file1<\/p>\n<p>\u00a0The other way to do this, is to use octal numbers to set the<br \/>\n\u00a0rights in the permission line.<br \/>\n\u00a0This requires a bit more thinking if your not use to it, but here&#8217;s<br \/>\n\u00a0how it works:<\/p>\n<p>\u00a0First we break up the permission line into 3 sections again (not<br \/>\n\u00a0counting the leading &#8211; or d), and then we put numbers on each<br \/>\n\u00a0of the 3 fields in each of the 3 sections.<\/p>\n<p>\u00a0&#8211; rwx rwx rwx<br \/>\n\u00a0\u00a0 421 421 421<\/p>\n<p>\u00a0Now to change a line to say: -rwxrx-r-x<br \/>\n\u00a0You would:<br \/>\n\u00a0x and r in the last field, that would mean 1+4=5, then the same thing<br \/>\n\u00a0in the middle field, and last we have r, w and x in the first so then<br \/>\n\u00a0we count them all, 1+2+4=7.<br \/>\n\u00a0If we now line up our results of this little mathematic we get: 755<br \/>\n\u00a0And so to change a permission line to -rwxrx-r-x we do:<\/p>\n<p>\u00a0chmod 755 &lt;file&gt;<\/p>\n<p>\u00a0Here&#8217;s how it looks:<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Oct\u00a0\u00a0\u00a0\u00a0 Bin\u00a0\u00a0\u00a0 Rights<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0 &#8212;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1\u00a0 &#8211;x<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 2\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 10\u00a0 -w-<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 3\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 11\u00a0 -wx<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 4\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 100\u00a0 r&#8211;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 5\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 101\u00a0 r-x<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 6\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 110\u00a0 rw-<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 7\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 111\u00a0 rwx<\/p>\n<p>\u00a0Then we have the suid stuff for this with octal counting, that you set<br \/>\n\u00a0before the normal rights, I&#8217;ll explain that in a bit, first here<br \/>\n\u00a0is the number codes for the special options as suid.<\/p>\n<p>\u00a07*** SUID (user &amp; group and set&#8217;s file +t)<br \/>\n\u00a06*** SUID (user &amp; group)<br \/>\n\u00a05*** SUID +t (saves the files text to the swap partition and SUID user)<br \/>\n\u00a04*** SUID (user)<br \/>\n\u00a03*** SUID (group and set&#8217;s file +t)<br \/>\n\u00a02*** SUID (group)<br \/>\n\u00a01*** +t (saves the files text to the swap partition)<br \/>\n\u00a00*** nothing<\/p>\n<p>\u00a0Here&#8217;s how it looks:<\/p>\n<p>\u00a0Oct Bin\u00a0\u00a0\u00a0 Rights<br \/>\n\u00a0&#8211; &#8212; rwx rwx rwx<br \/>\n\u00a00\u00a0\u00a0\u00a0\u00a0 0 &#8212; &#8212; &#8212;<br \/>\n\u00a01\u00a0\u00a0 1 &#8212; &#8212; &#8211;t<br \/>\n\u00a02\u00a0 10 &#8212; &#8211;s &#8212;<br \/>\n\u00a03\u00a0 11 &#8212; &#8211;s &#8211;t<br \/>\n\u00a04 100 &#8211;s &#8212; &#8212;<br \/>\n\u00a05 101 &#8211;s &#8212; &#8211;t<br \/>\n\u00a06 110 &#8211;s &#8211;s &#8212;<br \/>\n\u00a07 111 &#8211;s &#8211;s &#8211;t<\/p>\n<p>\u00a0So if you have a file that we can call &#8216;foo.sh&#8217; and you wanna make<br \/>\n\u00a0so that only the user has write permissions to it, the user<br \/>\n\u00a0and group has read and execute permissions, and all others has no<br \/>\n\u00a0rights at all to it.<\/p>\n<p>\u00a0Then we would count: others, 0, group 5, user 7, and then to SUID<br \/>\n\u00a0the group we add a 2 in front of what we have, which means:<\/p>\n<p>\u00a0chmod 2750 foo.sh<\/p>\n<p>\u00a0This will make foo.sh&#8217;s permission line look like this:<\/p>\n<p>\u00a0-rwxr-s&#8212;<\/p>\n<p>\u00a0To do the exact same with characters, you do:<\/p>\n<p>\u00a0chmod u+rwx,go-rwx,g+s foo.sh<\/p>\n<p>\u00a0The most common premissions for files is<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Executeble:\u00a0\u00a0\u00a0\u00a0\u00a0 (755)\u00a0\u00a0 -rwxr-xr-x<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Non-Executeble:\u00a0 (644)\u00a0\u00a0 -rw-r&#8211;r&#8211;<\/p>\n<p>\u00a0The easyest way of setting these is by eather do:<\/p>\n<p>\u00a0chmod 755 file<br \/>\n\u00a0or<br \/>\n\u00a0chmod =rwxrxrx file<\/p>\n<p>\u00a0chmod 644 file<br \/>\n\u00a0or<br \/>\n\u00a0chmod =rwrr file<\/p>\n<p>\u00a0For more information, do: man chmod<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>chown<br \/>\n\u00a0chown changes owner of a file, it can actually also change the group.<br \/>\n\u00a0it works like this:<\/p>\n<p>\u00a0chown user file<\/p>\n<p>\u00a0This would change the owner of the file to user, but note that<br \/>\n\u00a0you can not change to owner of a file to a user that&#8217;s owned<br \/>\n\u00a0by someone else, same thing is that you can not change another<br \/>\n\u00a0users files so that you own them.<br \/>\n\u00a0Basicly, you need to be root to for this command in most cases.<br \/>\n\u00a0If you wanna change both the user and the group of a file, you do<br \/>\n\u00a0like this:<\/p>\n<p>\u00a0chown user.group file<\/p>\n<p>\u00a0That would change the owner of the file to user and the group<br \/>\n\u00a0of the file to group.<br \/>\n\u00a0For more info on this do: man chown<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>chroot<br \/>\n\u00a0runs a command or interactive shell with special root directory.<br \/>\n\u00a0It works like this:<\/p>\n<p>\u00a0chroot \/new\/root\/directory\/ command<\/p>\n<p>\u00a0This can be good for some programs or commands, that rather<br \/>\n\u00a0would have \/ as root directory then ~\/ etc.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>cmp<br \/>\n\u00a0compares 2 files for differences, it can be used with the<br \/>\n\u00a0following arguments:<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -l\u00a0\u00a0\u00a0 Print the byte number (decimal) and the differing byte<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 values (oc- tal) for each difference.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -s\u00a0\u00a0\u00a0 Print nothing for differing files; return exit status only.<\/p>\n<p>\u00a0It works like this:<\/p>\n<p>\u00a0cmp file1 file2<br \/>\n\u00a0Or<br \/>\n\u00a0cmp -s file1 file2<\/p>\n<p>\u00a0Not a very big, but still useful command.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>cp<br \/>\n\u00a0copy, copy&#8217;s a file from one location to another, may also copy<br \/>\n\u00a0one filename to another, used as this:<br \/>\n\u00a0cp file \/some\/other\/dir\/<br \/>\n\u00a0or<br \/>\n\u00a0cp file file.old<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>crontab<br \/>\n\u00a0Crontab has already been explained in this tutorial.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>cut<br \/>\n\u00a0cut is a very powerful command, that allows you to cut in texts,<br \/>\n\u00a0It works like this: cut [arguments] &lt;file&gt;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -b, &#8211;bytes=LIST<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 output only these bytes<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -c, &#8211;characters=LIST<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 output only these characters<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -d, &#8211;delimiter=DELIM<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 use DELIM instead of TAB for field delimiter<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -f, &#8211;fields=LIST<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 output only these fields<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -n<br \/>\n\u00a0 (ignored)<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -s, &#8211;only-delimited<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 do not print lines not containing delimiters<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;output-delimiter=STRING<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 use STRING as the output delimiter<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 the default is to use the input delimiter<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;help<br \/>\n\u00a0 display the help and exit<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;version<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 output version information and exit<\/p>\n<p>\u00a0One of the many ways to use it is like this, say that you have a file<br \/>\n\u00a0named &#8220;hostlist&#8221; that contains this:<\/p>\n<p>\u00a0beta.linux.com has address 216.200.201.197<br \/>\n\u00a0shiftq.linux.com has address 216.200.201.195<br \/>\n\u00a0irc.linux.com has address 216.200.201.199<br \/>\n\u00a0oreilly.linux.com has address 208.201.239.30<br \/>\n\u00a0srom.linux.com has address 204.94.189.33<br \/>\n\u00a0admin.linux.com has address 216.200.201.194<\/p>\n<p>\u00a0And you ONLY wanna list the IP&#8217;s from it, then you do this:<\/p>\n<p>\u00a0cut -d &#8216; &#8216; -f 4 testfile<\/p>\n<p>\u00a0That will output only the IP&#8217;s, first we set the delimiter to &#8216; &#8216;<br \/>\n\u00a0which means a space, then we display the 4&#8217;th field separated by<br \/>\n\u00a0the delimiter, which here is the IP&#8217;s.<\/p>\n<p>\u00a0Or that you have a file (say named column.txt) that contains this:<\/p>\n<p>\u00a0something\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if we have to<br \/>\n\u00a0or someone\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 cut and paste<br \/>\n\u00a0likes to write\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 the columns.<br \/>\n\u00a0in columns, we\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 So what do<br \/>\n\u00a0don&#8217;t like that\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 we do about<br \/>\n\u00a0especially not\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 this ?<\/p>\n<p>\u00a0To cut out each column is done like this:<\/p>\n<p>\u00a0cut -c 1-14 column.txt<br \/>\n\u00a0cut -c 23-40 column.txt<\/p>\n<p>\u00a0This would fist cut the file lengthwise and display characters<br \/>\n\u00a01-14 and then the same thing again but characters 23-40.<\/p>\n<p>\u00a0Now a simple way to get them in a long row instead of columns<br \/>\n\u00a0in a file is this:<\/p>\n<p>\u00a0cut -c 1-14 column.txt &gt; no-columns.txt<br \/>\n\u00a0cut -c 23-40 column.txt &gt;&gt; no-columns.txt<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>date<br \/>\n\u00a0date alone returns the current date and time in the following format:<\/p>\n<p>\u00a0day month\u00a0 date hr:min:sec timezone year<\/p>\n<p>\u00a0But can be executed with the following arguments:<\/p>\n<p>\u00a0%%\u00a0\u00a0 a literal %<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 %a\u00a0\u00a0 locale&#8217;s abbreviated weekday name (Sun..Sat)<br \/>\n\u00a0%A\u00a0\u00a0 locale&#8217;s full weekday name, variable length (Sunday..Saturday)<br \/>\n\u00a0\u00a0 %b\u00a0\u00a0 locale&#8217;s abbreviated month name (Jan..Dec)<br \/>\n\u00a0\u00a0 %B\u00a0\u00a0 locale&#8217;s full month name, variable length (January..December)<br \/>\n\u00a0\u00a0 %c\u00a0\u00a0 locale&#8217;s date and time (Sat Nov 04 12:02:33 EST 1989)<br \/>\n\u00a0\u00a0 %d\u00a0\u00a0 day of month (01..31)<br \/>\n\u00a0\u00a0 %D\u00a0\u00a0 date (mm\/dd\/yy)<br \/>\n\u00a0\u00a0 %e\u00a0\u00a0 day of month, blank padded ( 1..31)<br \/>\n\u00a0\u00a0 %h\u00a0\u00a0 same as %b<br \/>\n\u00a0\u00a0 %H\u00a0\u00a0 hour (00..23)<br \/>\n\u00a0\u00a0 %I\u00a0\u00a0 hour (01..12)<br \/>\n\u00a0\u00a0 %j\u00a0\u00a0 day of year (001..366)<br \/>\n\u00a0\u00a0 %k\u00a0\u00a0 hour ( 0..23)<br \/>\n\u00a0\u00a0 %l\u00a0\u00a0 hour ( 1..12)<br \/>\n\u00a0\u00a0 %m\u00a0\u00a0 month (01..12)<br \/>\n\u00a0\u00a0 %M\u00a0\u00a0 minute (00..59)<br \/>\n\u00a0\u00a0 %n\u00a0\u00a0 a newline<br \/>\n\u00a0\u00a0 %p\u00a0\u00a0 locale&#8217;s AM or PM<br \/>\n\u00a0\u00a0 %r\u00a0\u00a0 time, 12-hour (hh:mm:ss [AP]M)<br \/>\n\u00a0\u00a0 %s\u00a0\u00a0 seconds since 00:00:00, Jan 1, 1970 (a GNU extension)<br \/>\n\u00a0\u00a0 %S\u00a0\u00a0 second (00..60)<br \/>\n\u00a0\u00a0 %t\u00a0\u00a0 a horizontal tab<br \/>\n\u00a0\u00a0 %T\u00a0\u00a0 time, 24-hour (hh:mm:ss)<br \/>\n\u00a0\u00a0 %U\u00a0\u00a0 week number of year with Sunday as first day of week (00..53)<br \/>\n\u00a0\u00a0 %V\u00a0\u00a0 week number of year with Monday as first day of week (01..52)<br \/>\n\u00a0\u00a0 %w\u00a0\u00a0 day of week (0..6);\u00a0 0 represents Sunday<br \/>\n\u00a0\u00a0 %W\u00a0\u00a0 week number of year with Monday as first day of week (00..53)<br \/>\n\u00a0\u00a0 %x\u00a0\u00a0 locale&#8217;s date representation (mm\/dd\/yy)<br \/>\n\u00a0\u00a0 %X\u00a0\u00a0 locale&#8217;s time representation (%H:%M:%S)<br \/>\n\u00a0\u00a0 %y\u00a0\u00a0 last two digits of year (00..99)<br \/>\n\u00a0\u00a0 %Y\u00a0\u00a0 year (1970&#8230;)<br \/>\n\u00a0\u00a0 %z\u00a0\u00a0 RFC-822 style numeric timezone (-0500) (a nonstandard extension)<br \/>\n\u00a0\u00a0 %Z\u00a0\u00a0 time zone (e.g., EDT), or nothing if no time zone is determinable<\/p>\n<p>\u00a0For example, if you want to the time as hr:min:sec day, you would do:<\/p>\n<p>\u00a0date +&#8217;%H:%M:%S %a&#8217;<\/p>\n<p>\u00a0Or if you wanted to display the name of the month only, you would do:<\/p>\n<p>\u00a0date +%B<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>dc<br \/>\n\u00a0dc is an arbitrary precision calculator.<br \/>\n\u00a0man dc for more info.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>dd<br \/>\n\u00a0disk duplicator, this is a very powerful command, that is<br \/>\n\u00a0useful for doing backups as well as creating boot floppy&#8217;s<br \/>\n\u00a0from images.<br \/>\n\u00a0Say now that you have a Slackware standard boot floppy image (bare.i)<br \/>\n\u00a0and you want to write it to a floppy, then you do this:<\/p>\n<p>\u00a0dd if=bare.i of=\/dev\/fd0 conv=sync<\/p>\n<p>\u00a0If you instead have a RedHat or Mandrake boot image, just replace<br \/>\n\u00a0the bare.i in the line with boot.img, under the condition that<br \/>\n\u00a0you are standing in a directory that contains that specific image.<\/p>\n<p>\u00a0The conv=sync part is just there to make sure that the disks are<br \/>\n\u00a0synced.<\/p>\n<p>\u00a0dd is a quite big command so I suggest you take a look at the man page.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>declare<br \/>\n\u00a0declare will declare a variable and may set attributes to it.<br \/>\n\u00a0The attributes declare can set or use with the following flags are:<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -p\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 show variable with attributes.<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -a\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 to make a variable(s) an array (if supported)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -f\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 to select from among function names only<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -F\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 to display function names without definitions<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -r\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 to make variable(s) readonly<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -x\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 to export variable(s)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -i\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 to make variable(s) have the `integer&#8217; attribute set<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Using `+&#8217; instead of `-&#8216; turns off the given attribute(s) instead<br \/>\n\u00a0of setting them.<br \/>\n\u00a0If declare is used within a function, the variables will be<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 local, the same way as if the `local` command had been used.<\/p>\n<p>\u00a0The -r option works the same as the `readonly` command.<br \/>\n\u00a0And the -r option can not be removed once it&#8217;s set.<\/p>\n<p>\u00a0Here&#8217;s a short example:<\/p>\n<p>\u00a0declare -xr foo=bar<\/p>\n<p>\u00a0This would do the same as to do:<\/p>\n<p>\u00a0export foo=bar; readonly foo<\/p>\n<p>\u00a0For more info on this, do: help declare<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>depmod<br \/>\n\u00a0depmod loads kernel modules, and is a very powerful command,<br \/>\n\u00a0it&#8217;s greatest use is that it can reload all kernel modules<br \/>\n\u00a0in a single line:<\/p>\n<p>\u00a0depmod -a<\/p>\n<p>\u00a0This is especially good if you have recompiled some modules and<br \/>\n\u00a0installed them, and you don&#8217;t wanna reboot the system.<br \/>\n\u00a0The command also allows you to load single modules or several<br \/>\n\u00a0modules, like this:<\/p>\n<p>\u00a0depmod module1.o module2.o &#8230; etc.<\/p>\n<p>\u00a0For more info, man depmod<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>df<br \/>\n\u00a0Reports filesystem disk space usage.<br \/>\n\u00a0df can be used with the following arguments:<\/p>\n<p>\u00a0-a, &#8211;all<br \/>\n\u00a0include filesystems having 0 blocks<\/p>\n<p>\u00a0&#8211;block-size=SIZE use SIZE-byte blocks<\/p>\n<p>\u00a0-h, &#8211;human-readable<br \/>\n\u00a0print sizes in human readable format (e.g., 1K 234M 2G)<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -H, &#8211;si<br \/>\n\u00a0\u00a0\u00a0\u00a0 likewise, but use powers of 1000 not 1024<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -i, &#8211;inodes<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 list inode information instead of block usage<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -k, &#8211;kilobytes<br \/>\n\u00a0\u00a0\u00a0 like &#8211;block-size=1024<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -l, &#8211;local<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 limit listing to local filesystems<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -m, &#8211;megabytes<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 like &#8211;block-size=1048576<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;no-sync<br \/>\n\u00a0\u00a0 do\u00a0 not\u00a0 invoke\u00a0 sync\u00a0 before\u00a0 getting\u00a0 usage\u00a0 info (default)<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -P, &#8211;portability<br \/>\n\u00a0 use the POSIX output format<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;sync invoke sync before getting usage info<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -t, &#8211;type=TYPE<br \/>\n\u00a0\u00a0 limit listing to filesystems of type TYPE<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -T, &#8211;print-type<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 print filesystem type<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -x, &#8211;exclude-type=TYPE<br \/>\n\u00a0\u00a0\u00a0\u00a0 limit listing to filesystems not of type TYPE<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -v\u00a0\u00a0\u00a0\u00a0 (ignored)<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;help display this help and exit<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;version<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 output version information and exit<\/p>\n<p>\u00a0My favorite is to use: df -h<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>dhcpcd<br \/>\n\u00a0dhcpcd is used to obtain an IP if you have dynamic IP on a LAN<br \/>\n\u00a0such as a cable modem with dynamic IP.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>dialog<br \/>\n\u00a0The dialog command has already been explained in this tutorial.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>diff<br \/>\n\u00a0diff is a very large command that finds the difference between<br \/>\n\u00a0two files, it&#8217;s very handy to have to make patches.<br \/>\n\u00a0The basic use of diff is as follows:<br \/>\n\u00a0diff file1 file2<br \/>\n\u00a0for more and full info on this command, do: man diff<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>dir<br \/>\n\u00a0Same as &#8220;ls&#8221;.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>dmesg<br \/>\n\u00a0dmesg can print or control the kernel ring buffer.<br \/>\n\u00a0by default it&#8217;ll show a log of loaded and unloaded modules<br \/>\n\u00a0and other kernel events, like initialization if RAM disks etc.<br \/>\n\u00a0(this is flushed at each reboot)<br \/>\n\u00a0This is useful to make a boot.messages file, bu simply doing this:<br \/>\n\u00a0dmesg &gt; boot.messages<br \/>\n\u00a0If there is any errors at the boot up this command is the first<br \/>\n\u00a0you would use to try to determen the error.<\/p>\n<p>\u00a0This is the syntax of dmesg (cut&#8217;n&#8217;paste of the man page):<\/p>\n<p>\u00a0dmesg [ -c ] [ -n level ] [ -s bufsize ]<\/p>\n<p>\u00a0The options (-c\/-n\/-s) means the following:<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -c<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 clear the ring buffer contents after printing.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -s bufsize<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 use\u00a0 a\u00a0 buffer\u00a0 of bufsize to query the kernel ring<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 buffer.\u00a0 This is 8196 by default (this matches\u00a0 the<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 default\u00a0 kernel\u00a0 syslog\u00a0 buffer\u00a0 size in 2.0.33 and<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 2.1.103).\u00a0 If you have set\u00a0 the\u00a0 kernel\u00a0 buffer\u00a0 to<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 larger\u00a0 than\u00a0 the\u00a0 default\u00a0 then this option can be<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 used to view the entire buffer.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -n level<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 set the level at which logging of messages is\u00a0 done<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 to\u00a0 the\u00a0 console.\u00a0\u00a0 For\u00a0 example, -n 1 prevents all<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 messages, expect panic messages, from appearing\u00a0 on<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 the\u00a0 console.\u00a0\u00a0 All\u00a0 levels\u00a0 of\u00a0 messages are still<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 written to \/proc\/kmsg, so syslogd(8) can\u00a0 still\u00a0 be<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 used\u00a0 to\u00a0 control\u00a0 exactly\u00a0 where\u00a0 kernel\u00a0 messages<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 appear.\u00a0 When the -n option is used, dmesg will not<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 print or clear the kernel ring buffer.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 When both options are used, only the last option on<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 the command line will have an effect.<\/p>\n<p>\u00a0An example of usage is this:<\/p>\n<p>\u00a0dmesg -c -s 16392<\/p>\n<p>\u00a0This would print the kernel ring buffer (with a buffer size of 16392)<br \/>\n\u00a0And then flush the contents.<\/p>\n<p>\u00a0For more info on this command do: man dmesg<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>do<br \/>\n\u00a0do just does what it says, and is used in among others<br \/>\n\u00a0&#8216;while&#8217; loops, if you have read the whole tutorial this far<br \/>\n\u00a0(and have photographic memory) you understand what I&#8217;m saying.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>domainname<br \/>\n\u00a0See hostname.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\ndu<br \/>\n\u00a0du shows estimated file space usage.<br \/>\n\u00a0du is a good command to show how much space a directory takes up.<br \/>\n\u00a0I prefer to use it with the -h argument (human readable, see df).<br \/>\n\u00a0du has lots of arguments, do `man du` for a full list.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>echo<br \/>\n\u00a0echo will redisplay anything you put after it.<br \/>\n\u00a0This is perhaps the most used command in bash scripting, and<br \/>\n\u00a0very useful in everyday *nix handling as well, I&#8217;ll get back<br \/>\n\u00a0to that in a moment. but first, echo has the following arguments:<\/p>\n<p>\u00a0 -n\u00a0\u00a0\u00a0\u00a0 do not output the trailing newline<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -e\u00a0\u00a0\u00a0\u00a0 enable interpretation of the backslash-escaped characters<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 listed below<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -E\u00a0\u00a0\u00a0\u00a0 disable interpretation of those sequences in STRINGs<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;help display this help and exit (should be alone)<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;version<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 output\u00a0 version\u00a0 information\u00a0 and\u00a0 exit\u00a0 (should be alone)<\/p>\n<p>\u00a0AND these:<\/p>\n<p>\u00a0e\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 backslash<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 c\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 suppress trailing newline<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 a\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 alert (BELL)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 f newline and vertical tab<br \/>\n\u00a0n new line<br \/>\n\u00a0r delete recursively (rest of line backwards)<br \/>\n\u00a0t vertical tab<br \/>\n\u00a0v newline and vertical tab (vertical tab ?)<br \/>\n\u00a0xa new line<br \/>\n\u00a0xb newline and vertical tab<br \/>\n\u00a0xc newline and vertical tab<br \/>\n\u00a0xd delete rest of line forward<br \/>\n\u00a0xe ascii &#8230; screws up the console (type reset to get it back)<\/p>\n<p>\u00a0So to get a bell (beep) you just do:<\/p>\n<p>\u00a0echo -e &#8220;\\a&#8221;<\/p>\n<p>\u00a0Or to screw up your console, do:<\/p>\n<p>\u00a0echo -e &#8220;\\xe&#8221;<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>eject<br \/>\n\u00a0With eject you can eject removable medias, such as tapes, JAZ, ZIP,<br \/>\n\u00a0CD-rom and so on.<br \/>\n\u00a0The command is pretty self explanatory, and can be used with the<br \/>\n\u00a0following arguments:<\/p>\n<p>\u00a0-h\u00a0 &#8211;help<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -v\u00a0 &#8211;verbose<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -d\u00a0 &#8211;default<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -a\u00a0 &#8211;auto<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -c\u00a0 &#8211;changerslot<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -t\u00a0 &#8211;trayclose<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -n\u00a0 &#8211;noop<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -r\u00a0 &#8211;cdrom<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -s\u00a0 &#8211;scsi<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -f\u00a0\u00a0 &#8211;floppy<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -q\u00a0 &#8211;tape<\/p>\n<p>\u00a0The eject command is used as follows: eject [argument] &lt;name&gt;<br \/>\n\u00a0The name is the name of th drive, either from \/dev, \/mnt or<br \/>\n\u00a0by it&#8217;s mountpoint name.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>else<br \/>\n\u00a0Used in &#8216;if&#8217; statements, and does what it says, used like this:<br \/>\n\u00a0if [ &#8220;arg1&#8221; = &#8220;arg2&#8221; ]; then echo &#8220;match&#8221; ; else echo &#8220;no match&#8221; ; fi<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>env<br \/>\n\u00a0Display the enviorment settings.<br \/>\n\u00a0Can be used with the following arguments:<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -i, &#8211;ignore-environment. start with an empty environment<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -u, &#8211;unset=NAME. remove variable from the environment<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;help display this help and exit<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;version<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>exit<br \/>\n\u00a0exit is used to kill the current process.<br \/>\n\u00a0It can either be used to logout or to kill a running script from<br \/>\n\u00a0within the script, in the later case it can be used with a<br \/>\n\u00a0return number as argument, ie. exit 0<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>expr<br \/>\n\u00a0expr is a counter or command line calculator, it can handle most<br \/>\n\u00a0simple integer calculations.<br \/>\n\u00a0It can use all the normal ways of counting including boolean<br \/>\n\u00a0operators, such as | OR, != NOT IS, and so on.<br \/>\n\u00a0It&#8217;s simply used as this: expr 1 + 1<br \/>\n\u00a0One thing to remember, since this is in the command line, if you use<br \/>\n\u00a0* (times), you have to use it like this: expr 2 &#8216;*&#8217; 2<br \/>\n\u00a0The &#8216; precise quote makes sure that the star is not treated<br \/>\n\u00a0as a wildcard.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\nfdisk<br \/>\n\u00a0fdisk is the classic disk handler, with fdisk you can edit your<br \/>\n\u00a0hard drive(s) in alot of ways, as adding or removing partitions,<br \/>\n\u00a0list the partitions and so on.<br \/>\n\u00a0You start fdisk as this: fdisk \/dev\/&lt;disk to veiw\/edit&gt;<br \/>\n\u00a0This may be a disk such as \/dev\/hda \/dev\/hdb \/dev\/hdc and so on.<br \/>\n\u00a0Note that you can not determen a specific HD partition to<br \/>\n\u00a0start from, since fdisk operates on the whole HD.<\/p>\n<p>\u00a0When you start fdisk you will have the following commands,<br \/>\n\u00a0followed by there explanation:<\/p>\n<p>\u00a0\u00a0\u00a0 a\u00a0\u00a0 toggle a bootable flag<br \/>\n\u00a0\u00a0\u00a0 b\u00a0\u00a0 edit bsd disklabel<br \/>\n\u00a0\u00a0\u00a0 c\u00a0\u00a0 toggle the dos compatibility flag<br \/>\n\u00a0\u00a0\u00a0 d\u00a0\u00a0 delete a partition<br \/>\n\u00a0\u00a0\u00a0 l\u00a0\u00a0 list known partition types<br \/>\n\u00a0\u00a0\u00a0 m\u00a0\u00a0 print this menu<br \/>\n\u00a0\u00a0\u00a0 n\u00a0\u00a0 add a new partition<br \/>\n\u00a0\u00a0\u00a0 o\u00a0\u00a0 create a new empty DOS partition table<br \/>\n\u00a0\u00a0\u00a0 p\u00a0\u00a0 print the partition table<br \/>\n\u00a0\u00a0\u00a0 q\u00a0\u00a0 quit without saving changes<br \/>\n\u00a0\u00a0\u00a0 s\u00a0\u00a0 create a new empty Sun disklabel<br \/>\n\u00a0\u00a0\u00a0 t\u00a0\u00a0 change a partitions system id<br \/>\n\u00a0\u00a0\u00a0 u\u00a0\u00a0 change display\/entry units<br \/>\n\u00a0\u00a0\u00a0 v\u00a0\u00a0 verify the partition table<br \/>\n\u00a0\u00a0\u00a0 w\u00a0\u00a0 write table to disk and exit<br \/>\n\u00a0\u00a0\u00a0 x\u00a0\u00a0 extra functionality (experts only)<\/p>\n<p>\u00a0And in &#8216;x&#8217; the extra functionality (experts only) mode.<\/p>\n<p>\u00a0\u00a0\u00a0 b\u00a0\u00a0 move beginning of data in a partition<br \/>\n\u00a0\u00a0\u00a0 c\u00a0\u00a0 change number of cylinders<br \/>\n\u00a0\u00a0\u00a0 d\u00a0\u00a0 print the raw data in the partition table<br \/>\n\u00a0\u00a0\u00a0 e\u00a0\u00a0 list extended partitions<br \/>\n\u00a0\u00a0\u00a0 g\u00a0\u00a0 create an IRIX partition table<br \/>\n\u00a0\u00a0\u00a0 h\u00a0\u00a0 change number of heads<br \/>\n\u00a0\u00a0\u00a0 m\u00a0\u00a0 print this menu<br \/>\n\u00a0\u00a0\u00a0 p\u00a0\u00a0 print the partition table<br \/>\n\u00a0\u00a0\u00a0 q\u00a0\u00a0 quit without saving changes<br \/>\n\u00a0\u00a0\u00a0 r\u00a0\u00a0 return to main menu<br \/>\n\u00a0\u00a0\u00a0 s\u00a0\u00a0 change number of sectors\/track<br \/>\n\u00a0\u00a0\u00a0 v\u00a0\u00a0 verify the partition table<br \/>\n\u00a0\u00a0\u00a0 w\u00a0\u00a0 write table to disk and exit<\/p>\n<p>\u00a0For more info on fdisk, do: man fdisk<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>file<br \/>\n\u00a0The file command will tell you what type of file a file is.<br \/>\n\u00a0file basically works like this:<br \/>\n\u00a0file [ -bciknsvzL ] [ -f namefile ] [ -m magicfiles ] file<br \/>\n\u00a0The options are as follows:<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -b\u00a0\u00a0\u00a0\u00a0\u00a0 Do not prepend filenames to\u00a0 output\u00a0 lines\u00a0 (briefmode).<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -c\u00a0\u00a0\u00a0\u00a0\u00a0 Cause\u00a0 a\u00a0 checking\u00a0 printout of the parsed form of<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 the magic file.\u00a0 This is usually used in\u00a0 conjunction<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 with\u00a0 -m\u00a0 to\u00a0 debug\u00a0 a new magic file before installing it.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -f namefile<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Read the names of the files to\u00a0 be\u00a0 examined\u00a0 from<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 namefile\u00a0 (one per line) before the argument list.<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Either namefile or at least one filename\u00a0 argument<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 must\u00a0 be\u00a0 present; to test the standard input, use<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8220;-&#8221; as a filename argument.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -i\u00a0\u00a0\u00a0\u00a0\u00a0 Causes\u00a0 the\u00a0 file\u00a0 command\u00a0 to\u00a0 output\u00a0 mime\u00a0 type<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 strings\u00a0 rather\u00a0 than\u00a0 the\u00a0 more traditional human<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 readable\u00a0 ones.\u00a0 Thus\u00a0 it\u00a0 may\u00a0 say\u00a0 &#8220;text\/plain;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 charset=us-ascii&#8221;\u00a0 rather than &#8220;ASCII text&#8221;. In<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 order for this option to work,\u00a0 file\u00a0 changes\u00a0 the<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 way\u00a0 it\u00a0 handles\u00a0 files\u00a0 recognised by the command<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 it&#8217;s self (such as many of the\u00a0 text\u00a0 file\u00a0 types,<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 directories\u00a0 etc), and makes use of an alternative<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8220;magic&#8221; file.\u00a0 (See &#8220;FILES&#8221; section, below).<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -k\u00a0\u00a0\u00a0\u00a0\u00a0 Don&#8217;t stop at the first match, keep going.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -m list<br \/>\n\u00a0 Specify an\u00a0 alternate\u00a0 list\u00a0 of\u00a0 files\u00a0 containing<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 magic\u00a0 numbers.\u00a0\u00a0 This\u00a0 can be a single file, or a<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 colon-separated list of files.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -n\u00a0\u00a0\u00a0\u00a0\u00a0 Force stdout to be flushed\u00a0 after\u00a0 check\u00a0 a\u00a0 file.<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 This\u00a0 is\u00a0 only useful if checking a list of files.<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 It is intended to be used by programs\u00a0 want\u00a0 filetype<br \/>\n\u00a0 output from a pipe.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -v\u00a0\u00a0\u00a0\u00a0\u00a0 Print the version of the program and exit.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -z\u00a0\u00a0\u00a0\u00a0\u00a0 Try to look inside compressed files.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -L\u00a0\u00a0\u00a0\u00a0\u00a0 option\u00a0 causes\u00a0 symlinks\u00a0 to\u00a0 be\u00a0 followed, as the<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 like-named option in ls(1).\u00a0 (on systems that support<br \/>\n\u00a0 symbolic links).<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -s\u00a0\u00a0\u00a0\u00a0\u00a0 Normally, file only attempts to read and determine<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 the type of argument files which\u00a0 stat(2)\u00a0 reports<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 are\u00a0\u00a0 ordinary\u00a0 files.\u00a0\u00a0 This\u00a0 prevents\u00a0 problems,<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 because reading special files\u00a0 may\u00a0 have\u00a0 peculiar<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 consequences.\u00a0\u00a0 Specifying\u00a0 the\u00a0 -s\u00a0 option causes<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 file to also read argument files which\u00a0 are\u00a0 block<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 or\u00a0 character\u00a0 special\u00a0 files.\u00a0 This is useful for<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 determining the filesystem types of\u00a0 the\u00a0 data\u00a0 in<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 raw\u00a0 disk\u00a0 partitions,\u00a0 which\u00a0 are\u00a0 block\u00a0 special<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 files.\u00a0 This option also causes file to\u00a0 disregard<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 the file size as reported by stat(2) since on some<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 systems it reports a zero size for raw disk partitions.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Here&#8217;s a very simple usage example:<br \/>\n\u00a0file \/bin\/sh<br \/>\n\u00a0file script.sh<\/p>\n<p>\u00a0For more info do: man file<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>find<br \/>\n\u00a0find is a very powerful and useful command, it is as good for finding<br \/>\n\u00a0a file name as to helping you secure your system against hackers.<\/p>\n<p>\u00a0find works basicly like this: find &lt;path&gt; [argument] &lt;file&gt;<\/p>\n<p>\u00a0You REALLY need to read it&#8217;s manual page, if you wanna know<br \/>\n\u00a0about this command, but here are some examples:<\/p>\n<p>\u00a0Find all files that are set suid root:<br \/>\n\u00a0find \/ -perm +4000<\/p>\n<p>\u00a0Find all regular files named core (this will skip directory&#8217;s):<br \/>\n\u00a0find \/ -type f -name core<\/p>\n<p>\u00a0Find all filenames that contains the word &#8216;conf&#8217;:<br \/>\n\u00a0find \/ -name *conf*<\/p>\n<p>\u00a0Find all directory&#8217;s that ends with &#8216;bin&#8217;:<br \/>\n\u00a0find \/ -type d -name *bin<\/p>\n<p>\u00a0Find all files named test.sh and execute them:<br \/>\n\u00a0find \/ -name test.sh -exec {} \\;<\/p>\n<p>\u00a0Find all regular files that contains the word .exe and<br \/>\n\u00a0remove them by force without asking:<br \/>\n\u00a0find \/ -type f -name *.exe -exec rm {} -rf \\;<\/p>\n<p>\u00a0Even if you are root you may come across errors like this:<\/p>\n<p>\u00a0find: \/proc\/10502\/fd: Permission denied<\/p>\n<p>\u00a0The easiest way to deal with this is to add a: 2&gt;\/dev\/null<br \/>\n\u00a0after your command string, that will direct all such errors<br \/>\n\u00a0to \/dev\/null (the black hole of UNIX :P)<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>ftpwho<br \/>\n\u00a0ftpwho is a command where you can see how many users there are<br \/>\n\u00a0logged on to your ftp, under the condition that you have an<br \/>\n\u00a0ftp server on your system that is.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>g++<br \/>\n\u00a0GNU C++ compiler.<br \/>\n\u00a0See it&#8217;s man page.<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>gcc<br \/>\n\u00a0GNU C Compiler.<br \/>\n\u00a0See cc<br \/>\n\u00a0And see the gcc man page<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>gdb<br \/>\n\u00a0GNU Debugger, has ALOT of commands and arguments,<br \/>\n\u00a0see: man gdb.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>gpm<br \/>\n\u00a0gpm is the Linux mouse daemon, it&#8217;s unspareble when it comes to<br \/>\n\u00a0working an a console, cut &amp; paste is a wonderful thing.<br \/>\n\u00a0gpm works basicly as this: gpm [options]<br \/>\n\u00a0The most common options would be as this:<\/p>\n<p>\u00a0gpm -m \/dev\/mouse -t ps2<\/p>\n<p>\u00a0This would start a PS\/2 mouse, under the conditions that the<br \/>\n\u00a0PS\/2 port (\/dev\/psaux) is linked to the mouse device (\/dev\/mouse).<\/p>\n<p>\u00a0You can use &#8220;gpm -m \/dev\/psaux -t ps2&#8221; just as well.<br \/>\n\u00a0Or if you have a serial mouse no COM1 you can start it like this:<\/p>\n<p>\u00a0gpm -m \/dev\/cua0 -t ms<\/p>\n<p>\u00a0The -m argument means, the mouse device, and the -t argument is<br \/>\n\u00a0the protocol it&#8217;s going to use.<\/p>\n<p>\u00a0For a list of all gpm&#8217;s arguments do: gpm -h<br \/>\n\u00a0And for a list of all the possible mouse protocols, do: gpm -t help<\/p>\n<p>\u00a0The basic console cut &amp; paste functions for a 3 button mouser is:<\/p>\n<p>\u00a0Left button &#8211; hold and drag to highlight text (copy&#8217;s text to memory).<\/p>\n<p>\u00a0Middle button &#8211; pastes text that are in memory (see left button)<\/p>\n<p>\u00a0Right button &#8211; mark a starting point with a single left click and then<br \/>\n\u00a0mark an end point with the right button to highlight the whole section.<\/p>\n<p>\u00a0Once you get it to work, you may add the line to: \/etc\/rc.d\/rc.local<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>grep<br \/>\n\u00a0grep is another of the very powerful commands<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>halt<br \/>\n\u00a0This will halt (shutdown -h now) your system.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>hdparm<br \/>\n\u00a0hdparm is a powerful tool to control your hard drives.<br \/>\n\u00a0It works like this: hdparm &lt;arguments&gt; &lt;hard drive&gt;<br \/>\n\u00a0The arguments can be:<\/p>\n<p>\u00a0 -a\u00a0\u00a0 get\/set fs readahead<br \/>\n\u00a0 -A\u00a0\u00a0 set drive read-lookahead flag (0\/1)<br \/>\n\u00a0 -c\u00a0\u00a0 get\/set IDE 32-bit IO setting<br \/>\n\u00a0 -C\u00a0\u00a0 check IDE power mode status<br \/>\n\u00a0 -d\u00a0\u00a0 get\/set using_dma flag<br \/>\n\u00a0 -D\u00a0\u00a0 enable\/disable drive defect-mgmt<br \/>\n\u00a0 -E\u00a0\u00a0 set cd-rom drive speed<br \/>\n\u00a0 -f\u00a0\u00a0 flush buffer cache for device on exit<br \/>\n\u00a0 -g\u00a0\u00a0 display drive geometry<br \/>\n\u00a0 -h\u00a0\u00a0 display terse usage information<br \/>\n\u00a0 -i\u00a0\u00a0 display drive identification<br \/>\n\u00a0 -I\u00a0\u00a0 read drive identification directly from drive<br \/>\n\u00a0 -k\u00a0\u00a0 get\/set keep_settings_over_reset flag (0\/1)<br \/>\n\u00a0 -K\u00a0\u00a0 set drive keep_features_over_reset flag (0\/1)<br \/>\n\u00a0 -L\u00a0\u00a0 set drive doorlock (0\/1) (removable harddisks only)<br \/>\n\u00a0 -m\u00a0\u00a0 get\/set multiple sector count<br \/>\n\u00a0 -n\u00a0\u00a0 get\/set ignore-write-errors flag (0\/1)<br \/>\n\u00a0 -p\u00a0\u00a0 set PIO mode on IDE interface chipset (0,1,2,3,4,&#8230;)<br \/>\n\u00a0 -P\u00a0\u00a0 set drive prefetch count<br \/>\n\u00a0 -q\u00a0\u00a0 change next setting quietly<br \/>\n\u00a0 -r\u00a0\u00a0 get\/set readonly flag (DANGEROUS to set)<br \/>\n\u00a0 -R\u00a0\u00a0 register an IDE interface (DANGEROUS)<br \/>\n\u00a0 -S\u00a0\u00a0 set standby (spindown) timeout<br \/>\n\u00a0 -t\u00a0\u00a0 perform device read timings<br \/>\n\u00a0 -T\u00a0\u00a0 perform cache read timings<br \/>\n\u00a0 -u\u00a0\u00a0 get\/set unmaskirq flag (0\/1)<br \/>\n\u00a0 -U\u00a0\u00a0 un-register an IDE interface (DANGEROUS)<br \/>\n\u00a0 -v\u00a0\u00a0 default; same as -acdgkmnru (-gr for SCSI, -adgr for XT)<br \/>\n\u00a0 -V\u00a0\u00a0 display program version and exit immediately<br \/>\n\u00a0 -W\u00a0\u00a0 set drive write-caching flag (0\/1) (DANGEROUS)<br \/>\n\u00a0 -X\u00a0\u00a0 set IDE xfer mode (DANGEROUS)<br \/>\n\u00a0 -y\u00a0\u00a0 put IDE drive in standby mode<br \/>\n\u00a0 -Y\u00a0\u00a0 put IDE drive to sleep<br \/>\n\u00a0 -Z\u00a0\u00a0 disable Seagate auto-powersaving mode<\/p>\n<p>\u00a0Some examples:<br \/>\n\u00a0hdparm -Tt \/dev\/hda (Time the cache\/device read times)<br \/>\n\u00a0hdparm -c 1 \/dev\/hda (This made my HD read the cache twice as fast)<br \/>\n\u00a0hdparm -Yy \/dev\/hda (This will totally power down the HD until<br \/>\n\u00a0\u00a0\u00a0 it&#8217;s needed, very useful to save power<br \/>\n\u00a0\u00a0\u00a0 or if you just need a minutes silence)<\/p>\n<p>\u00a0For more info: man hdparm<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>head<br \/>\n\u00a0the head command by default brings up the 10 top lines of a file,<br \/>\n\u00a0but can be used with these arguments:<\/p>\n<p>\u00a0-&lt;n&gt;\u00a0\u00a0\u00a0 where the &lt;n&gt; is the number of lines to get<br \/>\n\u00a0\u00a0 -c, &#8211;bytes=SIZE\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 print first SIZE bytes<br \/>\n\u00a0\u00a0 -n, &#8211;lines=NUMBER\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 print first NUMBER lines instead of first 10<br \/>\n\u00a0\u00a0 -q, &#8211;quiet, &#8211;silent\u00a0\u00a0\u00a0 never print headers giving file names<br \/>\n\u00a0\u00a0 -v, &#8211;verbose\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 always print headers giving file names<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;help\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 display this help and exit<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;version\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 output version information and exit<\/p>\n<p>\u00a0Here&#8217;s some examples:<\/p>\n<p>\u00a0head file<\/p>\n<p>\u00a0head -1 file<\/p>\n<p>\u00a0head -50 file<\/p>\n<p>\u00a0head -c 100 file<\/p>\n<p>\u00a0This command can prove to be very useful.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>help<br \/>\n\u00a0help is a command that shows information on built in commands.<br \/>\n\u00a0like ., cd, jobs, %, test, etc.<br \/>\n\u00a0It works like this: help &lt;command&gt;<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>hexdump<br \/>\n\u00a0hexdump is a command that will give a hex dump of any file.<br \/>\n\u00a0For more info on this command do: man hexdump<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>hexedit<br \/>\n\u00a0hexedit is a hex editor, very good for debugging binarys,<br \/>\n\u00a0hexedit has alot of internal commands, do: man hexedit<br \/>\n\u00a0for more help on it.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>hostname<br \/>\n\u00a0With no arguments it displays the current hostname.<br \/>\n\u00a0But can also set a new hostname, here are it&#8217;s arguments:<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0 -s, &#8211;short\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 short host name<br \/>\n\u00a0\u00a0\u00a0\u00a0 -a, &#8211;alias\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 alias names<br \/>\n\u00a0\u00a0\u00a0\u00a0 -i, &#8211;ip-address\u00a0\u00a0\u00a0\u00a0\u00a0 addresses for the hostname<br \/>\n\u00a0\u00a0\u00a0\u00a0 -f, &#8211;fqdn, &#8211;long\u00a0\u00a0\u00a0 long host name (FQDN)<br \/>\n\u00a0\u00a0\u00a0\u00a0 -d, &#8211;domain\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 DNS domain name<br \/>\n\u00a0\u00a0\u00a0\u00a0 -y, &#8211;yp, &#8211;nis\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 NIS\/YP domainname<br \/>\n\u00a0\u00a0\u00a0\u00a0 -F, &#8211;file\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 read hostname or NIS domainname from given file<\/p>\n<p>\u00a0Here&#8217;s an example if you wanna change your hostname:<\/p>\n<p>\u00a0hostname -F \/etc\/HOSTNAME<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>id<br \/>\n\u00a0Shows you a users ID, default your user UID, GID and group name.<br \/>\n\u00a0The command has some arguments it can be used with, like this:<\/p>\n<p>\u00a0id [argument] &lt;user&gt;<\/p>\n<p>\u00a0Here are the arguments:<\/p>\n<p>\u00a0\u00a0 -a\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ignore, for compatibility with other versions<br \/>\n\u00a0\u00a0 -g, &#8211;group\u00a0\u00a0\u00a0\u00a0 print only the group ID<br \/>\n\u00a0\u00a0 -G, &#8211;groups\u00a0\u00a0\u00a0 print only the supplementary groups<br \/>\n\u00a0\u00a0 -n, &#8211;name\u00a0\u00a0\u00a0\u00a0\u00a0 print a name instead of a number, for -ugG<br \/>\n\u00a0\u00a0 -r, &#8211;real\u00a0\u00a0\u00a0\u00a0\u00a0 print the real ID instead of effective ID, for -ugG<br \/>\n\u00a0\u00a0 -u, &#8211;user\u00a0\u00a0\u00a0\u00a0\u00a0 print only the user ID<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;help\u00a0\u00a0\u00a0\u00a0\u00a0 display this help and exit<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;version\u00a0\u00a0 output version information and exit<\/p>\n<p>\u00a0So `id -u` will return &#8216;0&#8217; if you are root (same as `echo $UID`).<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>ifdown<br \/>\n\u00a0ifdown is a command that will let you shutdown (deactivate) any<br \/>\n\u00a0ethernet device. I works as this: ifdown &lt;device&gt;<br \/>\n\u00a0So say that you have an eth0 running that you wanna shut down, then<br \/>\n\u00a0you just do this: ifdown eth0<\/p>\n<p>\u00a0For more info on how to set up an ethernet device,<br \/>\n\u00a0see section 7 (Networking) in this tutorial.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>ifup<br \/>\n\u00a0ifup works the same as ifdown, but activates the ethernet device<br \/>\n\u00a0rather then deactivate it.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 For more info on how to set up an ethernet device,<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 see section 7 (Networking) in this tutorial.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>init<br \/>\n\u00a0init sets the runlevel for you.<br \/>\n\u00a0If you have read the whole of this tutorial to this point you know<br \/>\n\u00a0about where to look for what they mean.<br \/>\n\u00a0So if you do: init 0<br \/>\n\u00a0The system will shutdown and halt there.<br \/>\n\u00a0And if you type: init 6<br \/>\n\u00a0The system will reboot, etc.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>insmod<br \/>\n\u00a0insmod tries to installs a loadable module in the running kernel.<br \/>\n\u00a0It works like this:<\/p>\n<p>\u00a0insmod [arguments] &lt;-o module_name&gt; object_file [ sym-bol=value &#8230; ]<\/p>\n<p>\u00a0Here are the possible arguments:<br \/>\n\u00a0\u00a0 -f, &#8211;force\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Force loading under wrong kernel version<br \/>\n\u00a0\u00a0 -k, &#8211;autoclean\u00a0\u00a0\u00a0\u00a0 Make module autoclean-able<br \/>\n\u00a0\u00a0 -m\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Generate load map (so crashes can be traced)<br \/>\n\u00a0\u00a0 -o NAME<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;name=NAME\u00a0\u00a0\u00a0\u00a0 Set internal module name to NAME<br \/>\n\u00a0\u00a0 -p, &#8211;poll\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Poll mode; check if the module matches the kernel<br \/>\n\u00a0\u00a0 -s, &#8211;syslog\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Report errors via syslog<br \/>\n\u00a0\u00a0 -v, &#8211;verbose\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Verbose output<br \/>\n\u00a0\u00a0 -V, &#8211;version\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Show version<br \/>\n\u00a0\u00a0 -x\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Do not export externs<br \/>\n\u00a0\u00a0 -X\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Do export externs (default)<\/p>\n<p>\u00a0An example of how to use this is:<\/p>\n<p>\u00a0insmod -o 3c90x \/lib\/modules\/2.2.14\/net\/3c90x.o<\/p>\n<p>\u00a0This would load the 3c90x.o module with 3c90x as name.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>install<br \/>\n\u00a0install is a command that installs a file properly,<br \/>\n\u00a0it works like this: install [arguments] source destination<br \/>\n\u00a0The arguments can be any of the following:<\/p>\n<p>\u00a0 -b, &#8211;backup<br \/>\n\u00a0 make backup before removal<\/p>\n<p>\u00a0\u00a0 -c<br \/>\n\u00a0 (ignored)<\/p>\n<p>\u00a0-d, &#8211;directory<br \/>\n\u00a0 treat all arguments as directory names; create all<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 components of the specified directories<\/p>\n<p>\u00a0-D<br \/>\n\u00a0 create all leading components of DEST except the last,<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 then copy SOURCE to DEST;\u00a0 useful in the 1st format<\/p>\n<p>\u00a0-g, &#8211;group=GROUP<br \/>\n\u00a0 set group ownership, instead of process&#8217; current group<\/p>\n<p>\u00a0-m, &#8211;mode=MODE<br \/>\n\u00a0 set permission mode (as in chmod), instead of rwxr-xr-x<\/p>\n<p>\u00a0-o, &#8211;owner=OWNER<br \/>\n\u00a0 set ownership (super-user only)<\/p>\n<p>\u00a0-p, &#8211;preserve-timestamps<br \/>\n\u00a0 apply access\/modification times of SOURCE files to<br \/>\n\u00a0 corresponding destination files<\/p>\n<p>\u00a0-s, &#8211;strip<br \/>\n\u00a0 strip symbol tables, only for 1st and 2nd formats<\/p>\n<p>\u00a0-S, &#8211;suffix=SUFFIX<br \/>\n\u00a0 override the usual backup suffix<\/p>\n<p>\u00a0&#8211;verbose<br \/>\n\u00a0 print the name of each directory as it is created<\/p>\n<p>\u00a0-V, &#8211;version-control=WORD<br \/>\n\u00a0 override the usual version control<\/p>\n<p>\u00a0&#8211;help<br \/>\n\u00a0 display the help and exit<\/p>\n<p>\u00a0So if we have a file called foo and we want to install it in<br \/>\n\u00a0\/usr\/local\/bin\/, and we want it to have the following permission line:<br \/>\n\u00a0-rwxr-x&#8212;, then we want it to belong to the group ftp, then<br \/>\n\u00a0we do like this:<\/p>\n<p>\u00a0install -m 750 foo -g ftp \/usr\/local\/bin\/<\/p>\n<p>\u00a0We could also use:<\/p>\n<p>\u00a0install -m u+rwx,g+rx foo -g ftp \/usr\/local\/bin\/<\/p>\n<p>\u00a0Which would produce the same permission line.<\/p>\n<p>\u00a0The install command is good to use if you ever do anything that<br \/>\n\u00a0needs to be installed to the system, in a proper way.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>ipchains<br \/>\n\u00a0ipchains is a firewall\/wrapper that has ALOT of argument,<br \/>\n\u00a0it&#8217;s one of those huge commands, do: man ipchains<br \/>\n\u00a0for more information on this command.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>ispell<br \/>\n\u00a0Interactive Spell check, this is a useful little command,<br \/>\n\u00a0it&#8217;s basic usage is: ispell &lt;file&gt;<br \/>\n\u00a0It has the following commands:<\/p>\n<p>\u00a0R\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Replace the misspelled word completely.<br \/>\n\u00a0Space\u00a0\u00a0 Accept the word this time only.<br \/>\n\u00a0A\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Accept the word for the rest of this session.<br \/>\n\u00a0I\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Accept the word, and put it in your private dictionary.<br \/>\n\u00a0U\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Accept and add lowercase version to private dictionary.<br \/>\n\u00a00-n\u00a0\u00a0\u00a0\u00a0 Replace with one of the suggested words.<br \/>\n\u00a0L\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Look up words in system dictionary.<br \/>\n\u00a0X\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Write the rest of this file, ignoring misspellings,<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 and start next file.<br \/>\n\u00a0Q\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Quit immediately.\u00a0 Asks for confirmation.<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Leaves file unchanged.<br \/>\n\u00a0!\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Shell escape.<br \/>\n\u00a0^L\u00a0\u00a0\u00a0\u00a0\u00a0 Redraw screen.<br \/>\n\u00a0^Z\u00a0\u00a0\u00a0\u00a0\u00a0 Suspend program.<br \/>\n\u00a0?\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Show the help screen.<\/p>\n<p>\u00a0Just run it on a file and test it for your self.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>kill<br \/>\n\u00a0kill is a very powerful command that can (if you&#8217;re root)<br \/>\n\u00a0kill any running process no the system.<br \/>\n\u00a0it works as: kill -&lt;signal&gt; &lt;PID&gt;<\/p>\n<p>\u00a0Pid is short for Process ID, which you get with the `ps` command.<\/p>\n<p>\u00a0The signals can be any of the following:<\/p>\n<p>\u00a0POSIX signals:<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Signal\u00a0\u00a0\u00a0\u00a0 Value\u00a0\u00a0\u00a0\u00a0 Action\u00a0\u00a0 Comment<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SIGHUP\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 A\u00a0\u00a0\u00a0\u00a0 Hangup detected on controlling terminal<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 or death of controlling process<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SIGINT\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 2\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 A\u00a0\u00a0\u00a0\u00a0 Interrupt from keyboard<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SIGQUIT\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 3\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 C\u00a0\u00a0\u00a0\u00a0 Quit from keyboard<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SIGILL\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 4\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 C\u00a0\u00a0\u00a0\u00a0 Illegal Instruction<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SIGABRT\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 6\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 C\u00a0\u00a0\u00a0\u00a0 Abort signal from abort(3)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SIGFPE\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 8\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 C\u00a0\u00a0\u00a0\u00a0 Floating point exception<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SIGKILL\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 9\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 AEF\u00a0\u00a0\u00a0 Kill signal<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SIGSEGV\u00a0\u00a0\u00a0\u00a0\u00a0 11\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 C\u00a0\u00a0\u00a0\u00a0 Invalid memory reference<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SIGPIPE\u00a0\u00a0\u00a0\u00a0\u00a0 13\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 A\u00a0\u00a0\u00a0\u00a0 Broken pipe: write to pipe with no readers<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SIGALRM\u00a0\u00a0\u00a0\u00a0\u00a0 14\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 A\u00a0\u00a0\u00a0\u00a0 Timer signal from alarm(2)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SIGTERM\u00a0\u00a0\u00a0\u00a0\u00a0 15\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 A\u00a0\u00a0\u00a0\u00a0 Termination signal<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SIGUSR1\u00a0\u00a0 30,10,16\u00a0\u00a0\u00a0\u00a0 A\u00a0\u00a0\u00a0\u00a0 User-defined signal 1<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SIGUSR2\u00a0\u00a0 31,12,17\u00a0\u00a0\u00a0\u00a0 A\u00a0\u00a0\u00a0\u00a0 User-defined signal 2<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SIGCHLD\u00a0\u00a0 20,17,18\u00a0\u00a0\u00a0\u00a0 B\u00a0\u00a0\u00a0\u00a0 Child stopped or terminated<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SIGCONT\u00a0\u00a0 19,18,25\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Continue if stopped<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SIGSTOP\u00a0\u00a0 17,19,23\u00a0\u00a0\u00a0 DEF\u00a0\u00a0\u00a0 Stop process<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SIGTSTP\u00a0\u00a0 18,20,24\u00a0\u00a0\u00a0\u00a0 D\u00a0\u00a0\u00a0\u00a0 Stop typed at tty<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SIGTTIN\u00a0\u00a0 21,21,26\u00a0\u00a0\u00a0\u00a0 D\u00a0\u00a0\u00a0\u00a0 tty input for background process<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SIGTTOU\u00a0\u00a0 22,22,27\u00a0\u00a0\u00a0\u00a0 D\u00a0\u00a0\u00a0\u00a0 tty output for background process<\/p>\n<p>\u00a0Non-POSIX signals:<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Signal\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Value\u00a0\u00a0\u00a0\u00a0 Action\u00a0\u00a0 Comment<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SIGBUS\u00a0\u00a0\u00a0\u00a0\u00a0 10,7,10\u00a0\u00a0\u00a0\u00a0\u00a0 C\u00a0\u00a0\u00a0\u00a0 Bus error (bad memory access)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SIGPOLL\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 A\u00a0\u00a0\u00a0\u00a0 Pollable event (Sys V). Synonym of SIGIO<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SIGPROF\u00a0\u00a0\u00a0\u00a0 27,27,29\u00a0\u00a0\u00a0\u00a0 A\u00a0\u00a0\u00a0\u00a0 Profiling timer expired<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SIGSYS\u00a0\u00a0\u00a0\u00a0\u00a0 12,-,12\u00a0\u00a0\u00a0\u00a0\u00a0 C\u00a0\u00a0\u00a0\u00a0 Bad argument to routine (SVID)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SIGTRAP\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 5\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 C\u00a0\u00a0\u00a0\u00a0 Trace\/breakpoint trap<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SIGURG\u00a0\u00a0\u00a0\u00a0\u00a0 16,23,21\u00a0\u00a0\u00a0\u00a0 B\u00a0\u00a0\u00a0\u00a0 Urgent condition on socket (4.2 BSD)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SIGVTALRM\u00a0\u00a0 26,26,28\u00a0\u00a0\u00a0\u00a0 A\u00a0\u00a0\u00a0\u00a0 Virtual alarm clock (4.2 BSD)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SIGXCPU\u00a0\u00a0\u00a0\u00a0 24,24,30\u00a0\u00a0\u00a0\u00a0 C\u00a0\u00a0\u00a0\u00a0 CPU time limit exceeded (4.2 BSD)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SIGXFSZ\u00a0\u00a0\u00a0\u00a0 25,25,31\u00a0\u00a0\u00a0\u00a0 C\u00a0\u00a0\u00a0\u00a0 File size limit exceeded (4.2 BSD)<\/p>\n<p>\u00a0Other signals:<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Signal\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Value\u00a0\u00a0\u00a0\u00a0 Action\u00a0\u00a0 Comment<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SIGIOT\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 6\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 C\u00a0\u00a0\u00a0\u00a0 IOT trap. A synonym for SIGABRT<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SIGEMT\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 7,-,7<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SIGSTKFLT\u00a0\u00a0\u00a0 -,16,-\u00a0\u00a0\u00a0\u00a0\u00a0 A\u00a0\u00a0\u00a0\u00a0 Stack fault on coprocessor<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SIGIO\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 23,29,22\u00a0\u00a0\u00a0\u00a0 A\u00a0\u00a0\u00a0\u00a0 I\/O now possible (4.2 BSD)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SIGCLD\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -,-,18\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 A synonym for SIGCHLD<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SIGPWR\u00a0\u00a0\u00a0\u00a0\u00a0 29,30,19\u00a0\u00a0\u00a0\u00a0 A\u00a0\u00a0\u00a0\u00a0 Power failure (System V)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SIGINFO\u00a0\u00a0\u00a0\u00a0\u00a0 29,-,-\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 A synonym for SIGPWR<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SIGLOST\u00a0\u00a0\u00a0\u00a0\u00a0 -,-,-\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 A\u00a0\u00a0\u00a0\u00a0 File lock lost<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SIGWINCH\u00a0\u00a0\u00a0 28,28,20\u00a0\u00a0\u00a0\u00a0 B\u00a0\u00a0\u00a0\u00a0 Window resize signal (4.3 BSD, Sun)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SIGUNUSED\u00a0\u00a0\u00a0 -,31,-\u00a0\u00a0\u00a0\u00a0\u00a0 A\u00a0\u00a0\u00a0\u00a0 Unused signal (will be SIGSYS)<\/p>\n<p>\u00a0When you use the kill you can either use the numeric code, as<br \/>\n\u00a0say that we have a PID 1234 that we wanna kill, then we can either<br \/>\n\u00a0do: kill -9 1234 or we can do: kill -KILL 1234<br \/>\n\u00a0So you don&#8217;t have to include that leading SIG in the signals<br \/>\n\u00a0when you use them by name.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>killall<br \/>\n\u00a0killall is the same as kill but kills processes by name,<br \/>\n\u00a0As say that you have 10 processes running all named: httpd<br \/>\n\u00a0and you wanna kill them all in one command.<br \/>\n\u00a0Then: killall -9 httpd\u00a0 would be the way to go about it.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>lastlog<br \/>\n\u00a0lastlog is a command that shows you a list of the users and when<br \/>\n\u00a0they last logged in, from what host and on which port.<br \/>\n\u00a0lastlog can be used with the following arguments:<\/p>\n<p>\u00a0-u username<br \/>\n\u00a0-t number of days<\/p>\n<p>\u00a0so if I wanna check if a user named &#8216;user&#8217; has logged in during<br \/>\n\u00a0the last 50 days I do: lastlog -u user -t 50<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>ldconfig<br \/>\n\u00a0ldconfig updates the list of directory&#8217;s in where library&#8217;s can be<br \/>\n\u00a0found as \/lib and \/usr\/lib, if you wanna add a directory to this you<br \/>\n\u00a0can add them in \/etc\/ld.so.conf<br \/>\n\u00a0By just typing `ldconfig` you will update this, but it can<br \/>\n\u00a0also be executed with more arguments, for more info on this<br \/>\n\u00a0command do: man ldconfig<\/p>\n<p>\u00a0Just note that this is not really a command that you will use<br \/>\n\u00a0every day.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>ldd<br \/>\n\u00a0ldd can check what librarys a dynamicly executable file needs.<br \/>\n\u00a0and it can have the following switches:<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;help\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 print this help and exit<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;version\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 print version information and exit<br \/>\n\u00a0\u00a0 -d, &#8211;data-relocs\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 process data relocations<br \/>\n\u00a0\u00a0 -r, &#8211;function-relocs\u00a0\u00a0 process data and function relocations<br \/>\n\u00a0\u00a0 -v, &#8211;verbose\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 print all information<\/p>\n<p>\u00a0It works like this:<\/p>\n<p>\u00a0ldd &lt;file&gt;<\/p>\n<p>\u00a0Example:<\/p>\n<p>\u00a0ldd \/sbin\/ifconfig<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>less<br \/>\n\u00a0less is more then more &#8230;.. ummmm<br \/>\n\u00a0less works a bit like cat but it will stop at each screen and you<br \/>\n\u00a0can scroll up and down in the file to view it&#8217;s contents,<br \/>\n\u00a0it works basicly like this: less &lt;textfile&gt;<br \/>\n\u00a0Do a: less &#8211;help<br \/>\n\u00a0For a full index of it&#8217;s commands, and note that you get out<br \/>\n\u00a0of less by pressing the letter &#8216;q&#8217;.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>lilo<br \/>\n\u00a0lilo is the LInux LOader, and is on most distros the default<br \/>\n\u00a0boot loader, with lilo you can rewrite your boot sector and<br \/>\n\u00a0everything that involves your booting or switching between<br \/>\n\u00a0several installed operating systems, lilo&#8217;s configuration file<br \/>\n\u00a0is \/etc\/lilo.conf<br \/>\n\u00a0for more info about lilo and what lilo can do do: man lilo<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>ln<br \/>\n\u00a0link, with ln you can link any file, this is essential to *nix<br \/>\n\u00a0as, say that you have a config file that needs to be in the same<br \/>\n\u00a0dir as it&#8217;s program but you want it in \/etc with all the other<br \/>\n\u00a0configuration files, then you can link it to \/etc so the link<br \/>\n\u00a0appears in \/etc and works just like the real file.<\/p>\n<p>\u00a0Usually ln is used to set symbolic links (sym links) where you<br \/>\n\u00a0can see the difference of the link and the file and you can remove<br \/>\n\u00a0the link without it affecting the real file.<br \/>\n\u00a0A symbolic link is set in this way: ln -s file link<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>lndir<br \/>\n\u00a0link directory, about the same as ln but links directory&#8217;s,<br \/>\n\u00a0see the: man lndir<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>loadkeys<br \/>\n\u00a0loadkeys, basicly works like: loadkeys \/usr\/lib\/kbd\/keymaps\/&lt;keymap&gt;<br \/>\n\u00a0but also has some arguments (that I never used), if you want<br \/>\n\u00a0more info: man loadkeys<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>locate<br \/>\n\u00a0locate can locate any file that&#8217;s read into a database,<br \/>\n\u00a0you update this database if you as root type: updatedb<br \/>\n\u00a0locate works basicly like: locate &lt;whatever-you-wanna-find&gt;<br \/>\n\u00a0but can be executed with alot of arguments, do: locate &#8211;help<br \/>\n\u00a0or for more info: man locate<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>logout<br \/>\n\u00a0logout does what it says, it logs you off the shell.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>lpq<br \/>\n\u00a0line printer que, checks if you have any printer jobs on que.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>lpr<br \/>\n\u00a0line printer, has alot of commands, but basicly works as: lpr &lt;file&gt;<br \/>\n\u00a0to print a file, the lpr command has alot of arguments,<br \/>\n\u00a0do: man lpr for more info.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>lprm<br \/>\n\u00a0line printer remove, removes any qued jobs (lpq) by there entry number.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>ls<br \/>\n\u00a0this is the most basic of all basic commands to know.<br \/>\n\u00a0ls lists the contents of a directory, if you type just `ls`<br \/>\n\u00a0it will list the contents of the current directory, but it can also<br \/>\n\u00a0be used as `ls \/way\/to\/some\/other\/dir\/` to list the contents of<br \/>\n\u00a0some other directory, ls has alot of arguments which are:<\/p>\n<p>\u00a0\u00a0 -a, &#8211;all<br \/>\n\u00a0 do not hide entries starting with .<\/p>\n<p>\u00a0\u00a0 -A, &#8211;almost-all<br \/>\n\u00a0 do not list implied . and ..<\/p>\n<p>\u00a0-b, &#8211;escape<br \/>\n\u00a0 print octal escapes for nongraphic characters<\/p>\n<p>\u00a0&#8211;block-size=SIZE<br \/>\n\u00a0 use SIZE-byte blocks<\/p>\n<p>\u00a0\u00a0 -B, &#8211;ignore-backups<br \/>\n\u00a0 do not list implied entries ending with ~<\/p>\n<p>\u00a0-c<br \/>\n\u00a0 sort by change time; with -l: show ctime<\/p>\n<p>\u00a0-C<br \/>\n\u00a0 list entries by columns<\/p>\n<p>\u00a0&#8211;color[=WHEN]<br \/>\n\u00a0 control whether color is used to distinguish file<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 types.\u00a0 WHEN may be `never&#8217;, `always&#8217;, or `auto&#8217;<\/p>\n<p>\u00a0-d, &#8211;directory<br \/>\n\u00a0 list directory entries instead of contents<\/p>\n<p>\u00a0-D, &#8211;dired<br \/>\n\u00a0 generate output designed for Emacs&#8217; dired mode<\/p>\n<p>\u00a0 -f<br \/>\n\u00a0 do not sort, enable -aU, disable -lst<\/p>\n<p>\u00a0\u00a0 -F, &#8211;classify<br \/>\n\u00a0 append indicator (one of *\/=@|) to entries<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0 &#8211;format=WORD<br \/>\n\u00a0 across -x, commas -m, horizontal -x, long -l,<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 single-column -1, verbose -l, vertical -C<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0 &#8211;full-time<br \/>\n\u00a0 list both full date and full time<\/p>\n<p>\u00a0-g<br \/>\n\u00a0 (ignored)<\/p>\n<p>\u00a0-G, &#8211;no-group<br \/>\n\u00a0 inhibit display of group information<\/p>\n<p>\u00a0-h, &#8211;human-readable<br \/>\n\u00a0 print sizes in human readable format (e.g., 1K 234M 2G)<\/p>\n<p>\u00a0-H, &#8211;si<br \/>\n\u00a0 likewise, but use powers of 1000 not 1024<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0 &#8211;indicator-style=WORD<br \/>\n\u00a0 append indicator with style WORD to entry names:<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 none (default), classify (-F), file-type (-p)<\/p>\n<p>\u00a0-i, &#8211;inode<br \/>\n\u00a0 print index number of each file<\/p>\n<p>\u00a0-I, &#8211;ignore=PATTERN<br \/>\n\u00a0 do not list implied entries matching shell PATTERN<\/p>\n<p>\u00a0-k, &#8211;kilobytes<br \/>\n\u00a0 like &#8211;block-size=1024<\/p>\n<p>\u00a0-l<br \/>\n\u00a0 use a long listing format<\/p>\n<p>\u00a0-L, &#8211;dereference<br \/>\n\u00a0 list entries pointed to by symbolic links<\/p>\n<p>\u00a0-m<br \/>\n\u00a0 fill width with a comma separated list of entries<\/p>\n<p>\u00a0-n, &#8211;numeric-uid-gid<br \/>\n\u00a0 list numeric UIDs and GIDs instead of names<\/p>\n<p>\u00a0-N, &#8211;literal<br \/>\n\u00a0 print raw entry names (don&#8217;t treat e.g. control<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 characters specially)<\/p>\n<p>\u00a0-o<br \/>\n\u00a0 use long listing format without group info<\/p>\n<p>\u00a0-p, &#8211;file-type<br \/>\n\u00a0 append indicator (one of \/=@|) to entries<\/p>\n<p>\u00a0-q, &#8211;hide-control-chars<br \/>\n\u00a0 print ? instead of non graphic characters<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0 &#8211;show-control-chars<br \/>\n\u00a0 show non graphic characters as-is (default)<\/p>\n<p>\u00a0-Q, &#8211;quote-name<br \/>\n\u00a0 enclose entry names in double quotes<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0 &#8211;quoting-style=WORD<br \/>\n\u00a0 use quoting style WORD for entry names:<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 literal, shell, shell-always, c, escape<\/p>\n<p>\u00a0-r, &#8211;reverse<br \/>\n\u00a0 reverse order while sorting<\/p>\n<p>\u00a0-R, &#8211;recursive<br \/>\n\u00a0 list subdirectories recursively<\/p>\n<p>\u00a0-s, &#8211;size<br \/>\n\u00a0 print size of each file, in blocks<\/p>\n<p>\u00a0-S<br \/>\n\u00a0 sort by file size<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0 &#8211;sort=WORD<br \/>\n\u00a0 extension -X, none -U, size -S, time -t, version -v<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 status -c, time -t, atime -u, access -u, use -u<\/p>\n<p>\u00a0\u00a0\u00a0 &#8211;time=WORD<br \/>\n\u00a0 show time as WORD instead of modification time:<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 atime, access, use, ctime or status; use<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 specified time as sort key if &#8211;sort=time<\/p>\n<p>\u00a0-t<br \/>\n\u00a0 sort by modification time<\/p>\n<p>\u00a0-T, &#8211;tabsize=COLS<br \/>\n\u00a0 assume tab stops at each COLS instead of 8<\/p>\n<p>\u00a0-u<br \/>\n\u00a0 sort by last access time; with -l: show atime<\/p>\n<p>\u00a0-U<br \/>\n\u00a0 do not sort; list entries in directory order<\/p>\n<p>\u00a0-v<br \/>\n\u00a0 sort by version<\/p>\n<p>\u00a0-w, &#8211;width=COLS<br \/>\n\u00a0 assume screen width instead of current value<\/p>\n<p>\u00a0-x<br \/>\n\u00a0 list entries by lines instead of by columns<\/p>\n<p>\u00a0-X<br \/>\n\u00a0 sort alphabetically by entry extension<\/p>\n<p>\u00a0-1<br \/>\n\u00a0 list one file per line<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;help\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 display this help and exit<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;version\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 output version information and exit<\/p>\n<p>\u00a0Some good examples are:<\/p>\n<p>\u00a0ls -la<br \/>\n\u00a0ls -laF<br \/>\n\u00a0ls -laF &#8211;color<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ls -d *\/<\/p>\n<p>\u00a0Also see earlier in this tutorial about the `alias` command<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>lsattr<br \/>\n\u00a0list attributes, this command lists a files file system attributes.<br \/>\n\u00a0For more info see: man lsattr<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>lsmod<br \/>\n\u00a0list modules, lists all loaded modules with a very brief information.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>lsof<br \/>\n\u00a0list open files, this is a huge command, so if you really<br \/>\n\u00a0wanna find out more about this interesting command you will have<br \/>\n\u00a0to read the manual page for it.<br \/>\n\u00a0But here&#8217;s an example of use for it:<\/p>\n<p>\u00a0lsof -p 1<\/p>\n<p>\u00a0Which would be the same as:<\/p>\n<p>\u00a0lsof -p `pidof init`<\/p>\n<p>\u00a0Here&#8217;s another example:<\/p>\n<p>\u00a0lsof -p `pidof httpd | sed &#8216;s\/\\ \/,\/g&#8217;`<\/p>\n<p>\u00a0The &#8220;-p&#8221; means that the following argument will be a PID (Process ID).<br \/>\n\u00a0The &#8220;sed&#8221; part in the later example replaces any spaces with &#8220;,&#8221; since<br \/>\n\u00a0lsof doesnt want spaces between the pids, as the output of pidof gives.<\/p>\n<p>\u00a0For more info see: man lsof<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>lynx<br \/>\n\u00a0lynx is a console based world wide web browser, that has alot of<br \/>\n\u00a0arguments with which it can be executed, but it basicly works like<br \/>\n\u00a0this: lynx &lt;url&gt;<br \/>\n\u00a0If you press &#8216;g&#8217; while in lynx you can type in the url where you<br \/>\n\u00a0wanna go, and if you press &#8216;q&#8217; you quit lynx.<br \/>\n\u00a0You search in text with lynx with &#8216;\/&#8217; and move around with<br \/>\n\u00a0the arrow keys and the TAB key.<\/p>\n<p>\u00a0A tips is that lynx works as a file manager, as this: lynx &lt;\/path\/&gt;<\/p>\n<p>\u00a0A good usage for lynx is that you can use it as direct downloader,<br \/>\n\u00a0like this: lynx -souce <a href=\"ftp:\/\/ftp.bogus.com\/foo\/bar.tar.gz\">ftp:\/\/ftp.bogus.com\/foo\/bar.tar.gz<\/a> &gt; bar.tar.gz<\/p>\n<p>\u00a0For more help or information do: lynx &#8211;help<br \/>\n\u00a0Or: man lynx<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>mail<br \/>\n\u00a0mail is most commonly used to just check your mail in the most<br \/>\n\u00a0simple way by just typing `mail`, but it can also be used<br \/>\n\u00a0with alot of arguments, I have personally never used<br \/>\n\u00a0any arguments to the mail command, but if you wanna check<br \/>\n\u00a0them out do: man mail<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>man<br \/>\n\u00a0manual pages, there are several different manual pages, say for example<br \/>\n\u00a0the command exec, `man exec` should bring you little, while<br \/>\n\u00a0`man 3 exec` should bring you the C function manual on exec.<\/p>\n<p>\u00a0The man pages traditional way of storing is:<\/p>\n<p>\u00a0man1\u00a0 misc user commands<br \/>\n\u00a0man2\u00a0 C programming functions<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 man3\u00a0 more C programming functions<br \/>\n\u00a0man4\u00a0 network related manuals<br \/>\n\u00a0man5\u00a0 system related files<br \/>\n\u00a0man6\u00a0 game manuals<br \/>\n\u00a0man7\u00a0 misc technical manuals<br \/>\n\u00a0man8\u00a0 misc superuser commands<br \/>\n\u00a0man9\u00a0 misc system\/devices<\/p>\n<p>\u00a0I may be wrong about the category&#8217;s there, but that&#8217;s how it seems<br \/>\n\u00a0to me.<br \/>\n\u00a0Anyway, to bring up a manual page simply do: man &lt;command&gt;<br \/>\n\u00a0or: man &lt;number&gt; &lt;command&gt;<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>mc<br \/>\n\u00a0midnight commander is a visual shell for *nix Operating Systems.<br \/>\n\u00a0mc is quite large and has alot of arguments, I personally don&#8217;t use<br \/>\n\u00a0midnight commander at all, but if you wanna learn more about it<br \/>\n\u00a0do: man mc<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>mesg<br \/>\n\u00a0mesg is a command with which you control if other users should<br \/>\n\u00a0have write access to your terminal, as `wall` messages, `write`<br \/>\n\u00a0or anything similar.<\/p>\n<p>\u00a0mesg y turns on the access for others to write to your terminal.<br \/>\n\u00a0mesg n turns off the access for others to write to your terminal.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>mkdir<br \/>\n\u00a0make directory, creates a directory, works as: mkdir [arguments] dir\/<br \/>\n\u00a0The arguments can be as follows:<\/p>\n<p>\u00a0-m, &#8211;mode=MODE\u00a0 see chmod&#8217;s octal (numerical) modes<\/p>\n<p>\u00a0-p, &#8211;parents\u00a0 no error if existing, make\u00a0 parent<br \/>\n\u00a0\u00a0\u00a0 directories\u00a0 as needed<\/p>\n<p>\u00a0&#8211;verbose\u00a0 print a message for each created directory<\/p>\n<p>\u00a0&#8211;help\u00a0\u00a0\u00a0 display the help and exit<\/p>\n<p>\u00a0&#8211;version\u00a0 output version information and exit<\/p>\n<p>\u00a0mkdir is most commonly used as: mkdir &lt;newdir&gt;<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>mknod<br \/>\n\u00a0mknod is used to create special files, as devices.<br \/>\n\u00a0mknod&#8217;s syntax is this: mknod [arguments] &lt;name&gt; &lt;type&gt; [MAJOR MINOR]<br \/>\n\u00a0It can be used with the following arguments:<\/p>\n<p>\u00a0-m, &#8211;mode=MODE<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 set permission mode (as in chmod), not 0666 &#8211; umask<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;help<br \/>\n\u00a0 display this help and exit<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;version<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 output version information and exit<\/p>\n<p>\u00a0MAJOR MINOR are forbidden for &lt;type&gt; p, else they must be used.<\/p>\n<p>\u00a0b\u00a0\u00a0\u00a0\u00a0\u00a0 create a block (buffered) special file<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 c, u\u00a0\u00a0 create a character (unbuffered) special file<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 p\u00a0\u00a0\u00a0\u00a0\u00a0 create a FIFO<\/p>\n<p>\u00a0You need to know the devices major\/minior number if you gonna use this<br \/>\n\u00a0command, those are located in \/usr\/src\/linux\/Documentation\/devices.txt<br \/>\n\u00a0that comes with the kenrnel source.<br \/>\n\u00a0The &#8220;char&#8221; is the minior and the number before the devices are the<br \/>\n\u00a0major numbers so say that you wanna make a new \/dev\/null for some<br \/>\n\u00a0reason, then you read the devices.txt and see this:<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1 char\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Memory devices<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1 = \/dev\/mem\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Physical memory access<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 2 = \/dev\/kmem\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Kernel virtual memory access<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 3 = \/dev\/null\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Null device<\/p>\n<p>\u00a0And so you make the null device like this:<\/p>\n<p>\u00a0mknod \/dev\/null b 1 3<\/p>\n<p>\u00a0Or if you wanna make a new \/dev\/scd device to support another<br \/>\n\u00a0emulated scsi cdrom device. (there are 7 scd devices default)<br \/>\n\u00a0So here&#8217;s how you make another:<\/p>\n<p>\u00a0mknod \/dev\/scd8 b 11 8<\/p>\n<p>\u00a0This is not as hard at all &#8230;..<\/p>\n<p>\u00a0for more info: info mknod<br \/>\n\u00a0or: man mknod<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>modprobe<br \/>\n\u00a0modprobe loads modules in a similar way as depmod.<br \/>\n\u00a0See modprobe&#8217;s manual page: man modprobe<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>more<br \/>\n\u00a0more is a command to display a files contents, it&#8217;s very similar<br \/>\n\u00a0to the `less` command.<br \/>\n\u00a0See `less` and more&#8217;s manual pages: man more<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>mount<br \/>\n\u00a0mount, mounts a media, that is to say that you make the contents<br \/>\n\u00a0of say a hard drive visible to the system on some mountpoint,<br \/>\n\u00a0ie. mount -t vfat \/dev\/hda1 \/windows<br \/>\n\u00a0This command would mount hda1 (the first harddrive&#8217;s (hd a)<br \/>\n\u00a0first partition (hda 1), as (-t &lt;filesystem&gt;) vfat which is<br \/>\n\u00a0the windows native filesystem.<br \/>\n\u00a0Linux native filesystem is ext2.<\/p>\n<p>\u00a0mount has ALOT of arguments, if you wanna read about them all<br \/>\n\u00a0do: man mount<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>mv<br \/>\n\u00a0mv, moves a file or directory.<br \/>\n\u00a0It works like this: mv [argument] &lt;file-to-move&gt; &lt;new-name\/location&gt;<br \/>\n\u00a0This is an example: mv \/home\/alien\/bash.tutor \/home\/old\/bash.tutor<br \/>\n\u00a0Or just to rename a file: mv bash.tutor bash.file<\/p>\n<p>\u00a0mv can also be executed with alot of arguments, which are:<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -b, &#8211;backup<br \/>\n\u00a0 make backup before removal<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -f, &#8211;force<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 remove existing destinations, never prompt<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -i, &#8211;interactive<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 prompt before overwrite<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -S, &#8211;suffix=SUFFIX<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 override the usual backup suffix<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -u, &#8211;update<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 move only older or brand new non-directories<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -v, &#8211;verbose<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 explain what is being done<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -V, &#8211;version-control=WORD<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 override the usual version control<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;help<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 display the help and exit<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;version<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 output version information and exit<\/p>\n<p>\u00a0Here&#8217;s an example: mv -f \/home\/alien\/bash.tutor \/<br \/>\n\u00a0This will by force mv the file to \/ (if you have write rights to \/)<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>nc \/ netcat<br \/>\n\u00a0netcat is by default usually located in: \/usr\/lib\/linuxconf\/lib\/<br \/>\n\u00a0netcat is very useful in internet based shell scripts, since<br \/>\n\u00a0it can listen on a socket or send to sockets, depending on the version.<br \/>\n\u00a0the default netcat can as far as I know only send to sockets.<br \/>\n\u00a0works basicly like this:<\/p>\n<p>\u00a0\/usr\/lib\/linuxconf\/lib\/netcat &#8211;file &lt;file&gt; &lt;ip&gt; &lt;port&gt;<\/p>\n<p>\u00a0But can be executed with the following arguments:<br \/>\n\u00a0&#8211;head &lt;nb_lines&gt;<br \/>\n\u00a0&#8211;tail &lt;nb_lines&gt;<br \/>\n\u00a0&#8211;send &lt;file&gt;<\/p>\n<p>\u00a0A tip is to make one or two links from \/usr\/lib\/linuxconf\/lib\/netcat<br \/>\n\u00a0to \/usr\/local\/bin\/netcat and perhaps \/usr\/local\/bin\/nc<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>ncftp<br \/>\n\u00a0ncftp is a very powerful ftp client.<br \/>\n\u00a0ncftp has the following syntax: ncftp [arguments] &lt;host&gt;<br \/>\n\u00a0If no arguments is given it will try to login as anonymous user<br \/>\n\u00a0with an e-mail as password.<\/p>\n<p>\u00a0Most common non-anonymous usage is this: ncftp -u &lt;username&gt; &lt;host&gt;<\/p>\n<p>\u00a0The commands you will use the most once logged on to an ftp<br \/>\n\u00a0is the following:<\/p>\n<p>\u00a0get &lt;name&gt; download a file<br \/>\n\u00a0put &lt;name&gt; upload a file<br \/>\n\u00a0ls\u00a0 list current directory<br \/>\n\u00a0cd\u00a0 &lt;dir-name&gt; change directory<br \/>\n\u00a0lls\u00a0 list local directory<br \/>\n\u00a0lcd\u00a0 change local directory<\/p>\n<p>\u00a0If you want to read all ncftp&#8217;s commands and arguments do: man ncftp<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>ncftpget<br \/>\n\u00a0ncftpget is a command line based ftp download client. It works<br \/>\n\u00a0like this: ncftpget [arguments] &lt;host&gt; &lt;local-dir&gt; &lt;remote-files&gt;<\/p>\n<p>\u00a0ncftpget comes with ncftp, if you want to see all it&#8217;s commands,<br \/>\n\u00a0do: man ncftpget<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>ncftpput<br \/>\n\u00a0ncftpput is a command line based ftp upload client. It works<br \/>\n\u00a0like this: ncftpput [arguments] &lt;host&gt; &lt;remote-dir&gt; &lt;remote-files&gt;<\/p>\n<p>\u00a0ncftpput comes with ncftp, if you want to see all it&#8217;s commands,<br \/>\n\u00a0do: man ncftpput<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>netstat<br \/>\n\u00a0netstat will show you the network connections to and from your computer<br \/>\n\u00a0that&#8217;s currently active, it can simply be used by typing `netcat`<br \/>\n\u00a0or it can me used with it&#8217;s arguments, if you wanna learn<br \/>\n\u00a0more about this command, do: man netcat<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>nice<br \/>\n\u00a0nice is a command that can set the priority (cpu time) of a program<br \/>\n\u00a0or a command, the prioretys can be from -20 which is max priority<br \/>\n\u00a0to 19 which is the minimum priority.<br \/>\n\u00a0nice works like this: nice [argument] &lt;command&gt; &lt;argument&gt;<br \/>\n\u00a0The arguments &#8220;[argument]&#8221; for nice can be:<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -ADJUST<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 increment priority by ADJUST first<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -n, &#8211;adjustment=ADJUST<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 same as -ADJUST<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;help<br \/>\n\u00a0 display the help and exit<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;version<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 output version information and exit<\/p>\n<p>\u00a0Example: nice -n -20 make bzImage<br \/>\n\u00a0This will make the kernel with as much CPU as it can.<br \/>\n\u00a0This means this process has more rights then any other process.<\/p>\n<p>\u00a0Another example is: nice -n 19 zgv<br \/>\n\u00a0This will give zgv absolutely lowest priority, and will there for<br \/>\n\u00a0be the slowest moving processes on the system, as if it runs<br \/>\n\u00a0with nice 19 and another process comes and wants more CPU power<br \/>\n\u00a0then there is free, `zgv` will in this case give the other<br \/>\n\u00a0process of it&#8217;s own power.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>nmap<br \/>\n\u00a0nmap is getting to come as default for some Linux distributions,<br \/>\n\u00a0and is a port scanner, maybe the best port scanner there is.<\/p>\n<p>\u00a0nmap is used like this: nmap [arguments] &lt;host \/ ip&gt;<br \/>\n\u00a0So say you want to port scan yourself you could do:<br \/>\n\u00a0nmap 127.0.0.1<br \/>\n\u00a0Or: nmap localhost<br \/>\n\u00a0The most commonly used arguments to nmap is the &#8216;-sS&#8217; which<br \/>\n\u00a0is a SYN scan, and will in most cases not reveal your IP<br \/>\n\u00a0to the one that your scanning, BUT if the other side<br \/>\n\u00a0has any kind of modern logging device as a fairly new<br \/>\n\u00a0firewall or port logger your IP will be shown to him anyway.<\/p>\n<p>\u00a0The other perhaps next most common argument to use is the &#8216;-O&#8217;<br \/>\n\u00a0argument, which will give you a good guess of what the remote<br \/>\n\u00a0operating system is this function works the same as for<br \/>\n\u00a0the operating system guess program `queso`.<\/p>\n<p>\u00a0Example: nmap -sS -O localhost &gt; localhost.log<\/p>\n<p>\u00a0The &#8216;&gt; localhost.log&#8217; part will put the outcome of the scan in a file<br \/>\n\u00a0called localhost.log.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>ntpdate<br \/>\n\u00a0ntpdate has no manual page nor any help page what I can found,<br \/>\n\u00a0perhaps I&#8217;ll write one if I&#8217;m bored some day &#8230;..<\/p>\n<p>\u00a0ntpdate will synchronize your computers system clock with an atomic<br \/>\n\u00a0clock.<\/p>\n<p>\u00a0ntpdate&#8217;s help usage gives this:<\/p>\n<p>\u00a0usage: ntpdate [-bBdqsv] [-a key#] [-e delay] [-k file] [-p samples]<br \/>\n\u00a0[-o version#] [-r rate] [-t timeo] server &#8230;<\/p>\n<p>\u00a0I only use it as: ntpdate &lt;server&gt;<br \/>\n\u00a0Like this: ntpdate ntp.lth.se<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>ntsys \/ ntsysv<br \/>\n\u00a0runlevel confuration tool.<br \/>\n\u00a0This tool lets you configure what services that should be<br \/>\n\u00a0started with your runlevel, alteast ntsysv has a nice<br \/>\n\u00a0ncurses interface that&#8217;s easy to handle.<\/p>\n<p>\u00a0For moreinformation on this command do: man ntsys<br \/>\n\u00a0Or: man ntsysv<br \/>\n\u00a0Depending on your system.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>objdump<br \/>\n\u00a0objdump is a quite large command, that allows you to dump objects<br \/>\n\u00a0out of a binary file.<br \/>\n\u00a0To dump all objects do: objdump &#8211;source &lt;binary file&gt;<br \/>\n\u00a0For more info do: man objdump<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>passwd<br \/>\n\u00a0passwd is a little tool to set a password to a user account,<br \/>\n\u00a0it basicly works like this: passwd [arguments] &lt;username&gt;<br \/>\n\u00a0or if you just type `passwd` you will change your own password.<br \/>\n\u00a0passwd can be sued with the following arguments:<\/p>\n<p>\u00a0-d, &#8211;delete\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 delete the password for the named account<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (root only)<br \/>\n\u00a0\u00a0 -f, &#8211;force\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 force operation<br \/>\n\u00a0\u00a0 -k, &#8211;keep-tokens\u00a0\u00a0 keep non-expired authentication tokens<br \/>\n\u00a0\u00a0 -l, &#8211;lock\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 lock the named account (root only)<br \/>\n\u00a0\u00a0 -S, &#8211;status\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 report password status on the named account<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (root only)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;stdin\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 read new tokens from stdin (root only)<br \/>\n\u00a0\u00a0 -u, &#8211;unlock\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 unlock the named account (root only)<\/p>\n<p>\u00a0Help options<\/p>\n<p>\u00a0-?, &#8211;help\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Show the help message<br \/>\n\u00a0\u00a0 &#8211;usage\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Display brief usage message<\/p>\n<p>\u00a0You still need to do a: man passwd<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>patch<br \/>\n\u00a0patch simply works like this: patch &lt;original-file&gt; &lt;patch-file&gt;<br \/>\n\u00a0A patch is done with the `diff` command as<br \/>\n\u00a0this: diff file1 file2 &gt; patchfile<br \/>\n\u00a0So then to make file1 identical to file2: patch file1 patchfile<\/p>\n<p>\u00a0patch can however be used with a whole lot of arguments,<br \/>\n\u00a0if you are interested do: man patch<br \/>\n\u00a0Or: patch &#8211;help<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>pidof<br \/>\n\u00a0pidof simply gives the PID of a running process without you having<br \/>\n\u00a0to use &#8220;ps&#8221;, say that you want to find out what pid your init has,<br \/>\n\u00a0(it will always be one for the init), then you do: pidof init<br \/>\n\u00a0Or if you wanna find out which pids are used by the web server (httpd)<br \/>\n\u00a0then you do: pidof httpd<br \/>\n\u00a0So basically you find out the pids from the process name(s).<\/p>\n<p>\u00a0pidof has the following switches:<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -s\u00a0\u00a0\u00a0\u00a0 Single shot &#8211; this instructs the program to only return one pid.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -x\u00a0\u00a0\u00a0\u00a0 Scripts too &#8211; this causes the program to also return process<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 id&#8217;s of shells running the named scripts.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -o\u00a0\u00a0\u00a0\u00a0 Tells pidof to omit processes with that process id.<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 The special pid %PPID can be used to name the parent process of<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 the pidof program, in other words the calling shell or shell<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 script.<\/p>\n<p>\u00a0For more info see: man pidof<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>ping<br \/>\n\u00a0ping is a pretty basic command, that will work<br \/>\n\u00a0as: ping [arguments] &lt;ip-or-host&gt;<br \/>\n\u00a0The arguments can be as follows:<\/p>\n<p>\u00a0-c\u00a0 &lt;number&gt; count pings to send<br \/>\n\u00a0-d\u00a0 debug<br \/>\n\u00a0-f ping flood<br \/>\n\u00a0-i &lt;number&gt; wait number of seconds between each ping<br \/>\n\u00a0-l &lt;number&gt; preload number of pings<br \/>\n\u00a0-n numeric IP&#8217;s only<br \/>\n\u00a0-p pattern (in hex) to send as pad code in the ping header<br \/>\n\u00a0-q quiet<br \/>\n\u00a0-R\u00a0\u00a0\u00a0\u00a0\u00a0 record route<br \/>\n\u00a0-s\u00a0 &lt;number&gt; packet size in bytes<br \/>\n\u00a0-v\u00a0\u00a0\u00a0\u00a0\u00a0 Verbose output<\/p>\n<p>\u00a0So say that you wanna send 5 pings that&#8217;s 128 bytes each to<br \/>\n\u00a0IP 127.0.0.1, then you would do: ping -s 128 -c 5 127.0.0.1<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>pmake<br \/>\n\u00a0pmake is *BSD make (so I&#8217;m told), see make and: man pmake<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>pnpdump<br \/>\n\u00a0pnpdump gives a dump of all ISA pnp devices, good to use<br \/>\n\u00a0with isapnp etc.<br \/>\n\u00a0This is the command you wanna have a look at if your either<br \/>\n\u00a0looking for exact info of some ISA device that is pnp, or<br \/>\n\u00a0if your system has problems finding a ISA pnp device.<br \/>\n\u00a0See the manual pages.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>portmap<br \/>\n\u00a0portmap is the server that maps all RPC services, so if you<br \/>\n\u00a0wanna use any RPC service you wanna have portmap running.<br \/>\n\u00a0For more info: man portmap<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>ps<br \/>\n\u00a0ps gives you the process list, as in showing you the running<br \/>\n\u00a0processes with there pid and other info.<br \/>\n\u00a0do: ps &#8211;help<br \/>\n\u00a0or: man ps for more info on what arguments it can be executed<br \/>\n\u00a0with, personally I use: `ps aux` and `ps x` the most.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>pstree<br \/>\n\u00a0process tree, a bit more (ascii) graphical version of ps,<br \/>\n\u00a0do: pstree &#8211;help<br \/>\n\u00a0or: man pstree<br \/>\n\u00a0for more help on the arguments, personally I use it alone without<br \/>\n\u00a0arguments.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>pwd<br \/>\n\u00a0print working directory, shows you your current directory.<br \/>\n\u00a0This command can be useful for 2 things what I know of,<br \/>\n\u00a0one is to show you where you are, and the other in scripts<br \/>\n\u00a0to do say: echo &#8220;output will go to: `pwd`\/logfile&#8221;<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>quota<br \/>\n\u00a0quota prints the users quota, it works like<br \/>\n\u00a0this: quota [arguments] &lt;user\/group&gt;<br \/>\n\u00a0Where the arguments can be:<\/p>\n<p>\u00a0-g\u00a0\u00a0\u00a0\u00a0\u00a0 Print group quotas for the group of which the\u00a0 user<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 is a member.\u00a0 The optional<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -u\u00a0\u00a0\u00a0\u00a0\u00a0 flag is equivalent to the default.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -v\u00a0\u00a0\u00a0\u00a0\u00a0 will display quotas on filesystems where no storage<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 is allocated.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -q\u00a0\u00a0\u00a0\u00a0\u00a0 Print a more terse message, containing only\u00a0 infor-<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 mation on filesystems where usage is over quota.<\/p>\n<p>\u00a0For more info on the quota command do: man quota<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>quotaoff<br \/>\n\u00a0quotaoff turns the quota off for a file system.<br \/>\n\u00a0quotaoff works like this: quotaoff [arguments] &lt;filesystem&gt;<br \/>\n\u00a0The arguments can be as follows:<\/p>\n<p>\u00a0-a\u00a0\u00a0\u00a0\u00a0\u00a0 Force\u00a0 all file systems in \/etc\/fstab to have their<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 quotas disabled.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -v\u00a0\u00a0\u00a0\u00a0\u00a0 Display a message for each file system affected.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -u\u00a0\u00a0\u00a0\u00a0\u00a0 Manipulate user quotas. This is the default.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -g\u00a0\u00a0\u00a0\u00a0\u00a0 Manipulate group quotas.<\/p>\n<p>\u00a0This command is close to quotaon.<\/p>\n<p>\u00a0For more info: man quotaon<br \/>\n\u00a0(Don&#8217;t think there is a quotaoff man page, quotaon and quotaoff<br \/>\n\u00a0seems to have the same manual page)<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>quotaon<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 quotaon turns the quota on for a file system.<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 quotaon works like this: quotaon [arguments] &lt;filesystem&gt;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 The arguments can be as follows:<\/p>\n<p>\u00a0-a\u00a0\u00a0\u00a0\u00a0\u00a0 All file systems in\u00a0 \/etc\/fstab\u00a0 marked\u00a0 read-write<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 with quotas will have their quotas turned on.\u00a0 This<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 is normally used at boot time to enable quotas.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -v\u00a0\u00a0\u00a0\u00a0\u00a0 Display a message for each file system where quotas<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 are turned on.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -u\u00a0\u00a0\u00a0\u00a0\u00a0 Manipulate user quotas. This is the default.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -g\u00a0\u00a0\u00a0\u00a0\u00a0 Manipulate group quotas.<\/p>\n<p>\u00a0For more info: man quotaon<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>quotastats<br \/>\n\u00a0quotastats displays the quota stats &#8230;. cant find any help, &#8211;help<br \/>\n\u00a0or manual page for it.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>read<br \/>\n\u00a0read, reads a variable.<\/p>\n<p>\u00a0Example:<\/p>\n<p>\u00a0echo -n &#8220;password: &#8221;<br \/>\n\u00a0read pass<br \/>\n\u00a0echo &#8220;Password was: $pass&#8221;<\/p>\n<p>\u00a0For more info: help read<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>reboot<br \/>\n\u00a0reboot does what it says, it reboots the system, you have to be root<br \/>\n\u00a0to use this command.<br \/>\n\u00a0reboot works the same as: shutdown -r now<br \/>\n\u00a0or also the same as if you press: Ctrl+Alt+Del<br \/>\n\u00a0Nothing much more to say about the reboot command.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>reset<br \/>\n\u00a0reset resets the console, say that you have accidently done<br \/>\n\u00a0cat &lt;binary-file&gt; so you totally screwed up your console<br \/>\n\u00a0and you cant read anything on it, then just type `reset`<br \/>\n\u00a0and press enter, and it should be back to normal within some seconds.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>rlogin<br \/>\n\u00a0remote login, if you wanna use this command do: man rlogin<br \/>\n\u00a0bore using it.<br \/>\n\u00a0The most common use of it is: rlogin -l &lt;username&gt; &lt;host&gt;<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>rm<br \/>\n\u00a0remove, remove\/unlink files, rm can be used with the<br \/>\n\u00a0following arguments:<\/p>\n<p>\u00a0\u00a0 -d, &#8211;directory\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 unlink directory, even if non-empty<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (super-user only)<br \/>\n\u00a0\u00a0 -f, &#8211;force\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ignore nonexistent files, never prompt<br \/>\n\u00a0\u00a0 -i, &#8211;interactive\u00a0\u00a0\u00a0\u00a0 prompt before any removal<br \/>\n\u00a0\u00a0 -r, -R, &#8211;recursive\u00a0\u00a0 remove the contents of directories recursively<br \/>\n\u00a0\u00a0 -v, &#8211;verbose\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 explain what is being done<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;help\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 display this help and exit<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;version\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 output version information and exit<\/p>\n<p>\u00a0An example is, that if you have a directory called \/foo<br \/>\n\u00a0that you wanna delete recursively, then you do: rm -rf \/foo<br \/>\n\u00a0Or say that you have a file \/foo\/bar that you wanna remove<br \/>\n\u00a0without being prompted, then you do it like this: rm -f \/foo\/bar<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>rmmod<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 remove modules, remove a loaded module.<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 List the modules that you can remove with lsmod.<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 And load modules with insmod.<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 man any of them for more information.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>route<br \/>\n\u00a0route, displays the routing table by default.<br \/>\n\u00a0The most common way of adding a route is like this:<br \/>\n\u00a0route add -host &lt;ip&gt; gw &lt;other-ip&gt;<\/p>\n<p>\u00a0And to remove a post:<br \/>\n\u00a0route del -host &lt;ip&gt; gw &lt;other-ip&gt;<\/p>\n<p>\u00a0An example would be, say that you want to route IP 123.123.123.123<br \/>\n\u00a0to 127.0.0.1, this would drop any connection attempts from<br \/>\n\u00a0123.123.123.123 to 127.0.0.1 so he cant connect to you or scan you,<br \/>\n\u00a0(this is true in most cases), you would do:<\/p>\n<p>\u00a0route add -host 123.123.123.123 gw 127.0.0.1<\/p>\n<p>\u00a0Now the route command is bigger then that, so if you wanna<br \/>\n\u00a0learn more about it do: man route<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>rpm<br \/>\n\u00a0rpm is a command that is is very important to most distributions.<br \/>\n\u00a0rpm is short for &#8216;redhat package manager&#8217; and was developed for<br \/>\n\u00a0RedHat by Caldera.<br \/>\n\u00a0rpm is a HUGE command, and works like this: rpm [arguments] &lt;file&gt;<br \/>\n\u00a0but here are the most commonly used arguments:<\/p>\n<p>\u00a0rpm -ivh &lt;package.rpm&gt; installs package.rpm<br \/>\n\u00a0rpm -Uvh &lt;package.rpm&gt; updates package.rpm<br \/>\n\u00a0rpm -e &lt;package&gt; un-installed\/erases package<br \/>\n\u00a0rpm -qf &lt;file&gt;\u00a0 displays what package the file came with<br \/>\n\u00a0rpm -qlp &lt;package.rpm&gt; displays the contents of the package.rpm<br \/>\n\u00a0rpm -qRp &lt;package.rpm&gt;\u00a0 displays the dependencys needed by package.rpm<\/p>\n<p>\u00a0Other arguments and that are commonly used but not recommended are:<\/p>\n<p>\u00a0&#8211;force\u00a0 force install something<br \/>\n\u00a0&#8211;nodeps do not check dependences<\/p>\n<p>\u00a0Another thing is if you installed a *.src.rpm file (that ends up in<br \/>\n\u00a0\/usr\/src\/RPM\/*), you can compile a binary .rpm from it.<br \/>\n\u00a0Say that you installed some-package.src.rpm, then you would go to:<br \/>\n\u00a0\/usr\/src\/RPM\/SPECS\/, and there type: rpm -ba some-package.spec<br \/>\n\u00a0wait a while during the compile, and then you would have a<br \/>\n\u00a0\/usr\/src\/RPM\/RPMS\/&lt;platform&gt;\/some-package.&lt;platform&gt;.rpm<\/p>\n<p>\u00a0the &#8220;&lt;platform&gt;&#8221; is your platform, as i386, i486, i586, i686,<br \/>\n\u00a0k6, ppc, sprac, noarch etc.<\/p>\n<p>\u00a0To create an rpm from a .src.rpm you first need to know that<br \/>\n\u00a0this should not be done as root for the simple reason that<br \/>\n\u00a0if you make an rpm as root several unworking parts of it may<br \/>\n\u00a0remain in your system generating errors if the compile of<br \/>\n\u00a0the rpm isnt successful.<\/p>\n<p>\u00a0So the first thing you do to do this as user is to create a file<br \/>\n\u00a0named .rpmmacros<br \/>\n\u00a0And in that add the following:<br \/>\n\u00a0%_topdir\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ~\/RPM<\/p>\n<p>\u00a0This should work to create the file:<br \/>\n\u00a0echo &#8220;%_topdir\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $HOME\/RPM&#8221; &gt; ~\/.rpmmacros<\/p>\n<p>\u00a0Then you do this:<br \/>\n\u00a0mkdir -p ~\/RPM\/{SOURCES,SPECS,BUILD,RPMS,SRPMS}<\/p>\n<p>\u00a0Now you&#8217;re ready to start to build an rpm from a .src.rpm<br \/>\n\u00a0first (as user, not as root) install the source rpm.<\/p>\n<p>\u00a0rpm -ivh package.src.rpm<\/p>\n<p>\u00a0Then you go to ~\/RPM\/SPECS\/<\/p>\n<p>\u00a0The .src.rpm should have installed the sources in ~\/RPM\/SOURCES<br \/>\n\u00a0and the spec file in ~\/RPM\/SPECS\/<br \/>\n\u00a0The spec file is like a script file, it tells rpm how to compile<br \/>\n\u00a0the source and build the rpm.<\/p>\n<p>\u00a0Now find the spec file in ~\/RPM\/SPECS\/, it&#8217;s usually named the same<br \/>\n\u00a0as the package, like this:<\/p>\n<p>\u00a0package.spec<\/p>\n<p>\u00a0So not to make an rpm out of it, do this:<\/p>\n<p>\u00a0rpm -ba package.spec<\/p>\n<p>\u00a0If this is successful (which it sadly enough isnt every time because<br \/>\n\u00a0of ill written spec files)<br \/>\n\u00a0You should now have an rpm file in ~\/RPM\/RPMS\/&lt;your architecture&gt;<\/p>\n<p>\u00a0If you have a Pentium 2, the arch command will show &#8220;i586&#8221; and<br \/>\n\u00a0so the rpm will be found in ~\/RPM\/RPMS\/i586\/<\/p>\n<p>\u00a0You will also have a brand new .src.rpm in ~\/RPM\/SRPMS\/<\/p>\n<p>\u00a0If you need to do the rpm to any other target then your own<br \/>\n\u00a0architecture, say you want to do it for i386, then you may do:<\/p>\n<p>\u00a0rpm -ba package.spec &#8211;target=i386<\/p>\n<p>\u00a0And so the new rpm will be found in ~\/RPM\/RPMS\/i386\/<br \/>\n\u00a0This is about all there is to say about the rpm command in this<br \/>\n\u00a0tutorial.<br \/>\n\u00a0The rpm command and the spec file *scripting* langauge<br \/>\n\u00a0would need a rather large tutorial by it self to be explained<br \/>\n\u00a0in full &#8230;. so I wont take up all that here.<\/p>\n<p>\u00a0For more info on the rpm command do: man rpm<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>sed<br \/>\n\u00a0sed, stream editor, is already breafly explained in this tutorial,<br \/>\n\u00a0so if you want more info do: man sed<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>setleds<br \/>\n\u00a0setleds may show or set the flags and lights on NumLock, CapsLock<br \/>\n\u00a0and ScrollLock.<br \/>\n\u00a0On it&#8217;s own without any arguments it shows the current settings.<\/p>\n<p>\u00a0The syntax is this: setleds [arguments] &lt;+\/-num,caps,scroll&gt;<\/p>\n<p>\u00a0Here&#8217;s the arguments:<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -F This\u00a0 is the default. Only change the VT flags (and<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 their setting may\u00a0 be\u00a0 reflected\u00a0 by\u00a0 the\u00a0 keyboard<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 leds).<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -D\u00a0\u00a0\u00a0\u00a0\u00a0 Change both the VT flags and their default settings<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (so that a\u00a0 subsequent\u00a0 reset\u00a0 will\u00a0 not\u00a0 undo\u00a0 the<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 change). This might be useful for people who always<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 want to have numlock set.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -L\u00a0\u00a0\u00a0\u00a0\u00a0 Do not touch the VT\u00a0 flags,\u00a0 but\u00a0 only\u00a0 change\u00a0 the<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 leds.\u00a0 From this moment on, the leds will no longer<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 reflect the VT flags (but display whatever\u00a0 is\u00a0 put<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 into them). The command setleds -L (without further<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 arguments) will restore the situation in which\u00a0 the<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 leds reflect the VT flags.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -num +num<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Clear\u00a0 or\u00a0 set\u00a0 NumLock.\u00a0\u00a0 (At present, the NumLock<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 setting influences\u00a0 the\u00a0 interpretation\u00a0 of\u00a0 keypad<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 keys.\u00a0\u00a0 Pressing\u00a0 the\u00a0 NumLock\u00a0 key complements the<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 NumLock setting.)<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -caps +caps<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Clear or set CapsLock.\u00a0 (At present,\u00a0 the\u00a0 CapsLock<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 setting\u00a0 complements\u00a0 the Shift key when applied to<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 letters.\u00a0 Pressing the CapsLock key complements the<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 CapsLock setting.)<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -scroll +scroll<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Clear or set ScrollLock.\u00a0 (At present, pressing the<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ScrollLock key (or ^S\/^Q) stops\/starts console out-<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 put.)<\/p>\n<p>\u00a0Here is a few example, where the first one is from the manualpage,<br \/>\n\u00a0(I&#8217;d hate to break the cut&#8217;n&#8217;paste tradition from the manual pages<br \/>\n\u00a0now), so here are some examples:<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 INITTY=\/dev\/tty[1-8]<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 for tty in $INITTY; do<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 setleds -D +num &lt; $tty<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 done<\/p>\n<p>\u00a0This would set numlock on for tty1 to tty8<\/p>\n<p>\u00a0Here&#8217;s another short example:<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 while \/bin\/true; do<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 setleds -L +caps; usleep 500000<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 setleds -L +num; usleep 500000<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 setleds -L -caps; usleep 500000<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 setleds -L -num; usleep 500000<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 done<\/p>\n<p>\u00a0This would flash the NumLock and CapsLock leds, for infinety.<\/p>\n<p>\u00a0For more info do: man setleds<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>seq<br \/>\n\u00a0sequence numbers.<br \/>\n\u00a0seq works baskically like this:<\/p>\n<p>\u00a0seq [OPTION] LAST<br \/>\n\u00a0seq [OPTION] FIRST LAST<br \/>\n\u00a0seq [OPTION] FIRST INCREMENT LAST<\/p>\n<p>\u00a0And can be used with the following options:<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -f, &#8211;format FORMAT\u00a0\u00a0\u00a0\u00a0\u00a0 use printf(3) style FORMAT (default: %g)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -s, &#8211;separator STRING\u00a0\u00a0 use STRING to separate numbers (default: \\n)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -w, &#8211;equal-width\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 equalize width by padding with leading zeroes<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;help\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 display this help and exit<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;version\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 output version information and exit<\/p>\n<p>\u00a0Here&#8217;s some small examples and what they do:<\/p>\n<p>\u00a0seq 10\u00a0 (Count from 1 to 10)<br \/>\n\u00a0seq 5 10 (Count from 5 to 10)<br \/>\n\u00a0seq 1 2 10 (Count from 1 to 10 by incrementing two: 1,3,5,7,9)<br \/>\n\u00a0seq 10 0 (Count backwards from 10 to 0)<\/p>\n<p>\u00a0For more info do: seq &#8211;help<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>sleep<br \/>\n\u00a0sleep works like this: sleep &lt;number of seconds&gt;<br \/>\n\u00a0Not much to say about this command, &#8230; if you wanna read<br \/>\n\u00a0more about it: man sleep<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>sort<br \/>\n\u00a0sort, sorts the contents of a file and gives the output to stdout.<br \/>\n\u00a0By default it sorts it in alphabetical order, sort works<br \/>\n\u00a0like this: sort [arguments] &lt;file&gt;<\/p>\n<p>\u00a0sort can be executed with the following arguments:<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -b\u00a0\u00a0\u00a0\u00a0\u00a0 ignore leading blanks in sort fields or keys<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -c\u00a0\u00a0\u00a0\u00a0\u00a0 check if given files already sorted, do not sort<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -d\u00a0\u00a0\u00a0\u00a0\u00a0 consider only [a-zA-Z0-9 ] characters in keys<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -f\u00a0\u00a0\u00a0\u00a0\u00a0 fold lower case to upper case characters in keys<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -g\u00a0\u00a0\u00a0\u00a0\u00a0 compare according to general numerical value, imply -b<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -i\u00a0\u00a0\u00a0\u00a0\u00a0 consider only [ 40- 176] characters in keys<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -k POS1[,POS2]<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 start a key at POS1, end it *at* POS2<br \/>\n\u00a0 field\u00a0 numbers\u00a0 and\u00a0 character offsets are numbered<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 starting with one (contrast\u00a0 with\u00a0 zero-based\u00a0 +POS form)<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -m\u00a0\u00a0\u00a0\u00a0\u00a0 merge already sorted files, do not sort<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -M\u00a0\u00a0\u00a0\u00a0\u00a0 compare (unknown) &lt; `JAN&#8217; &lt; &#8230; &lt; `DEC&#8217;, imply -b<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -n\u00a0\u00a0\u00a0\u00a0\u00a0 compare\u00a0 according to string numerical value, imply -b<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -o FILE<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 write result on FILE instead of standard output<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -r\u00a0\u00a0\u00a0\u00a0\u00a0 reverse the result of comparisons<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -s\u00a0\u00a0\u00a0\u00a0\u00a0 stabilize sort by disabling last resort comparison<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -t SEP\u00a0 use SEParator instead of non- to whitespace transition<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -T DIRECTORY<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 use\u00a0 DIRECTORY\u00a0 for temporary files, not $TMPDIR or \/tmp<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -u\u00a0\u00a0\u00a0\u00a0\u00a0 with -c, check for strict ordering; with\u00a0 -m,\u00a0 only<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 output the first of an equal sequence<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -z\u00a0\u00a0\u00a0\u00a0\u00a0 end\u00a0 lines\u00a0 with\u00a0 0\u00a0 byte,\u00a0 not\u00a0 newline,\u00a0 for find -print0<\/p>\n<p>\u00a0&#8211;help\u00a0\u00a0 display the help and exit<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;version output version information and exit<\/p>\n<p>\u00a0One more time I give thanks to the cut &amp; paste function.<\/p>\n<p>\u00a0Here&#8217;s an example of sort: sort file1 -o sorted-file2<br \/>\n\u00a0This command works good with the `uniq` command to sort out<br \/>\n\u00a0duplica words, like this: sort file1 | uniq &gt; sorted-file<\/p>\n<p>\u00a0For more info do: man sort<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>ssh<br \/>\n\u00a0secure shell, works a bit like telnet but has encryption,<br \/>\n\u00a0ssh is becoming a good standard of encrypted remote shell connections.<br \/>\n\u00a0ssh is however not usually default included in any distros,<br \/>\n\u00a0and there is several versions of it, so if you download it<br \/>\n\u00a0make sure to read all documentations about it.<br \/>\n\u00a0Even though it&#8217;s not default included, I still wanned to include it<br \/>\n\u00a0in this tutorial to make users that use LAN connections<br \/>\n\u00a0as local networks with more then one user or cable modems aware<br \/>\n\u00a0of this tool, because if they use telnet anyone on the local<br \/>\n\u00a0subnet can sniff the connection and get any login and password<br \/>\n\u00a0used with incoming or outgoing telnet connections.<br \/>\n\u00a0Really anyone can sniff anything that&#8217;s not encrypted, like<br \/>\n\u00a0ftp logins and passwords, http, IRC, and everything like that.<br \/>\n\u00a0but the most vital to protect is the ways people can enter<br \/>\n\u00a0your system, so if you are on a LAN with more then one user<br \/>\n\u00a0or have any form of cable or non-dialup connection,<br \/>\n\u00a0then disable telnet (put a # in front of the telnet line in<br \/>\n\u00a0\/etc\/initd.conf and after that do: killall -HUP initd), and then<br \/>\n\u00a0install ssh.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>strip<br \/>\n\u00a0strip strips binary files (executables) of junk code,<br \/>\n\u00a0such as debugging information.<br \/>\n\u00a0This may be very useful to bring down the size of executable files.<br \/>\n\u00a0BUT beware, if you strip the kernel or any other very complex<br \/>\n\u00a0binary, they are likely to malfunction, so use this command<br \/>\n\u00a0wisely, and read it&#8217;s manual page.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>su<br \/>\n\u00a0su, the manual pages says substitute user and the UNIX command bible<br \/>\n\u00a0says super user &#8230; so it means any of those, it&#8217;s however used<br \/>\n\u00a0to *become another user*, if you are root and su &lt;user&gt; you wont<br \/>\n\u00a0need to supply any password.<br \/>\n\u00a0If you type only `su` as user you will become root if you have the<br \/>\n\u00a0aproperiet root password.<br \/>\n\u00a0su can be used with the following arguments:<\/p>\n<p>\u00a0-, -l, &#8211;login\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 make the shell a login shell<br \/>\n\u00a0\u00a0 -c, &#8211;commmand=COMMAND\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 pass a single COMMAND to the shell with -c<br \/>\n\u00a0\u00a0 -f, &#8211;fast\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 pass -f to the shell (for csh or tcsh)<br \/>\n\u00a0\u00a0 -m, &#8211;preserve-environment\u00a0\u00a0 do not reset environment variables<br \/>\n\u00a0\u00a0 -p\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 same as -m<br \/>\n\u00a0\u00a0 -s, &#8211;shell=SHELL\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 run SHELL if \/etc\/shells allows it<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;help\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 display this help and exit<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;version\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 output version information and exit<\/p>\n<p>\u00a0Say now that you wanna su to root and have root&#8217;s path\/enviorment.<br \/>\n\u00a0then you do: su &#8211;<br \/>\n\u00a0Or say that you wanna execute a single command as root from being<br \/>\n\u00a0a user, say the command `adduser`, then you do: su -c &#8220;adduser&#8221;<br \/>\n\u00a0you will be prompted for the password, and if you can supply it<br \/>\n\u00a0the command will be executed as root.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>swapoff<br \/>\n\u00a0turns swap off, it can be used with the following arguments:<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -h\u00a0\u00a0\u00a0\u00a0 Provide help<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -V\u00a0\u00a0\u00a0\u00a0 Display version<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -s\u00a0\u00a0\u00a0\u00a0 Display\u00a0 swap usage summary by device.\u00a0 This option<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 is only available if \/proc\/swaps\u00a0 exists\u00a0 (probably<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 not before kernel 2.1.25).<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -a\u00a0\u00a0\u00a0\u00a0 All\u00a0 devices\u00a0 marked\u00a0 as\u00a0 &#8220;sw&#8221;\u00a0 swap\u00a0 devices\u00a0 in<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/etc\/fstab are made available.<br \/>\n\u00a0-p priority (man swapon and swapoff for more info on prioretys)<\/p>\n<p>\u00a0Example, say that you wanna turn all swap partitions (from \/etc\/fstab)<br \/>\n\u00a0off then you do: swapoff -a<br \/>\n\u00a0Again, for more info: man swapoff<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>swapon<br \/>\n\u00a0swapon is the opposite of swapoff but has the same arguments.<br \/>\n\u00a0See: man swapon<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>tail<br \/>\n\u00a0tail gives by default the last 10 lines out of a file, it&#8217;s very alike<br \/>\n\u00a0the `head` command, ad works like this: tail [arguments] &lt;file&gt;<br \/>\n\u00a0The most common usage of tail is this:<\/p>\n<p>\u00a0tail -f &lt;file&gt; This will append the data to stdout as the file grows.<br \/>\n\u00a0\u00a0 very good to view logs as they come in.<\/p>\n<p>\u00a0tail -50 &lt;file&gt; Displays the last 50 lines from a file.<\/p>\n<p>\u00a0tail has more arguments which you can learn in it&#8217;s manual page<br \/>\n\u00a0if you are interested, do: man tail<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>talk<br \/>\n\u00a0talk is a little daemon controlled by inetd, so if it doesn&#8217;t<br \/>\n\u00a0work on your local machine make sure the talk line in<br \/>\n\u00a0\/etc\/inetd.cond are not remmed by a leading # character.<\/p>\n<p>\u00a0Talk gives a real time text chat, in a horizontally divided<br \/>\n\u00a0window or rather console.<\/p>\n<p>\u00a0Talk works like this: talk <a href=\"mailto:user@host\">user@host<\/a><br \/>\n\u00a0or just user if it&#8217;s on the local machine.<br \/>\n\u00a0Say that I wanna send a talk request to user `alfa` on IP<br \/>\n\u00a0123.123.123.132, and I&#8217;m user `beta` on 234.234.234.234.<br \/>\n\u00a0Then I type: talk <a href=\"mailto:alfa@123.123.123.132\">alfa@123.123.123.132<\/a><br \/>\n\u00a0And he as answer when the request comes<br \/>\n\u00a0types: talk <a href=\"mailto:beta@234.234.234.234\">beta@234.234.234.234<\/a><\/p>\n<p>\u00a0What to type as answer comes up when you get a talk request.<\/p>\n<p>\u00a0For more info on the talk command do: man talk<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>tar<br \/>\n\u00a0tar, UNIX tape archive, is yet another huge command,<br \/>\n\u00a0it&#8217;s used to compress a directory to a compressed .tar file,<br \/>\n\u00a0or a single file to a tar file.<br \/>\n\u00a0tar works like this: tar [arguments] &lt;directory-or-file&gt;<\/p>\n<p>\u00a0Here are the most common examples of tar usage:<\/p>\n<p>\u00a0tar -zvxf &lt;file.tar.gz&gt; uncompress a .tar.gz or .tgz archive<br \/>\n\u00a0tar -vxf &lt;file.tar&gt; uncompress a .tar archive<br \/>\n\u00a0tar -c &#8211;file=&lt;file.tar&gt; &lt;directory&gt; crates a .tar archive<br \/>\n\u00a0tar -cf &lt;file.tar&gt; &lt;directory&gt;\u00a0\u00a0\u00a0 &#8211; same as above &#8211;<br \/>\n\u00a0tar -tf &lt;file.tar&gt; list the contents of a .tar file<br \/>\n\u00a0tar -tzf &lt;file.tar.gz&gt; list the contents of a .tar.gz or a .tgz file<br \/>\n\u00a0tar -czvf &lt;file.tar.gz&gt; &lt;directory&gt; crates a .tar.gz archive<\/p>\n<p>\u00a0For more info on the tar command, do: man tar<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>tcpdump<br \/>\n\u00a0tcpdump is a command that let&#8217;s you view the traffic on the local<br \/>\n\u00a0subnet or segment, It&#8217;s not default on many Linux distributions.<br \/>\n\u00a0So if you have it or get it, read it&#8217;s documentation and it&#8217;s<br \/>\n\u00a0manual pages, if you want to use it.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>telnet<br \/>\n\u00a0telnet is the most basic of all clients to know.<br \/>\n\u00a0It&#8217;s not often you will ever use it in other ways<br \/>\n\u00a0then: telnet &lt;host-or-ip&gt; &lt;port&gt;<br \/>\n\u00a0And it&#8217;s not even so often one uses it with the port number after.<\/p>\n<p>\u00a0Telnet creates a real time connection to another computer,<br \/>\n\u00a0ofcorse the other computer needs a running telnet daemon,<br \/>\n\u00a0and you need to have a login and a password to get in.<br \/>\n\u00a0But when you get in you can remotely work on the other system<br \/>\n\u00a0just as if you sat in front of it.<\/p>\n<p>\u00a0Times when it&#8217;s good to supply a port number after the host is<br \/>\n\u00a0most commonly to check the version of some daemon\/server,<br \/>\n\u00a0as if you want to know the version of your own sendmail, you<br \/>\n\u00a0can always do: telnet 127.0.0.1 25<br \/>\n\u00a0smtp (send mail transfer protocol) runs on port 25.<br \/>\n\u00a0If you wonder what port something runs on check in \/etc\/services<\/p>\n<p>\u00a0For more info on telnet do: man telnet<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>test<br \/>\n\u00a0test is a big command, and is used to generate boolean results<br \/>\n\u00a0out of 2 arguments, to explain the whole command here would take up<br \/>\n\u00a0to much space and time, it can be used like this:<\/p>\n<p>\u00a0test -f \/sbin\/shutdown &amp;&amp; echo &#8220;It&#8217;s there&#8221; || echo &#8220;It&#8217;s not there&#8221;<\/p>\n<p>\u00a0That line says in clear english:<br \/>\n\u00a0test if file \/sbin\/shutdown is there, if outcome is true<br \/>\n\u00a0echo &#8220;It&#8217;s there&#8221; else echo &#8220;It&#8217;s not there&#8221;.<\/p>\n<p>\u00a0You can test if a file is executeble, if a string is non-zero etc.<br \/>\n\u00a0Just about anything you can think of.<\/p>\n<p>\u00a0For more info on the many things you can do with the `test`<br \/>\n\u00a0command, do: man test<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>touch<br \/>\n\u00a0touch will by default change the date on a file to the current date.<br \/>\n\u00a0It works like this: touch [arguments] &lt;file&gt;<br \/>\n\u00a0If the file doesn&#8217;t exist if will create a file that&#8217;s 0 bytes big.<\/p>\n<p>\u00a0The following arguments can be used with touch:<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -a\u00a0\u00a0\u00a0\u00a0\u00a0 change only the access time<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -c\u00a0\u00a0\u00a0\u00a0\u00a0 do not create any files<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -d, &#8211;date=STRING<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 parse STRING and use it instead of current time<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -f\u00a0\u00a0\u00a0\u00a0\u00a0 (ignored)<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -m\u00a0\u00a0\u00a0\u00a0\u00a0 change only the modification time<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -r, &#8211;reference=FILE<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 use this file&#8217;s times instead of current time<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -t\u00a0\u00a0\u00a0\u00a0 STAMP<br \/>\n\u00a0 use [[CC]YY]MMDDhhmm[.ss] instead of current time<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;time=WORD<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 access -a, atime -a, mtime -m, modify -m, use -a<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;help<br \/>\n\u00a0 display the help and exit<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;version<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 output version information and exit<\/p>\n<p>\u00a0So say that you have a file called &#8216;file&#8217; that I want to change date of<br \/>\n\u00a0to say &#8216;Aug 21 1999 04:04&#8242;,<br \/>\n\u00a0then you would do: touch -t 9908210404 file<\/p>\n<p>\u00a0For more info on this command do: man touch<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>tr<br \/>\n\u00a0translate characters, this command can change all upper case<br \/>\n\u00a0characters to lower case characters in a file or substitute<br \/>\n\u00a0all mumbers to some other characters etc.<br \/>\n\u00a0tr&#8217;s syntax is: tr [arguments] &lt;SET1&gt; &lt;SET2&gt;<br \/>\n\u00a0tr can be used with the following arguments:<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -c, &#8211;complement<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 first complement SET1<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -d, &#8211;delete<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 delete characters in SET1, do not translate<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -s, &#8211;squeeze-repeats<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 replace sequence of characters with one<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -t, &#8211;truncate-set1<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 first truncate SET1 to length of SET2<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;help<br \/>\n\u00a0 display this help and exit<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;version<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 output version information and exit<\/p>\n<p>\u00a0And the SET&#8217;s are as follows:<\/p>\n<p>\u00a0[:alnum:]<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 all letters and digits<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 [:alpha:]<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 all letters<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 [:blank:]<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 all horizontal whitespace<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 [:cntrl:]<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 all control characters<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 [:digit:]<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 all digits<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 [:graph:]<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 all printable characters, not including space<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 [:lower:]<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 all lower case letters<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 [:print:]<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 all printable characters, including space<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 [:punct:]<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 all punctuation characters<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 [:space:]<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 all horizontal or vertical whitespace<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 [:upper:]<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 all upper case letters<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 [:xdigit:]<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 all hexadecimal digits<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 [=CHAR=]<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 all characters which are equivalent to CHAR<\/p>\n<p>\u00a0Examples of tr is:<br \/>\n\u00a0cat file | tr [:upper:] [:lower:] (change all uppercase to lower)<br \/>\n\u00a0cat file | tr -d [:alnum:]\u00a0 (delete all numbers and chars)<\/p>\n<p>\u00a0For more info on tr, do: man tr<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>traceroute<br \/>\n\u00a0traceroute is a command that traces a route to an IP\/host<br \/>\n\u00a0and will give you the number of hops from your computer<br \/>\n\u00a0to the remote computer, and will display the ping times<br \/>\n\u00a0to each computer in the way.<\/p>\n<p>\u00a0traceroute has some arguments that I never needed to use<br \/>\n\u00a0but if you feel curious about this command, feel free<br \/>\n\u00a0to look at the manual pages for it: man traceroute<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>ulimit<br \/>\n\u00a0ulimit sets a limit for how much memory etc. users are allowed<br \/>\n\u00a0to use.<br \/>\n\u00a0It works like this: ulimit [arguments]<br \/>\n\u00a0And the arguments can be the following:<\/p>\n<p>\u00a0 -S\u00a0\u00a0\u00a0\u00a0 use the `soft&#8217; resource limit<br \/>\n\u00a0 -H\u00a0\u00a0\u00a0\u00a0 use the `hard&#8217; resource limit<br \/>\n\u00a0 -a\u00a0\u00a0\u00a0\u00a0 show all settings<br \/>\n\u00a0 -c\u00a0\u00a0\u00a0\u00a0 core file size (in blocks)<br \/>\n\u00a0 -d\u00a0\u00a0\u00a0\u00a0 data seg size (in kilo bytes)<br \/>\n\u00a0 -f\u00a0\u00a0\u00a0\u00a0 file size (in blocks)<br \/>\n\u00a0 -l\u00a0\u00a0\u00a0\u00a0 max locked memory (in kilo bytes)<br \/>\n\u00a0 -m\u00a0\u00a0\u00a0\u00a0 max memory size (in kilo bytes)<br \/>\n\u00a0 -n\u00a0\u00a0\u00a0\u00a0 open files (number)<br \/>\n\u00a0 -p\u00a0\u00a0\u00a0\u00a0 pipe size (512 bytes)<br \/>\n\u00a0 -s\u00a0\u00a0\u00a0\u00a0 stack size (in kilo bytes)<br \/>\n\u00a0 -t\u00a0\u00a0\u00a0\u00a0 cpu time (in seconds)<br \/>\n\u00a0 -u\u00a0\u00a0\u00a0\u00a0 max user processes (number)<br \/>\n\u00a0 -v\u00a0\u00a0\u00a0\u00a0 virtual memory (kilo bytes)<\/p>\n<p>\u00a0Say that I want to set a limit that users can only run 50<br \/>\n\u00a0processes each, the I would do: ulimit -u 50<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>umount<br \/>\n\u00a0un mount, un mounts a mountpoint, say that you have mounted your<br \/>\n\u00a0CD-rom drive on \/mnt\/cdrom then you would do: umount \/mnt\/cdrom<br \/>\n\u00a0to unmount it.<\/p>\n<p>\u00a0I never used any arguments to this command, but if you wanna learn<br \/>\n\u00a0about them, feel free to do: man umount<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>unalias<br \/>\n\u00a0unalias removes a defined alias, say that you have an alias<br \/>\n\u00a0like this: alias du=&#8217;du -h&#8217;<br \/>\n\u00a0And you want to remove it: then you simply do: unalias du<br \/>\n\u00a0To remove all aliases do: unalias -a<\/p>\n<p>\u00a0For more info do: help unalias<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>uname<br \/>\n\u00a0uname gives info on the current system, and works as<br \/>\n\u00a0this: uname [arguments]<br \/>\n\u00a0The arguments can be the following:<\/p>\n<p>\u00a0\u00a0 -a, &#8211;all\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 print all information<br \/>\n\u00a0\u00a0 -m, &#8211;machine\u00a0\u00a0\u00a0\u00a0 print the machine (hardware) type<br \/>\n\u00a0\u00a0 -n, &#8211;nodename\u00a0\u00a0\u00a0 print the machine&#8217;s network node hostname<br \/>\n\u00a0\u00a0 -r, &#8211;release\u00a0\u00a0\u00a0\u00a0 print the operating system release<br \/>\n\u00a0\u00a0 -s, &#8211;sysname\u00a0\u00a0\u00a0\u00a0 print the operating system name<br \/>\n\u00a0\u00a0 -p, &#8211;processor\u00a0\u00a0 print the host processor type<br \/>\n\u00a0\u00a0 -v\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 print the operating system version<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;help\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 display this help and exit<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;version\u00a0\u00a0\u00a0\u00a0\u00a0 output version information and exit<\/p>\n<p>\u00a0The most common way of using uname is: uname -a<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>uncompress<br \/>\n\u00a0uncompress uncompresses .Z files, for more info do: man uncompress<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>uniq<br \/>\n\u00a0uniq does by default take away duplica words out of a text,<br \/>\n\u00a0which can be good if your sorting out a dictionary.<br \/>\n\u00a0But `uniq` can also be executed with the following arguments:<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -c, &#8211;count<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 prefix lines by the number of occurrences<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -d, &#8211;repeated<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 only print duplicate lines<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -D, &#8211;all-repeated<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 print all duplicate lines<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -f, &#8211;skip-fields=N<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 avoid comparing the first N fields<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -i, &#8211;ignore-case<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ignore differences in case when comparing<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -s, &#8211;skip-chars=N<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 avoid comparing the first N characters<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -u, &#8211;unique<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 only print unique lines<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -w, &#8211;check-chars=N<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 compare no more than N characters in lines<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -N\u00a0\u00a0\u00a0\u00a0\u00a0 same as -f N<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 +N\u00a0\u00a0\u00a0\u00a0\u00a0 same as -s N<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;help<br \/>\n\u00a0 display the help and exit<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;version<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 output version information and exit<\/p>\n<p>\u00a0For more info on this command do: man uniq<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>unset<br \/>\n\u00a0this command will remove an alias or function.<br \/>\n\u00a0It has the following options:<\/p>\n<p>\u00a0-v unset a variable only.<br \/>\n\u00a0-f unset a function only.<\/p>\n<p>\u00a0By default unset will first try to unset as a variable and if that<br \/>\n\u00a0fails it will try to unset as a function.<\/p>\n<p>\u00a0Here&#8217;s an example:<\/p>\n<p>\u00a0alien:~$ foo=bar<br \/>\n\u00a0alien:~$ echo $foo<br \/>\n\u00a0bar<br \/>\n\u00a0alien:~$ unset foo<br \/>\n\u00a0alien:~$ echo $foo<\/p>\n<p>\u00a0alien:~$<\/p>\n<p>\u00a0For more info, do: help unset<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>unzip<br \/>\n\u00a0unzip is the tool or command to unzip files, it works like this:<br \/>\n\u00a0unzip [arguments] &lt;file.zip&gt;<\/p>\n<p>\u00a0unzip has some arguments I never used, do: unzip &#8211;help<br \/>\n\u00a0to get a list of valid arguments.<br \/>\n\u00a0Also feel free to do: man unzip<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>updatedb<br \/>\n\u00a0update the locate database, updatedb works like this:<br \/>\n\u00a0updatedb [arguments] &lt;pattern&gt;<br \/>\n\u00a0By default updatedb updates the locate database so it covers the<br \/>\n\u00a0whole system and all it&#8217;s files, but has the following arguments:<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -u\u00a0\u00a0\u00a0\u00a0\u00a0 Create slocate database starting at the root direc-<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 tory.\u00a0 This is the default behavior when called\u00a0 as updatedb.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -U path<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Create slocate database starting at path path.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -e dirs<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Exclude\u00a0 directories\u00a0 in\u00a0 the\u00a0 comma-separated list<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 dirs from the slocate database.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -f fstypes<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Exclude file systems in\u00a0 the\u00a0 comma-separated\u00a0 list<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 dirs from the slocate database.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -l &lt;num&gt;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Security\u00a0 level.\u00a0\u00a0 -l\u00a0 0 turns security checks off,<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 which will make searches faster.\u00a0 -l 1 turns\u00a0 security<br \/>\n\u00a0 checks on. This is the default.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -q\u00a0\u00a0\u00a0\u00a0\u00a0 Quiet mode; error messages are suppressed.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -v\u00a0\u00a0\u00a0\u00a0\u00a0 Verbose\u00a0 mode;\u00a0 display files indexed when creating database<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;help<br \/>\n\u00a0 Print a summary of the options to slocate and exit.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;version<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Print the version number of slocate and exit.<\/p>\n<p>\u00a0If you have the whole system updataded in the locate databse,<br \/>\n\u00a0to find a file all you have to do is to: locate &lt;file&gt;<\/p>\n<p>\u00a0For more info: man updatedb<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>uptime<br \/>\n\u00a0displays the current uptime (the time the system has been on).<br \/>\n\u00a0with the load average.<br \/>\n\u00a0It shows from left to right:<br \/>\n\u00a0The current time, how long the system has been running,<br \/>\n\u00a0how many users are currently logged on, and the system load<br \/>\n\u00a0averages for the past 1, 5, and 15 minutes.<\/p>\n<p>\u00a0Also do: man uptime<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>useradd<br \/>\n\u00a0useradd adds a user account to the system.<br \/>\n\u00a0useradd works like this: useradd [arguments] user<\/p>\n<p>\u00a0Here&#8217;s a cut &amp; paste from it&#8217;s manual page (as usual).<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -c comment<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 The new user&#8217;s password file comment field.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -d home_dir<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 The\u00a0 new user will be created using home_dir as the<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 value for the user&#8217;s login directory.\u00a0 The\u00a0 default<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 is to append the login name to default_home and use<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 that as the login directory name.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -e expire_date<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 The date on which the user\u00a0 account\u00a0 will\u00a0 be\u00a0 dis-<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 abled.\u00a0\u00a0 The\u00a0 date is specified in the format YYYY-<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 MM-DD.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -f inactive_days<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 The number of days after a password\u00a0 expires\u00a0 until<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 the\u00a0 account is permanently disabled.\u00a0 A value of 0<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 disables the account as soon as\u00a0 the\u00a0 password\u00a0 has<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 expired,\u00a0 and\u00a0 a\u00a0 value of -1 disables the feature.<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 The default value is -1.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -g initial_group<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 The group name or\u00a0 number\u00a0 of\u00a0 the\u00a0 user&#8217;s\u00a0 initial<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 login\u00a0 group.\u00a0\u00a0 The group name must exist.\u00a0 A group<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 number must refer to\u00a0 an\u00a0 already\u00a0 existing\u00a0 group.<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 The default group number is 1.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -G group,[&#8230;]<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 A\u00a0 list\u00a0 of\u00a0 supplementary groups which the user is<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 also a member of.\u00a0 Each group is separated from the<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 next\u00a0 by\u00a0 a\u00a0 comma, with no intervening whitespace.<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 The groups are subject to the same restrictions\u00a0 as<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 the group given with the -g option.\u00a0 The default is<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 for the user to belong only to the initial group.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -m\u00a0\u00a0\u00a0\u00a0\u00a0 The user&#8217;s home directory will\u00a0 be\u00a0 created\u00a0 if\u00a0 it<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 does\u00a0 not\u00a0 exist.\u00a0\u00a0 The\u00a0 files\u00a0 contained in skele-<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ton_dir will be copied to the home directory if the<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -k option is used, otherwise the files contained in<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/etc\/skel will be used\u00a0 instead.\u00a0\u00a0 Any\u00a0 directories<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 contained in skeleton_dir or \/etc\/skel will be cre-<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ated in the user&#8217;s home directory as well.\u00a0 The\u00a0 -k<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 option\u00a0 is\u00a0 only\u00a0 valid\u00a0 in conjunction with the -m<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 option.\u00a0 The default is to not create the directory<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 and to not copy any files.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -M\u00a0\u00a0\u00a0\u00a0\u00a0 The\u00a0 user\u00a0 home directory will not be created, even<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if the system wide settings from \/etc\/login.defs is<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 to create home dirs.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -n\u00a0\u00a0\u00a0\u00a0\u00a0 A\u00a0 group\u00a0 having\u00a0 the\u00a0 same\u00a0 name as the user being<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 added to the system will\u00a0 be\u00a0 created\u00a0 by\u00a0 default.<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 This\u00a0 option\u00a0 will turn off this Red Hat Linux spe-<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 cific behavior.<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -r\u00a0\u00a0\u00a0\u00a0\u00a0 This flag is used to create a system account.\u00a0 That<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 is, an user with an UID lower than value of UID_MIN<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 defined in \/etc\/login.defs. Note that useradd\u00a0 will<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 not\u00a0 create\u00a0 a\u00a0 home\u00a0 directory\u00a0 for\u00a0 such an user,<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 regardless\u00a0\u00a0\u00a0 of\u00a0\u00a0\u00a0 the\u00a0\u00a0\u00a0 default\u00a0\u00a0\u00a0 setting\u00a0\u00a0\u00a0 in<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/etc\/login.defs.\u00a0\u00a0 You have to specify -m option if<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 you want a home directory for a system\u00a0 account\u00a0 to<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 be created.\u00a0 This is an option added by Red Hat.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -p passwd<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 The\u00a0 encrypted\u00a0 password,\u00a0 as returned by crypt(3).<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 The default is to disable the account.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -s shell<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 The name of the user&#8217;s login shell.\u00a0 The default is<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 to\u00a0 leave this field blank, which causes the system<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 to select the default login shell.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -u uid\u00a0 The numerical value of the user&#8217;s ID.\u00a0\u00a0 This\u00a0 value<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 must\u00a0 be unique, unless the -o option is used.\u00a0 The<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 value must be non-negative.\u00a0 The default is to\u00a0 use<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 the\u00a0 smallest\u00a0 ID value greater than 99 and greater<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 than every other user.\u00a0 Values between 0 and 99 are<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 typically reserved for system accounts.<\/p>\n<p>\u00a0When the -D argument is used useradd with either give the<br \/>\n\u00a0default values or update them if there is more arguments.<br \/>\n\u00a0The other arguments can be:<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -b default_home<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 The\u00a0 initial\u00a0 path\u00a0 prefix\u00a0 for\u00a0 a\u00a0 new user&#8217;s home<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 directory.\u00a0 The user&#8217;s name will be affixed to\u00a0 the<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 end\u00a0 of\u00a0 default_home\u00a0 to\u00a0 create the new directory<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 name if the -d option is not used when\u00a0 creating\u00a0 a<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 new account.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -e default_expire_date<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 The date on which the user account is disabled.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -f default_inactive<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 The\u00a0 number\u00a0 of\u00a0 days\u00a0 after a password has expired<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 before the account will be disabled.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -g default_group<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 The group name or\u00a0 ID\u00a0 for\u00a0 a\u00a0 new\u00a0 user&#8217;s\u00a0 initial<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 group.\u00a0 The named group must exist, and a numerical<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 group ID must have an existing entry .<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -s default_shell<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 The name of the new user&#8217;s login shell.\u00a0 The\u00a0 named<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 program\u00a0 will\u00a0 be\u00a0 used\u00a0 for\u00a0 all\u00a0 future\u00a0 new user<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 accounts.<\/p>\n<p>\u00a0Also feel free to read the manual page: man useradd<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>userdel<br \/>\n\u00a0userdel removes a user from the system.<br \/>\n\u00a0userdel works like this: userdel [argument] &lt;user&gt;<br \/>\n\u00a0The only argument to this command is:<br \/>\n\u00a0-r removes the users home directory, along with the user.<\/p>\n<p>\u00a0This will delete the users login and everything from the system.<\/p>\n<p>\u00a0userdel will not remove the user if he is currently logged<br \/>\n\u00a0in to the system or have any processes running.<br \/>\n\u00a0So make sure you kill all processes owned by the user,<br \/>\n\u00a0if any, before removing his\/her account.<\/p>\n<p>\u00a0To kill the all running processes owned by the same user<br \/>\n\u00a0you can do the following command (change &lt;user&gt; to the username):<\/p>\n<p>\u00a0for pids in `ps U &lt;user&gt; | cut -c 1-6`; do kill -9 $pids ; done<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>users<br \/>\n\u00a0Display the currently logged in users.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>usleep<br \/>\n\u00a0usleep is another version of the sleep command, but instead of beeing<br \/>\n\u00a0told how many seconds to sleep, it sleeps in microseconds.<br \/>\n\u00a0So `usleep 1000000` makes it sleep for 1 second.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>w<br \/>\n\u00a0w is like a mix of who and finger, it&#8217;s used to see who&#8217;s logged<br \/>\n\u00a0on to the system and will show the following:<br \/>\n\u00a0login name, terminal, host, login time, idle time, JCPU (total cpu time<br \/>\n\u00a0that user (terminal) takes up), PCPU (cpu time of the users current<br \/>\n\u00a0process which is shown in the next field), what (process)<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>wall<br \/>\n\u00a0wall is a superuser command to send a string of text to all<br \/>\n\u00a0consoles\/terminals, wall can work either like: wall &lt;string&gt;<br \/>\n\u00a0or: wall &lt;file with string in it&gt;<br \/>\n\u00a0To wall special characters like &#8220;=)&#8221; you need to do it like<br \/>\n\u00a0this: wall &#8216;&lt;string&gt; =)&#8217;<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>wc<br \/>\n\u00a0word count, works basicly like this: wc [argument] &lt;file&gt;<br \/>\n\u00a0Where the arguments can be any of the following:<\/p>\n<p>\u00a0-c, &#8211;bytes, &#8211;chars\u00a0\u00a0 print the byte counts<br \/>\n\u00a0\u00a0 -l, &#8211;lines\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 print the newline counts<br \/>\n\u00a0\u00a0 -L, &#8211;max-line-length\u00a0 print the length of the longest line<br \/>\n\u00a0\u00a0 -w, &#8211;words\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 print the word counts<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;help\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 display this help and exit<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;version\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 output version information and exit<\/p>\n<p>\u00a0So to find out the number of words in a file called say &#8220;file1&#8221;,<br \/>\n\u00a0you would do: wc -w file1<br \/>\n\u00a0Or to find out the number of lines in the same file you would<br \/>\n\u00a0do: wc -l file1<\/p>\n<p>\u00a0This little tool can prove to be very useful, though when you<br \/>\n\u00a0use it with the -l\/&#8211;lines argument it will only count lines that<br \/>\n\u00a0contains any characters, if you wanna count all lines<br \/>\n\u00a0including empty lines, use: grep -c . file1<br \/>\n\u00a0or the same thing in another way: cat file1 | grep -c .<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>whatis<br \/>\n\u00a0whatis searches for words in the whatis database, say that you<br \/>\n\u00a0are looking for a manual page about the `shutdown` command.<br \/>\n\u00a0Then you can do: whatis shutdown<br \/>\n\u00a0for more information, do: man whatis<br \/>\n\u00a0Or: man apropos<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>whereis<br \/>\n\u00a0whereis looks for something just as the `which` command here below.<br \/>\n\u00a0but looks for matches in more places, as the manual page directory&#8217;s.<br \/>\n\u00a0It works like this: whereis [argument] &lt;what-you-wanna-find&gt;<br \/>\n\u00a0Try this command a few times, and if you want to learn<br \/>\n\u00a0more about it as it&#8217;s arguments and so do: man whereis<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>which<br \/>\n\u00a0which will tell you where a command is located, as if you<br \/>\n\u00a0do: which shutdown<br \/>\n\u00a0it will answer: \/sbin\/shutdown<br \/>\n\u00a0This command will search your path for whatever you type after it.<br \/>\n\u00a0This command is best used in scripts and functions, like this:<\/p>\n<p>\u00a0function whichrpm { rpm -qf `which $1`; }<\/p>\n<p>\u00a0The which command has some arguments, and more examples in it&#8217;s<br \/>\n\u00a0manual page, so for more info do: man which<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>who<br \/>\n\u00a0who is a little command that shows you who&#8217;s logged on,<br \/>\n\u00a0on what tty and at what time they logged on.<br \/>\n\u00a0I never ever used this command with any arguments,<br \/>\n\u00a0but if you want to learn more about this command do: who &#8211;help<br \/>\n\u00a0or: man who<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>whoami<br \/>\n\u00a0displays your user name, same as `id -un`.<br \/>\n\u00a0whoami can be used with the following arguments:<br \/>\n\u00a0&#8211;help\u00a0\u00a0\u00a0\u00a0\u00a0 display this help and exit<br \/>\n\u00a0\u00a0 &#8211;version\u00a0\u00a0 output version information and exit<\/p>\n<p>\u00a0Not much more to say about this command.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>whois<br \/>\n\u00a0whois is a tool that asks internic for information on a domain name.<br \/>\n\u00a0This is only for .com .org .net etc.<br \/>\n\u00a0If any luck it will give you the name and other info of the one that<br \/>\n\u00a0registered the domain, and it&#8217;s name servers.<\/p>\n<p>\u00a0whois can also be used to do: whois <a href=\"mailto:user@host\">user@host<\/a><\/p>\n<p>\u00a0For more info on this command do: man whois<br \/>\n\u00a0Or: man fwhois<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>yes<br \/>\n\u00a0yes is a command that repeats the same thing over and over again,<br \/>\n\u00a0it&#8217;s used as this: yes &lt;string&gt;<br \/>\n\u00a0If no string or word is supplied it will repeat the character &#8216;y&#8217;.<br \/>\n\u00a0yes can be used with the following arguments:<\/p>\n<p>\u00a0&#8211;version display the version and exit.<br \/>\n\u00a0&#8211;help\u00a0 display the help and exit.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>zip<br \/>\n\u00a0zip is a compression tool, to compress with zip do:<\/p>\n<p>\u00a0zip [arguments] &lt;file.zip&gt; &lt;file1&gt; &lt;file2&gt; etc.<\/p>\n<p>\u00a0The arguments can be the following:<\/p>\n<p>\u00a0-f\u00a0\u00a0 freshen: only changed files<br \/>\n\u00a0-u\u00a0\u00a0 update: only changed or new files<br \/>\n\u00a0\u00a0 -d\u00a0\u00a0 delete entries in zipfile<br \/>\n\u00a0-m\u00a0\u00a0 move into zipfile (delete files)<br \/>\n\u00a0\u00a0 -r\u00a0\u00a0 recurse into directories<br \/>\n\u00a0-j\u00a0\u00a0 junk (don&#8217;t record) directory names<br \/>\n\u00a0\u00a0 -0\u00a0\u00a0 store only<br \/>\n\u00a0-l\u00a0\u00a0 convert LF to CR LF (-ll CR LF to LF)<br \/>\n\u00a0\u00a0 -1\u00a0\u00a0 compress faster<br \/>\n\u00a0-9\u00a0\u00a0 compress better<br \/>\n\u00a0\u00a0 -q\u00a0\u00a0 quiet operation<br \/>\n\u00a0-v\u00a0\u00a0 verbose operation\/print version info<br \/>\n\u00a0\u00a0 -c\u00a0\u00a0 add one-line comments<br \/>\n\u00a0-z\u00a0\u00a0 add zipfile comment<br \/>\n\u00a0\u00a0 -@\u00a0\u00a0 read names from stdin<br \/>\n\u00a0-o\u00a0\u00a0 make zipfile as old as latest entry<br \/>\n\u00a0\u00a0 -x\u00a0\u00a0 exclude the following names<br \/>\n\u00a0-i\u00a0\u00a0 include only the following names<br \/>\n\u00a0\u00a0 -F\u00a0\u00a0 fix zipfile (-FF try harder)<br \/>\n\u00a0-D\u00a0\u00a0 do not add directory entries<br \/>\n\u00a0\u00a0 -A\u00a0\u00a0 adjust self-extracting exe<br \/>\n\u00a0-J\u00a0\u00a0 junk zipfile prefix (unzipsfx)<br \/>\n\u00a0\u00a0 -T\u00a0\u00a0 test zipfile integrity<br \/>\n\u00a0-X\u00a0\u00a0 eXclude eXtra file attributes<br \/>\n\u00a0\u00a0 -y\u00a0\u00a0 store symbolic links as the link instead of the referenced file<br \/>\n\u00a0\u00a0 -R\u00a0\u00a0 PKZIP recursion (see manual)<br \/>\n\u00a0\u00a0 -h\u00a0\u00a0 show the help<br \/>\n\u00a0-n\u00a0\u00a0 don&#8217;t compress these suffixes<\/p>\n<p>\u00a0To uncompress a zip file, use the `unzip` command.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>And that is most of the commands you&#8217;ll ever encounter while scripting or<br \/>\nusing a *nix system.<br \/>\nThere are LOADS of other commands, but not many that are as used as these<br \/>\nI just explained.<\/p>\n<p>There are more really useful commands that I never seen as default<br \/>\non any system aswell, like pgp and gpg, I havent included those since<br \/>\nthere full documentation comes with the same package as that<br \/>\ncommand\/application if you download it.<\/p>\n<p>So, as I said these are the most useful commands, but if someone out there<br \/>\nthink I missed some really useful command send me a mail and I&#8217;ll add it.<\/p>\n<p>===============================================================================<br \/>\n10 &#8211; Other Frequently asked questions with answers.<br \/>\n===============================================================================<\/p>\n<p>Q: How can I play an .au file ?<br \/>\nA: The file suffix .au means it&#8217;s an audio file, so you can either do<br \/>\n\u00a0\u00a0 the same as for mp3&#8217;s: mpg123 file.au<br \/>\n\u00a0\u00a0 or you can (since .au files are raw audio): cat file.au &gt; \/dev\/dsp<br \/>\n\u00a0\u00a0 or: cat file.au &gt; \/dev\/audio<\/p>\n<p>Q: What exactly is bash ?<br \/>\nA: If you have read this tutorial you would know &#8230; it&#8217;s a shell type.<\/p>\n<p>Q: I wanna make some sub-directory&#8217;s to \/usr\/local\/ but I&#8217;m to lazy to write<br \/>\n\u00a0\u00a0 almost the same line over and over again, is there any easier way ?<br \/>\nA: Yes there is: mkdir \/usr\/local\/{dir1,dir2,dir3}<\/p>\n<p>Q: I have a dir with files like this: file.1 file.2 file.3 etc.<br \/>\n\u00a0\u00a0 is there any way I can list say, file.3, file.4, file.6, file.9 only<br \/>\n\u00a0\u00a0 without using grep ?<br \/>\nA: Yes there is: ls file*[3469]*<\/p>\n<p>Q: I want to remove some files with wildcards included in the command<br \/>\n\u00a0\u00a0 (rm -rf .??*), is there any way I can see what the command will remove<br \/>\n\u00a0\u00a0 before I actually do the command ?<br \/>\nA: Yes there is: echo rm -rf .??*<\/p>\n<p>Q: How can I remove file names that are\/have special characters like a file<br \/>\n\u00a0\u00a0 named:\u00a0 -!?* !!?<br \/>\nA: Do this: rm .\/-\\!\\?\\*\\ \\!\\!\\?<br \/>\n\u00a0\u00a0 The .\/ makes sure it will look in the current directory, and the \\<br \/>\n\u00a0\u00a0 (back slashes) will make sure that the special characters special meaning<br \/>\n\u00a0\u00a0 is over looked, so they are treated just like any other character.<\/p>\n<p>Q: I accidently deleted something on my system, is there any way<br \/>\n\u00a0\u00a0 of getting it back ?<br \/>\nA: Yes there is, read this file \/usr\/doc\/HOWTO\/mini\/Ext2fs-Undeletion<br \/>\n\u00a0\u00a0 (or \/usr\/doc\/HOWTO\/mini\/Ext2fs-Undeletion.gz)<br \/>\n\u00a0\u00a0 This is also good knowledge if someone *hacks* your system<br \/>\n\u00a0\u00a0 and think they are safe just because they deleted the logs.<br \/>\n\u00a0\u00a0 Or you can download a program called &#8216;recover&#8217; from <a href=\"http:\/\/www.freshmeat.net\">www.freshmeat.net<\/a><\/p>\n<p>Q: How do I compile my kernel ?<br \/>\nA: Read this file:\u00a0 \/usr\/doc\/HOWTO\/Kernel-HOWTO<\/p>\n<p>Q: Can I make a variable read-only so noone can change it ?<br \/>\nA: Yes you can: readonly variable_name<br \/>\n\u00a0\u00a0 As say that I have a variable: $myvar<br \/>\n\u00a0\u00a0 Then I would do: readonly myvar<br \/>\n\u00a0\u00a0 And to display all the read-only variables just do: readonly<\/p>\n<p>Q: How can I display all the set variables ?<br \/>\nA: With the command: set<br \/>\n\u00a0\u00a0 To get the eviorment use this command: env<br \/>\n\u00a0\u00a0 And to display the system variables, type a $ and press TAB.<\/p>\n<p>Q: Something is wrong with a script, but I dont know what, how can I find out ?<br \/>\nA: by doing this: \/bin\/sh -x &lt;scriptname&gt;<br \/>\n\u00a0\u00a0 + means that the command was successful.<br \/>\n\u00a0\u00a0 &#8211; means that the command was unsuccessful.<\/p>\n<p>Q: I&#8217;m using hexedit and simlar commands alot, but I&#8217;m getting to lazy to<br \/>\n\u00a0\u00a0 find out where all the binarys live, isn&#8217;t there any faster way of<br \/>\n\u00a0\u00a0 opening a binary or script that&#8217;s in my $PATH then to locate, find or<br \/>\n\u00a0\u00a0 something like that and then go from there ?<br \/>\nA: Well, I dont know how much faster it is, but you can always<br \/>\n\u00a0\u00a0 do this: hexedit `which &lt;file&gt;`<\/p>\n<p>Q: How can I list only the directorys in a directory without the files ?<br \/>\nA: Well, some distros has an alias &#8220;lsd&#8221;, and it does: ls -d *\/<\/p>\n<p>Q: How can I transfer a file if the computer doesn&#8217;t have any FTP ?<br \/>\nA: If you wanna actually copy a file to a place that dont have ftp<br \/>\n\u00a0\u00a0 or for some other reason you can&#8217;t use ftp, there is 2 commands that can<br \/>\n\u00a0\u00a0 do this: scp (secure copy &#8211; requiers ssh)<br \/>\n\u00a0\u00a0 And: rcp (remote copy &#8211; requiers rlogin)<br \/>\n\u00a0\u00a0 They work like this:<br \/>\n\u00a0\u00a0 scp local.file <a href=\"mailto:user@host.domain.com:\/remote\/directory\/\">user@host.domain.com:\/remote\/directory\/<\/a><br \/>\n\u00a0\u00a0 rcp local.file <a href=\"mailto:user@host.domain.com:\/remote\/directory\/\">user@host.domain.com:\/remote\/directory\/<\/a><\/p>\n<p>Q: Is there any way I can view my processes so I can see the free stack,<br \/>\n\u00a0\u00a0 father processes siblings and children etc. ?<br \/>\nA: Yes there is, press: Ctrl + Scroll-Lock<\/p>\n<p>Q: Is there any way I can view the memory buffers etc. ?<br \/>\nA: Yes there is, press: Shift + Scroll-Lock<\/p>\n<p>Q: Is there any way to get some info from the stack ?<br \/>\nA: Yes there is press: AltGr + Scroll-Lock<\/p>\n<p>Q: My volume is really low when I play stuff, how can I change it ?<br \/>\nA: Use the program `aumix` it should be on most systems by default,<br \/>\n\u00a0\u00a0 and it&#8217;s pretty self explanatory.<\/p>\n<p>Q: I think it&#8217;s a pain pressing upp arrow until I reach the command I want<br \/>\n\u00a0\u00a0 to use, that is to long to type again, is there any faster way ?<br \/>\nA: Yes, press Ctrl+R and type something that matches a previously used<br \/>\n\u00a0\u00a0 command, and just press enter to execute it or Ctrl+C to cancel.<\/p>\n<p>Q: Is there any console based mpeg movie players ?<br \/>\nA: Not that I know of, but if there is, I&#8217;d like to know myself.<\/p>\n<p>Q: How can I take a screenshot without having to install Gimp or something<br \/>\n\u00a0\u00a0 like that ?<br \/>\nA: Well, the easyest way of taking a screen shot in X is to do the<br \/>\n\u00a0\u00a0 following command: import -window root foo.jpg<br \/>\n\u00a0\u00a0 That will dump a screen shot as foo.jpg, in your current directory.<\/p>\n<p>Q: How can I import variables from one script to another, like a config file ?<br \/>\nA: You can read all variables from a file by doing &#8220;. &lt;file name&gt;&#8221;, say<br \/>\n\u00a0\u00a0 that you have a file called myvars and you want to you those variables<br \/>\n\u00a0\u00a0 in a script, then you add the line:\u00a0 . myvars<br \/>\n\u00a0\u00a0 in the beginning of the script, after the #!\/bin\/bash line.<br \/>\n\u00a0\u00a0 The . is actually a command, that reads and executes commands in a file,<br \/>\n\u00a0\u00a0 which here works to imported the variables since they are executed<br \/>\n\u00a0\u00a0 from within the script.<\/p>\n<p>Q: I&#8217;m using `port sentry` as a firewall controll software, now my routing<br \/>\n\u00a0\u00a0 table is over full, how can I take away all that&#8217;s routed to &#8216;localhost&#8217;<br \/>\n\u00a0\u00a0 in one command or string ?<br \/>\nA: Well like this: for ips in `route | grep local | cut -c 1-14`; do route del -host $ips gw 127.0.0.1 2&gt;\/dev\/null ; done<br \/>\n\u00a0\u00a0 That should do the trick.<\/p>\n<p>Q: If I&#8217;m in a directory full or rpm files and I wanna find out which rpm that<br \/>\n\u00a0\u00a0 contain say the file vga.h, how would I do that ?<br \/>\nA: Well you can do this:<br \/>\n\u00a0\u00a0 for foo in `ls -1 *.rpm`; do rpm -qlp $foo | grep vga.h 1&gt;\/dev\/null 2&gt;&amp;1 &amp;&amp; echo $foo; done<\/p>\n<p>Q: Is there any place I can find out where all the ^ (Ctrl) characters mean ?<br \/>\nA: Yes, look in the ascii table below, it works like this:<br \/>\n\u00a0\u00a0 M is the 13&#8217;th character in the alphabet, and in the ascii table<br \/>\n\u00a0\u00a0 013 (dec) has the value CR which means Carriage Return.<br \/>\n\u00a0\u00a0 this means that ^M (Ctrl+M) is the same as pressing the return button.<br \/>\n\u00a0\u00a0 And ^A which is 001 (dec) is Start of Header, in other words take the<br \/>\n\u00a0\u00a0 cursor to the beginning of the current line.<\/p>\n<p>Q: How do I write stuff in hex code ?<br \/>\nA: Well, like this:<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ASCII codes<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>\u00a0\u00a0\u00a0 ASCII Table (7-bit)<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Decimal\u00a0\u00a0 Octal\u00a0\u00a0 Hex\u00a0\u00a0\u00a0 Binary\u00a0\u00a0\u00a0\u00a0 Value<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8212;&#8212;-\u00a0\u00a0 &#8212;&#8211;\u00a0\u00a0 &#8212;\u00a0\u00a0\u00a0 &#8212;&#8212;\u00a0\u00a0\u00a0\u00a0 &#8212;&#8211;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 000\u00a0\u00a0\u00a0\u00a0\u00a0 000\u00a0\u00a0\u00a0 000\u00a0\u00a0 00000000\u00a0\u00a0\u00a0\u00a0\u00a0 NUL\u00a0\u00a0\u00a0 (Null char.)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 001\u00a0\u00a0\u00a0\u00a0\u00a0 001\u00a0\u00a0\u00a0 001\u00a0\u00a0 00000001\u00a0\u00a0\u00a0\u00a0\u00a0 SOH\u00a0\u00a0\u00a0 (Start of Header)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 002\u00a0\u00a0\u00a0\u00a0\u00a0 002\u00a0\u00a0\u00a0 002\u00a0\u00a0 00000010\u00a0\u00a0\u00a0\u00a0\u00a0 STX\u00a0\u00a0\u00a0 (Start of Text)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 003\u00a0\u00a0\u00a0\u00a0\u00a0 003\u00a0\u00a0\u00a0 003\u00a0\u00a0 00000011\u00a0\u00a0\u00a0\u00a0\u00a0 ETX\u00a0\u00a0\u00a0 (End of Text)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 004\u00a0\u00a0\u00a0\u00a0\u00a0 004\u00a0\u00a0\u00a0 004\u00a0\u00a0 00000100\u00a0\u00a0\u00a0\u00a0\u00a0 EOT\u00a0\u00a0\u00a0 (End of Transmission)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 005\u00a0\u00a0\u00a0\u00a0\u00a0 005\u00a0\u00a0\u00a0 005\u00a0\u00a0 00000101\u00a0\u00a0\u00a0\u00a0\u00a0 ENQ\u00a0\u00a0\u00a0 (Enquiry)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 006\u00a0\u00a0\u00a0\u00a0\u00a0 006\u00a0\u00a0\u00a0 006\u00a0\u00a0 00000110\u00a0\u00a0\u00a0\u00a0\u00a0 ACK\u00a0\u00a0\u00a0 (Acknowledgment)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 007\u00a0\u00a0\u00a0\u00a0\u00a0 007\u00a0\u00a0\u00a0 007\u00a0\u00a0 00000111\u00a0\u00a0\u00a0\u00a0\u00a0 BEL\u00a0\u00a0\u00a0 (Bell)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 008\u00a0\u00a0\u00a0\u00a0\u00a0 010\u00a0\u00a0\u00a0 008\u00a0\u00a0 00001000\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 BS\u00a0\u00a0\u00a0 (Backspace)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 009\u00a0\u00a0\u00a0\u00a0\u00a0 011\u00a0\u00a0\u00a0 009\u00a0\u00a0 00001001\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 HT\u00a0\u00a0\u00a0 (Horizontal Tab)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 010\u00a0\u00a0\u00a0\u00a0\u00a0 012\u00a0\u00a0\u00a0 00A\u00a0\u00a0 00001010\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 LF\u00a0\u00a0\u00a0 (Line Feed)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 011\u00a0\u00a0\u00a0\u00a0\u00a0 013\u00a0\u00a0\u00a0 00B\u00a0\u00a0 00001011\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 VT\u00a0\u00a0\u00a0 (Vertical Tab)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 012\u00a0\u00a0\u00a0\u00a0\u00a0 014\u00a0\u00a0\u00a0 00C\u00a0\u00a0 00001100\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 FF\u00a0\u00a0\u00a0 (Form Feed)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 013\u00a0\u00a0\u00a0\u00a0\u00a0 015\u00a0\u00a0\u00a0 00D\u00a0\u00a0 00001101\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 CR\u00a0\u00a0\u00a0 (Carriage Return)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 014\u00a0\u00a0\u00a0\u00a0\u00a0 016\u00a0\u00a0\u00a0 00E\u00a0\u00a0 00001110\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SO\u00a0\u00a0\u00a0 (Serial In)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 015\u00a0\u00a0\u00a0\u00a0\u00a0 017\u00a0\u00a0\u00a0 00F\u00a0\u00a0 00001111\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SI\u00a0\u00a0\u00a0 (Serial Out)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 016\u00a0\u00a0\u00a0\u00a0\u00a0 020\u00a0\u00a0\u00a0 010\u00a0\u00a0 00010000\u00a0\u00a0\u00a0\u00a0\u00a0 DLE\u00a0\u00a0\u00a0 (Data Link Escape)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 017\u00a0\u00a0\u00a0\u00a0\u00a0 021\u00a0\u00a0\u00a0 011\u00a0\u00a0 00010001\u00a0\u00a0\u00a0\u00a0\u00a0 DC1 (XON) (Device Control 1)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 018\u00a0\u00a0\u00a0\u00a0\u00a0 022\u00a0\u00a0\u00a0 012\u00a0\u00a0 00010010\u00a0\u00a0\u00a0\u00a0\u00a0 DC2\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (Device Control 2)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 019\u00a0\u00a0\u00a0\u00a0\u00a0 023\u00a0\u00a0\u00a0 013\u00a0\u00a0 00010011\u00a0\u00a0\u00a0\u00a0\u00a0 DC3 (XOFF)(Device Control 3)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 020\u00a0\u00a0\u00a0\u00a0\u00a0 024\u00a0\u00a0\u00a0 014\u00a0\u00a0 00010100\u00a0\u00a0\u00a0\u00a0\u00a0 DC4\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (Device Control 4)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 021\u00a0\u00a0\u00a0\u00a0\u00a0 025\u00a0\u00a0\u00a0 015\u00a0\u00a0 00010101\u00a0\u00a0\u00a0\u00a0\u00a0 NAK\u00a0\u00a0\u00a0 (Negative Acknowledgement)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 022\u00a0\u00a0\u00a0\u00a0\u00a0 026\u00a0\u00a0\u00a0 016\u00a0\u00a0 00010110\u00a0\u00a0\u00a0\u00a0\u00a0 SYN\u00a0\u00a0\u00a0 (Synchronous Idle)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 023\u00a0\u00a0\u00a0\u00a0\u00a0 027\u00a0\u00a0\u00a0 017\u00a0\u00a0 00010111\u00a0\u00a0\u00a0\u00a0\u00a0 ETB\u00a0\u00a0\u00a0 (End of Trans. Block)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 024\u00a0\u00a0\u00a0\u00a0\u00a0 030\u00a0\u00a0\u00a0 018\u00a0\u00a0 00011000\u00a0\u00a0\u00a0\u00a0\u00a0 CAN\u00a0\u00a0\u00a0 (Cancel)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 025\u00a0\u00a0\u00a0\u00a0\u00a0 031\u00a0\u00a0\u00a0 019\u00a0\u00a0 00011001\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 EM<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 026\u00a0\u00a0\u00a0\u00a0\u00a0 032\u00a0\u00a0\u00a0 01A\u00a0\u00a0 00011010\u00a0\u00a0\u00a0\u00a0\u00a0 SUB<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 027\u00a0\u00a0\u00a0\u00a0\u00a0 033\u00a0\u00a0\u00a0 01B\u00a0\u00a0 00011011\u00a0\u00a0\u00a0\u00a0\u00a0 ESC\u00a0\u00a0\u00a0 (Escape)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 028\u00a0\u00a0\u00a0\u00a0\u00a0 034\u00a0\u00a0\u00a0 01C\u00a0\u00a0 00011100\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 FS\u00a0\u00a0\u00a0 (File Separator)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 029\u00a0\u00a0\u00a0\u00a0\u00a0 035\u00a0\u00a0\u00a0 01D\u00a0\u00a0 00011101\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 GS<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 030\u00a0\u00a0\u00a0\u00a0\u00a0 036\u00a0\u00a0\u00a0 01E\u00a0\u00a0 00011110\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 RS\u00a0\u00a0\u00a0 (Request to Send)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 031\u00a0\u00a0\u00a0\u00a0\u00a0 037\u00a0\u00a0\u00a0 01F\u00a0\u00a0 00011111\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 US<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 032\u00a0\u00a0\u00a0\u00a0\u00a0 040\u00a0\u00a0\u00a0 020\u00a0\u00a0 00100000\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SP\u00a0\u00a0\u00a0 (Space)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 033\u00a0\u00a0\u00a0\u00a0\u00a0 041\u00a0\u00a0\u00a0 021\u00a0\u00a0 00100001\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 !<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 034\u00a0\u00a0\u00a0\u00a0\u00a0 042\u00a0\u00a0\u00a0 022\u00a0\u00a0 00100010\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8221;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 035\u00a0\u00a0\u00a0\u00a0\u00a0 043\u00a0\u00a0\u00a0 023\u00a0\u00a0 00100011\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 #<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 036\u00a0\u00a0\u00a0\u00a0\u00a0 044\u00a0\u00a0\u00a0 024\u00a0\u00a0 00100100\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 037\u00a0\u00a0\u00a0\u00a0\u00a0 045\u00a0\u00a0\u00a0 025\u00a0\u00a0 00100101\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 %<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 038\u00a0\u00a0\u00a0\u00a0\u00a0 046\u00a0\u00a0\u00a0 026\u00a0\u00a0 00100110\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &amp;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 039\u00a0\u00a0\u00a0\u00a0\u00a0 047\u00a0\u00a0\u00a0 027\u00a0\u00a0 00100111\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8216;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 040\u00a0\u00a0\u00a0\u00a0\u00a0 050\u00a0\u00a0\u00a0 028\u00a0\u00a0 00101000\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 041\u00a0\u00a0\u00a0\u00a0\u00a0 051\u00a0\u00a0\u00a0 029\u00a0\u00a0 00101001\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 )<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 042\u00a0\u00a0\u00a0\u00a0\u00a0 052\u00a0\u00a0\u00a0 02A\u00a0\u00a0 00101010\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 *<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 043\u00a0\u00a0\u00a0\u00a0\u00a0 053\u00a0\u00a0\u00a0 02B\u00a0\u00a0 00101011\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 +<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 044\u00a0\u00a0\u00a0\u00a0\u00a0 054\u00a0\u00a0\u00a0 02C\u00a0\u00a0 00101100\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ,<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 045\u00a0\u00a0\u00a0\u00a0\u00a0 055\u00a0\u00a0\u00a0 02D\u00a0\u00a0 00101101\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 046\u00a0\u00a0\u00a0\u00a0\u00a0 056\u00a0\u00a0\u00a0 02E\u00a0\u00a0 00101110\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 .<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 047\u00a0\u00a0\u00a0\u00a0\u00a0 057\u00a0\u00a0\u00a0 02F\u00a0\u00a0 00101111\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 048\u00a0\u00a0\u00a0\u00a0\u00a0 060\u00a0\u00a0\u00a0 030\u00a0\u00a0 00110000\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 049\u00a0\u00a0\u00a0\u00a0\u00a0 061\u00a0\u00a0\u00a0 031\u00a0\u00a0 00110001\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 050\u00a0\u00a0\u00a0\u00a0\u00a0 062\u00a0\u00a0\u00a0 032\u00a0\u00a0 00110010\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 2<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 051\u00a0\u00a0\u00a0\u00a0\u00a0 063\u00a0\u00a0\u00a0 033\u00a0\u00a0 00110011\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 3<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 052\u00a0\u00a0\u00a0\u00a0\u00a0 064\u00a0\u00a0\u00a0 034\u00a0\u00a0 00110100\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 4<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 053\u00a0\u00a0\u00a0\u00a0\u00a0 065\u00a0\u00a0\u00a0 035\u00a0\u00a0 00110101\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 5<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 054\u00a0\u00a0\u00a0\u00a0\u00a0 066\u00a0\u00a0\u00a0 036\u00a0\u00a0 00110110\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 6<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 055\u00a0\u00a0\u00a0\u00a0\u00a0 067\u00a0\u00a0\u00a0 037\u00a0\u00a0 00110111\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 7<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 056\u00a0\u00a0\u00a0\u00a0\u00a0 070\u00a0\u00a0\u00a0 038\u00a0\u00a0 00111000\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 8<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 057\u00a0\u00a0\u00a0\u00a0\u00a0 071\u00a0\u00a0\u00a0 039\u00a0\u00a0 00111001\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 9<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 058\u00a0\u00a0\u00a0\u00a0\u00a0 072\u00a0\u00a0\u00a0 03A\u00a0\u00a0 00111010\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 :<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 059\u00a0\u00a0\u00a0\u00a0\u00a0 073\u00a0\u00a0\u00a0 03B\u00a0\u00a0 00111011\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 060\u00a0\u00a0\u00a0\u00a0\u00a0 074\u00a0\u00a0\u00a0 03C\u00a0\u00a0 00111100\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 061\u00a0\u00a0\u00a0\u00a0\u00a0 075\u00a0\u00a0\u00a0 03D\u00a0\u00a0 00111101\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 =<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 062\u00a0\u00a0\u00a0\u00a0\u00a0 076\u00a0\u00a0\u00a0 03E\u00a0\u00a0 00111110\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &gt;<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 063\u00a0\u00a0\u00a0\u00a0\u00a0 077\u00a0\u00a0\u00a0 03F\u00a0\u00a0 00111111\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ?<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 064\u00a0\u00a0\u00a0\u00a0\u00a0 100\u00a0\u00a0\u00a0 040\u00a0\u00a0 01000000\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 @<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 065\u00a0\u00a0\u00a0\u00a0\u00a0 101\u00a0\u00a0\u00a0 041\u00a0\u00a0 01000001\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 A<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 066\u00a0\u00a0\u00a0\u00a0\u00a0 102\u00a0\u00a0\u00a0 042\u00a0\u00a0 01000010\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 B<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 067\u00a0\u00a0\u00a0\u00a0\u00a0 103\u00a0\u00a0\u00a0 043\u00a0\u00a0 01000011\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 C<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 068\u00a0\u00a0\u00a0\u00a0\u00a0 104\u00a0\u00a0\u00a0 044\u00a0\u00a0 01000100\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 D<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 069\u00a0\u00a0\u00a0\u00a0\u00a0 105\u00a0\u00a0\u00a0 045\u00a0\u00a0 01000101\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 E<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 070\u00a0\u00a0\u00a0\u00a0\u00a0 106\u00a0\u00a0\u00a0 046\u00a0\u00a0 01000110\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 F<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 071\u00a0\u00a0\u00a0\u00a0\u00a0 107\u00a0\u00a0\u00a0 047\u00a0\u00a0 01000111\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 G<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 072\u00a0\u00a0\u00a0\u00a0\u00a0 110\u00a0\u00a0\u00a0 048\u00a0\u00a0 01001000\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 H<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 073\u00a0\u00a0\u00a0\u00a0\u00a0 111\u00a0\u00a0\u00a0 049\u00a0\u00a0 01001001\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 I<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 074\u00a0\u00a0\u00a0\u00a0\u00a0 112\u00a0\u00a0\u00a0 04A\u00a0\u00a0 01001010\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 J<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 075\u00a0\u00a0\u00a0\u00a0\u00a0 113\u00a0\u00a0\u00a0 04B\u00a0\u00a0 01001011\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 K<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 076\u00a0\u00a0\u00a0\u00a0\u00a0 114\u00a0\u00a0\u00a0 04C\u00a0\u00a0 01001100\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 L<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 077\u00a0\u00a0\u00a0\u00a0\u00a0 115\u00a0\u00a0\u00a0 04D\u00a0\u00a0 01001101\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 M<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 078\u00a0\u00a0\u00a0\u00a0\u00a0 116\u00a0\u00a0\u00a0 04E\u00a0\u00a0 01001110\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 N<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 079\u00a0\u00a0\u00a0\u00a0\u00a0 117\u00a0\u00a0\u00a0 04F\u00a0\u00a0 01001111\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 O<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 080\u00a0\u00a0\u00a0\u00a0\u00a0 120\u00a0\u00a0\u00a0 050\u00a0\u00a0 01010000\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 P<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 081\u00a0\u00a0\u00a0\u00a0\u00a0 121\u00a0\u00a0\u00a0 051\u00a0\u00a0 01010001\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Q<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 082\u00a0\u00a0\u00a0\u00a0\u00a0 122\u00a0\u00a0\u00a0 052\u00a0\u00a0 01010010\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 R<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 083\u00a0\u00a0\u00a0\u00a0\u00a0 123\u00a0\u00a0\u00a0 053\u00a0\u00a0 01010011\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 S<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 084\u00a0\u00a0\u00a0\u00a0\u00a0 124\u00a0\u00a0\u00a0 054\u00a0\u00a0 01010100\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 T<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 085\u00a0\u00a0\u00a0\u00a0\u00a0 125\u00a0\u00a0\u00a0 055\u00a0\u00a0 01010101\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 U<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 086\u00a0\u00a0\u00a0\u00a0\u00a0 126\u00a0\u00a0\u00a0 056\u00a0\u00a0 01010110\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 V<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 087\u00a0\u00a0\u00a0\u00a0\u00a0 127\u00a0\u00a0\u00a0 057\u00a0\u00a0 01011111\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 W<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 088\u00a0\u00a0\u00a0\u00a0\u00a0 130\u00a0\u00a0\u00a0 058\u00a0\u00a0 01011000\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 X<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 089\u00a0\u00a0\u00a0\u00a0\u00a0 131\u00a0\u00a0\u00a0 059\u00a0\u00a0 01011001\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Y<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 090\u00a0\u00a0\u00a0\u00a0\u00a0 132\u00a0\u00a0\u00a0 05A\u00a0\u00a0 01011010\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Z<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 091\u00a0\u00a0\u00a0\u00a0\u00a0 133\u00a0\u00a0\u00a0 05B\u00a0\u00a0 01011011\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 [<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 092\u00a0\u00a0\u00a0\u00a0\u00a0 134\u00a0\u00a0\u00a0 05C\u00a0\u00a0 01011100\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \\<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 093\u00a0\u00a0\u00a0\u00a0\u00a0 135\u00a0\u00a0\u00a0 05D\u00a0\u00a0 01011101\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ]<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 094\u00a0\u00a0\u00a0\u00a0\u00a0 136\u00a0\u00a0\u00a0 05E\u00a0\u00a0 01011110\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ^<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 095\u00a0\u00a0\u00a0\u00a0\u00a0 137\u00a0\u00a0\u00a0 05F\u00a0\u00a0 01011111\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 _<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 096\u00a0\u00a0\u00a0\u00a0\u00a0 140\u00a0\u00a0\u00a0 060\u00a0\u00a0 01100000\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 `<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 097\u00a0\u00a0\u00a0\u00a0\u00a0 141\u00a0\u00a0\u00a0 061\u00a0\u00a0 01100001\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 a<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 098\u00a0\u00a0\u00a0\u00a0\u00a0 142\u00a0\u00a0\u00a0 062\u00a0\u00a0 01100010\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 b<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 099\u00a0\u00a0\u00a0\u00a0\u00a0 143\u00a0\u00a0\u00a0 063\u00a0\u00a0 01100011\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 c<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 100\u00a0\u00a0\u00a0\u00a0\u00a0 144\u00a0\u00a0\u00a0 064\u00a0\u00a0 01100100\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 d<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 101\u00a0\u00a0\u00a0\u00a0\u00a0 145\u00a0\u00a0\u00a0 065\u00a0\u00a0 01100101\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 e<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 102\u00a0\u00a0\u00a0\u00a0\u00a0 146\u00a0\u00a0\u00a0 066\u00a0\u00a0 01100110\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 f<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 103\u00a0\u00a0\u00a0\u00a0\u00a0 147\u00a0\u00a0\u00a0 067\u00a0\u00a0 01100111\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 g<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 104\u00a0\u00a0\u00a0\u00a0\u00a0 150\u00a0\u00a0\u00a0 068\u00a0\u00a0 01101000\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 h<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 105\u00a0\u00a0\u00a0\u00a0\u00a0 151\u00a0\u00a0\u00a0 069\u00a0\u00a0 01101001\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 i<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 106\u00a0\u00a0\u00a0\u00a0\u00a0 152\u00a0\u00a0\u00a0 06A\u00a0\u00a0 01101010\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 j<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 107\u00a0\u00a0\u00a0\u00a0\u00a0 153\u00a0\u00a0\u00a0 06B\u00a0\u00a0 01101011\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 k<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 108\u00a0\u00a0\u00a0\u00a0\u00a0 154\u00a0\u00a0\u00a0 06C\u00a0\u00a0 01101100\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 l<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 109\u00a0\u00a0\u00a0\u00a0\u00a0 155\u00a0\u00a0\u00a0 06D\u00a0\u00a0 01101101\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 m<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 110\u00a0\u00a0\u00a0\u00a0\u00a0 156\u00a0\u00a0\u00a0 06E\u00a0\u00a0 01101110\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 n<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 111\u00a0\u00a0\u00a0\u00a0\u00a0 157\u00a0\u00a0\u00a0 06F\u00a0\u00a0 01101111\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 o<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 112\u00a0\u00a0\u00a0\u00a0\u00a0 160\u00a0\u00a0\u00a0 070\u00a0\u00a0 01110000\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 p<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 113\u00a0\u00a0\u00a0\u00a0\u00a0 161\u00a0\u00a0\u00a0 071\u00a0\u00a0 01110001\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 q<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 114\u00a0\u00a0\u00a0\u00a0\u00a0 162\u00a0\u00a0\u00a0 072\u00a0\u00a0 01110010\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 r<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 115\u00a0\u00a0\u00a0\u00a0\u00a0 163\u00a0\u00a0\u00a0 073\u00a0\u00a0 01110011\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 s<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 116\u00a0\u00a0\u00a0\u00a0\u00a0 164\u00a0\u00a0\u00a0 074\u00a0\u00a0 01110100\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 t<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 117\u00a0\u00a0\u00a0\u00a0\u00a0 165\u00a0\u00a0\u00a0 075\u00a0\u00a0 01110101\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 u<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 118\u00a0\u00a0\u00a0\u00a0\u00a0 166\u00a0\u00a0\u00a0 076\u00a0\u00a0 01110110\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 v<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 119\u00a0\u00a0\u00a0\u00a0\u00a0 167\u00a0\u00a0\u00a0 077\u00a0\u00a0 01110111\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 w<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 120\u00a0\u00a0\u00a0\u00a0\u00a0 170\u00a0\u00a0\u00a0 078\u00a0\u00a0 01111000\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 x<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 121\u00a0\u00a0\u00a0\u00a0\u00a0 171\u00a0\u00a0\u00a0 079\u00a0\u00a0 01111001\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 y<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 122\u00a0\u00a0\u00a0\u00a0\u00a0 172\u00a0\u00a0\u00a0 07A\u00a0\u00a0 01111010\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 z<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 123\u00a0\u00a0\u00a0\u00a0\u00a0 173\u00a0\u00a0\u00a0 07B\u00a0\u00a0 01111011\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 {<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 124\u00a0\u00a0\u00a0\u00a0\u00a0 174\u00a0\u00a0\u00a0 07C\u00a0\u00a0 01111100\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 125\u00a0\u00a0\u00a0\u00a0\u00a0 175\u00a0\u00a0\u00a0 07D\u00a0\u00a0 01111101\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 126\u00a0\u00a0\u00a0\u00a0\u00a0 176\u00a0\u00a0\u00a0 07E\u00a0\u00a0 01111110\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ~<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 127\u00a0\u00a0\u00a0\u00a0\u00a0 177\u00a0\u00a0\u00a0 07F\u00a0\u00a0 01111111\u00a0\u00a0\u00a0\u00a0\u00a0 DEL<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Say that you want to echo &#8220;Hi&#8221; with hex code, you do this:<\/p>\n<p>echo -e &#8220;\\x048\\x069&#8221;<\/p>\n<p>The \\x part is to let `echo -e` know that it&#8217;s hexa decimal code.<br \/>\nYou can even hide commands like that.<\/p>\n<p>Here is a script example of hiding the `top` command in hex and execute it:<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>#!\/bin\/bash<\/p>\n<p>hexcode=&#8217;\\x074\\x06F\\x070&#8217;<\/p>\n<p>`echo -e $hexcode`<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>This will execute what echo echos, due to the &#8220;`&#8221;&#8216;s.<br \/>\nSo that script will actually start the `top` command.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Another question I got a while back is how to make a DWORD (Double Word),<br \/>\nthat means how to rewrite an address or IP to hex\/oct\/dec.<\/p>\n<p>And it&#8217;s not that hard, all it takes is some mathematics.<br \/>\nIt works like this:<\/p>\n<p>There are several methods, but let&#8217;s start with the Decimal way<br \/>\nof making a DWORD.<br \/>\nSay you have IP: 127.0.0.1<br \/>\nthen you do:<br \/>\n127 * 16777216 = 2130706432<br \/>\n0 * 65536\u00a0\u00a0\u00a0\u00a0\u00a0 = 0<br \/>\n0 * 256\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 = 0<br \/>\n1 * 1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 = 1<br \/>\nSum:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 2130706433<\/p>\n<p>Or if you have the IP: 123.123.123.123<br \/>\n123 * 16777216 = 2063597568<br \/>\n123 * 65536\u00a0\u00a0\u00a0 = 8060928<br \/>\n123 * 256\u00a0\u00a0\u00a0\u00a0\u00a0 = 31488<br \/>\n123 * 1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 = 123<br \/>\nSum:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 2071690107<\/p>\n<p>Note:<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 16777216 = 2^24<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 65536 = 2^16<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 256 = 2^8<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1 = 2^0<\/p>\n<p>Next method is to convert it to HEX, OCT etc, to convert from dec to oct etc.<br \/>\nyou can either use the ascii table a few lines up, or you can download<br \/>\na program called ascii from <a href=\"http:\/\/www.freshmeat.net\">www.freshmeat.net<\/a>.<br \/>\nLast time I saw it it was located at:<br \/>\n<a href=\"http:\/\/freshmeat.net\/projects\/ascii\/download\/ascii-3.0.tar.gz\">http:\/\/freshmeat.net\/projects\/ascii\/download\/ascii-3.0.tar.gz<\/a><\/p>\n<p>So assuming you have downloaded that and and wanna covert 127.0.0.1 and<br \/>\n123.123.123.123 to HEX DWORDs, do this:<\/p>\n<p>alien:~$ ascii 127 0 0 1<br \/>\nASCII 7\/15 is decimal 127, hex 7f, octal 177, bits 01111111: called ^?, DEL<br \/>\nOfficial name: Delete<\/p>\n<p>ASCII 5\/7 is decimal 087, hex 57, octal 127, bits 01010111: prints as `W&#8217;<br \/>\nOfficial name: Majuscule W<br \/>\nOther names: Capital W, Uppercase W<\/p>\n<p>ASCII 3\/0 is decimal 048, hex 30, octal 060, bits 00110000: prints as `0&#8242;<br \/>\nOfficial name: Digit Zero<\/p>\n<p>ASCII 3\/0 is decimal 048, hex 30, octal 060, bits 00110000: prints as `0&#8242;<br \/>\nOfficial name: Digit Zero<\/p>\n<p>ASCII 3\/1 is decimal 049, hex 31, octal 061, bits 00110001: prints as `1&#8242;<br \/>\nOfficial name: Digit One<\/p>\n<p>alien:~$<\/p>\n<p>Take the hex numbers after the decimal of 127, 0 and 1 and you&#8217;ll come<br \/>\nto the conclution that 127.0.0.1 in a hex DWORD is: 7F303031<\/p>\n<p>You can use OCT the same way .. with as many leading 0&#8217;s as you please<\/p>\n<p>0173.0173.0173.0173 or 000173.00000173.000173.000000000000000000000173,<br \/>\nit still means IP 123.123.123.123<\/p>\n<p>And ofcorse to add on the confusion you can mix the methods.<br \/>\n0173.0x7b.00173.123<\/p>\n<p>Now there is even more to this like that you can add any multiple of the<br \/>\nnumber 4294967296 (2^32) to the number without the IP changing &#8230;.<br \/>\nBut let&#8217;s not get into that &#8230;.<\/p>\n<p>So basically typing:<br \/>\n<a href=\"http:\/\/0173.0x7b.00173.123\/\">http:\/\/0173.0x7b.00173.123\/<\/a><br \/>\nin your web browser will end you up at IP 123.123.123.132 (which doesnt excist)<br \/>\nbut the idea is the same for everything, so if you see some lame spammer<br \/>\nthinking that you wont know from what address he sent something &#8230;<br \/>\nThe just back count it and send abuse mail to his internet service provider.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>If someone has more questions mail, them to me at: <a href=\"mailto:alien@ktv.koping.se\">alien@ktv.koping.se<\/a><br \/>\nmaybe I&#8217;ll include them in the tutorial, but I&#8217;ll do my best to answer<br \/>\nthe questions anyway.<\/p>\n<p>===============================================================================<br \/>\n10 &#8211; Basics of the common UNIX and Linux text editors.<br \/>\n===============================================================================<\/p>\n<p>Here we go with the text editors vi, ed and emacs.<br \/>\ned is just explained for historical reasons.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Most commonly used VI commands<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Here we go with the vi commands, these are unlogical but still good to know<br \/>\nbecause all computers doesn&#8217;t have emacs, joe, pico and so on.<br \/>\nSolaris \/ SunOS comes default with vi as only text editor.<br \/>\nVi has 2 basic modes, command mode and edit mode, you change between them<br \/>\nby pressing the Esc button, and to start to edit a file you must have a<br \/>\nfree line, which you get by pressing, Esc followed by `o`.<br \/>\nvi is bound to be the hardest and most confusing text editor to learn,<br \/>\nand it has LOTS of commands, I included just a few of the most used<br \/>\ncommands.<\/p>\n<p>So here we go with the vi commands:<\/p>\n<p>Inserting text<\/p>\n<p>esc + i\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 insert text informant of the cursor<br \/>\nesc + a\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 append text after the existing text<br \/>\nesc + O\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 opens new line above the current line<br \/>\nesc + o\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 opens new line under current line (insert mode)<\/p>\n<p>Deleting text<\/p>\n<p>esc + x\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 deletes one character<br \/>\nesc + 5x\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 deletes five charters<br \/>\nesc + dw\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 deletes a word<br \/>\nesc + 5dw\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 deletes five words<br \/>\nesc + dd\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 deletes the whole line<br \/>\nesc + D\u00a0\u00a0 deletes the line from cursor and forward<br \/>\nesc + d)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 deletes the sentence from cursor and forward<br \/>\nesc + d(\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 deletes the sentence from cursor and backwards<br \/>\nesc + u\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 undelete<\/p>\n<p>Note: esc + d) or d( removes the sentence from cursor and forward\/backwards<br \/>\nuntil it reaches a dot &#8220;.&#8221;<\/p>\n<p>Moving around in VI:<\/p>\n<p>Make sure you are in command mode and the following letters will do:<\/p>\n<p>j\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 moves you down<br \/>\nk\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 moves you up<br \/>\nh\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 moves you left<br \/>\nl\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 moves you right<\/p>\n<p>Finding Text<\/p>\n<p>Hit esc then type in a \/ you then go to the bottom of the screen<br \/>\nwhere you will see your \/ type in the text to look for.<br \/>\nie. \/Linux<br \/>\nthat will find the word `Linux` in the open file.<\/p>\n<p>Replacing Text<\/p>\n<p>Hit esc and do: :start,stop,s\/s_text\/r_text\/g<\/p>\n<p>:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 indicates that this is an ex command<br \/>\nstart\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 is the starting line number<br \/>\nstop\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 is the stopping point<br \/>\ns\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 is the substitute command<br \/>\ns_text\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 is the search string (the text you are looking for )<br \/>\nr_text\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 is the text you are replacing with<br \/>\ng\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 is global\u00a0<\/p>\n<p>Example:<\/p>\n<p>Esc + :5,8,s\/l\/ll\/g<\/p>\n<p>This would replace all &#8220;l&#8221;&#8216;s with &#8220;ll&#8221; on lines 5 to 8.<\/p>\n<p>Note to Replacing Text:<br \/>\nLine numbers can also be:<br \/>\n.\u00a0 current line<br \/>\n$\u00a0 last line<\/p>\n<p>Basic save &amp; quit commands<\/p>\n<p>Hit Esc and do a : where after you can type the commands.<\/p>\n<p>w\u00a0 write (save)<br \/>\nq\u00a0 quit<br \/>\n!\u00a0 force<\/p>\n<p>ie. :q!\u00a0 or\u00a0 :wq<\/p>\n<p>To create control characters do:<\/p>\n<p>Ctrl+V Ctrl+&lt;the character&gt;<\/p>\n<p>Example:<\/p>\n<p>Ctrl+V Ctrl+A<\/p>\n<p>That will create a ^A character.<\/p>\n<p>(These last 3 commands are very alike ed commands)<\/p>\n<p>Another useful thing in VI is split-screen mode, so you can edit 2 files<br \/>\nat once, this is:<\/p>\n<p>:split<\/p>\n<p>Just press Esc and type &#8220;:split&#8221;.<br \/>\nYou can do this in most big editors &#8230;.. but ofcorse in another way, you&#8217;ll<br \/>\nsee when you&#8217;re reading the emacs section.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Most commonly used ED commands<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>ed is a very very old line editor, and the grand father of most editors,<br \/>\nperhaps even the grandfather of all editors, it dates back to the time of<br \/>\nthe old CP\/M machines, and is the father of the old DOS edlin line editor.<br \/>\nSo out of historical perspective, it can be fun to know how to operate ed.<\/p>\n<p>Creating a file in ed:<\/p>\n<p>alien:~$ ed newfile<br \/>\nnewfile: No such file or directory<\/p>\n<p>Don&#8217;t worry, as soon as you save it it will create it.<br \/>\nED is pretty simple, here&#8217;s an example (the &#8220;(ed says)&#8221; and &#8220;(we type)&#8221; is<br \/>\njust there to make it easier to follow the editing in this tutorial and is<br \/>\nnot there in reality):<\/p>\n<p>alien:~$ echo &#8220;abcd&#8221; &gt;&gt; newfile; echo &#8220;efgh&#8221; &gt;&gt; newfile; echo &#8220;ijkl&#8221; &gt;&gt; newfile<br \/>\nalien:~$ ed newfile<br \/>\n15\u00a0 (ed says)<br \/>\n1,$ n\u00a0 (we type)<br \/>\n1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 abcd (ed says)<br \/>\n2\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 efgh (ed says)<br \/>\n3\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ijkl (ed says)<br \/>\n1\u00a0 (we type)<br \/>\nabcd\u00a0 (ed says)<br \/>\ns\/ab\/ll\u00a0 (we type)<br \/>\nllcd\u00a0 (ed says)<br \/>\n$ n\u00a0 (we type)<br \/>\n3\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ijkl (ed says)<br \/>\na\u00a0 (we type)<br \/>\nhere we end (we type)<br \/>\n.\u00a0 (we type)<br \/>\nw\u00a0 (we type)<br \/>\n27\u00a0 (ed says)<br \/>\nq\u00a0 (we type)<br \/>\nalien:~$<\/p>\n<p>Not all that hard is it ?<br \/>\nHere&#8217;s a list of the most basic commands for ed:<\/p>\n<p>1,$ n\u00a0\u00a0\u00a0 displays all lines with numbers<br \/>\n$ n\u00a0 display last line, with number<br \/>\n2 n\u00a0\u00a0\u00a0\u00a0\u00a0 takes you to line 2<br \/>\ns\/new\/old\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 replaces old with new<br \/>\na\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 takes you to editor mode<br \/>\n.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 takes you to command mode<br \/>\nd\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 deletes line<br \/>\nw\u00a0 write file (save)<br \/>\nq\u00a0 quit<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>The final thing in this tutorial is a really quick look at emacs commands:<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Most commonly used Emacs commands<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>^A Cursor to the beginning of line<br \/>\n^E Cursor to the end of line<br \/>\n^K Deletes rest of line forward<br \/>\n^D Deletes current character<br \/>\n^L Horizontally center the current line<br \/>\n^S Search for a word forward in the file<br \/>\n^R Search for a word backwards in file<\/p>\n<p>^Q Followed by Ctrl+&lt;anything&gt;, gives the real control character in a text file<\/p>\n<p>^X ^F Open file<br \/>\n^X ^- ^- Undo<br \/>\n^C+Shift+- Undo<br \/>\n^X ^C ! Quit without saving<br \/>\n^X 2 split screen (horizontaly)<br \/>\n^X 3 split screen (verticaly)<br \/>\n^X O move to other screen (if in splitscreen mode)<br \/>\n^X ^W Save As<br \/>\n^X ^S Save<\/p>\n<p>(^X 1 to get back a single window from splitscreen mode)<\/p>\n<p>Shift+Esc Shift+5: Replace query (press y to replace words)<br \/>\nMeta+backspace: Deletes rest of word backwards (note &#8220;Meta&#8221; == &#8220;Alt&#8221;)<br \/>\nHome: Takes cursor to the top of the file (Or equal to ^A)<br \/>\nEnd: Takes cursor to the end of the file (Or equal to ^E)<br \/>\nDelete: Deletes current character<br \/>\nPage Up \/ Page Down: Does what they say<br \/>\nMeta+X: Will load any emacs plugin, you may type any plugin name after pressing<br \/>\nthe Meta+X (Alt+X), if you press TAB here once you will get a list of the<br \/>\ncommands, if you type &#8216;a&#8217; followed by a tab you will get all commands<br \/>\nstarting with a and so on &#8230;. try: Meta+X doctor to try the<br \/>\ninteractive eliza bot, or try telnet, ftp, webjump or shell.<\/p>\n<p>To reach the menus &#8220;Buffers Files &#8230;&#8221; etc. press F10<br \/>\nand if you wanna get out of the menus press ^G.<\/p>\n<p>You may think that all this is weird, but know that emacs use to work<br \/>\nas a VERY primitive window manager, before the times of X.<\/p>\n<p>Backspace and the arrow key&#8217;s works as normal.<\/p>\n<p>A tip is tp press: ^X then press 2 then press ^X and then O, now press<br \/>\nMeta+X and type &#8216;shell&#8217;, and you should have a split window, with a<br \/>\nshell in the lower one, so you can code or write in the upper one<br \/>\nat the same time as you have a shell in the lower one.<br \/>\nTo change between the windows simply press: Ctrl+X and then press: o<br \/>\nA note is that if you want to run BitchX in the shell part you need<br \/>\nto start it with: BitchX -d, to get it in dumb terminal mode.<\/p>\n<p>Usless or obsolete commands:<\/p>\n<p>^I TAB<br \/>\n^O Move text forward<br \/>\n^P same as UpArrow<br \/>\n^F same as RightArrow<br \/>\n^J Enter\/Return<br \/>\n^B same as LeftArrow<br \/>\n^N same as DownArrow<br \/>\n^M Enter\/Return<\/p>\n<p>^U Del\u00a0 deletes 4 characterss backwards<br \/>\n^U ^U Del\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 deletes 16 characterss backwards<br \/>\n^U ^U ^U Del\u00a0\u00a0\u00a0 deletes 64 characterss backwards<\/p>\n<p>All you really need to know to start using emacs is how to save and quit.<\/p>\n<p>( ^X ^S ^X ^C will save and quit, a tip is: hold down ^ (Ctrl) and<br \/>\npress X S X C )<\/p>\n<p>===============================================================================<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\n===============================================================================<\/p>\n<p>This should be enough for you to start to script in bash, and make useful<br \/>\nscripts.<br \/>\nThe only thing that limits what you can do is your imagination (well almost).<\/p>\n<p>Go over this tutorial several times so you really understand everything.<br \/>\nIf you accomplish that, you have a really good chance of learning UNIX well.<\/p>\n<p>And that&#8217;s what it&#8217;s all about, to learn new things and explore new ways.<br \/>\nAs long as you learn you live, not the contrary.<\/p>\n<p>This tutorial turned out rather large, but I hope that those of you out there<br \/>\nthat have the determination to learn shell scripting, also have the patinace<br \/>\nto read it all, and if not, you can always use it as a small dictionary.<\/p>\n<p>I&#8217;ve got the question many times, which Linux distribution is the best &#8230;.<br \/>\nThe question in it self is pointless and as ilitterat as asking<br \/>\nwhat version linux is up to&#8230;.<br \/>\nThe later question can only be answerd with a kernel version number,<br \/>\nand that is what Linux is, Linux is the kenrel and all distributions<br \/>\nuse the same kernel, everything else in the system is just &#8220;stuff around<br \/>\nthe kernel&#8221;, to this point I&#8217;ve found that Mandrake is the distibution<br \/>\nthat is most compleat for my needs, and it&#8217;s suitable for beginners<br \/>\naswell as for proffessionals, and it has nice configuration tools<br \/>\nthat have been written especially for Mandrake.<br \/>\nBut as I said, a Linux is a Linux, and the main difference between different<br \/>\ndistributions is the package manager, where of rpm is the most stanard<br \/>\nand accepted, though I find Debians dpkg good aswell.<br \/>\nThis is to the difference of distributions that have no indiginous package<br \/>\nmanager like Slackware, that emulates a package manager with it&#8217;s .tgz<br \/>\npackage format (note that .tar.gz is not .tgz since .tgz should have it&#8217;s<br \/>\npackages compressed with there path beginning from \/ )<br \/>\nNow there is nothing wrong with that if you like to compile most stuff on the<br \/>\nsystem your self, and many people preffer to do that.<\/p>\n<p>My conclution is that the best distrinution is the one you personally<br \/>\nlike the best, the one that fits _your_ needs.<\/p>\n<p>So anyway, when you know bash scripting well enough, my suggestion is to<br \/>\nlearn C programming, which, if you look at it with bash behind you,<br \/>\nisn&#8217;t that hard.<\/p>\n<p>So, I better go to bed and stop this nonses now.<\/p>\n<p>Happy scripting all of you out there.<\/p>\n<p>===============================================================================<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212; Written by Billy Wideling &lt;-&gt; <a href=\"mailto:alien@koping.net\">alien@koping.net<\/a> &#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\n===============================================================================<\/p>\n","protected":false},"excerpt":{"rendered":"<p>original link: http:\/\/subsignal.org\/doc\/AliensBashTutorial.html =========================== Aliens Bash Tutorial ============================== &#8212;&#8212;&#8212;&#8212;&#8212; Written by Billy Wideling &lt;-&gt; alien@koping.net &#8212;&#8212;&#8212;&#8212;&#8212;- =============================================================================== First you probably need to read a UNIX command bible to really understand this tutorial, but I will try to make it as clear as possible, there is about 100-150 UNIX commands explained later in this tutorial. You [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"open","template":"","meta":{"footnotes":""},"class_list":["post-9","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/wp.oktay.com\/index.php?rest_route=\/wp\/v2\/pages\/9","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.oktay.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/wp.oktay.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/wp.oktay.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.oktay.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=9"}],"version-history":[{"count":0,"href":"https:\/\/wp.oktay.com\/index.php?rest_route=\/wp\/v2\/pages\/9\/revisions"}],"wp:attachment":[{"href":"https:\/\/wp.oktay.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=9"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}