<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.linuxquestions.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Snags</id>
	<title>LQWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.linuxquestions.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Snags"/>
	<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/wiki/Special:Contributions/Snags"/>
	<updated>2026-04-10T22:55:21Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.37.0</generator>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Process&amp;diff=14752</id>
		<title>Process</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Process&amp;diff=14752"/>
		<updated>2004-08-17T19:04:25Z</updated>

		<summary type="html">&lt;p&gt;Snags: Minor clarification of parent-child relationship&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A '''process''' is one program that a multi-processing computer system is running.  &lt;br /&gt;
Other words meaning basically the same thing are ''job'' and ''task''.  Generally, each running program is contained in one process.  Some complex programs split their work into multiple processes, each of which contains a small part of the program that performs a specific task.&lt;br /&gt;
&lt;br /&gt;
The [[ps]] command is used to list processes on Linux systems.  The [[top]] command provides a continuously updating list of processes with some resource information at the top of the screen.  The list of all processes with parent/child relationships can be displayed with [[pstree]].  The [[jobs]] command lists the [[background]] processes created by the current shell.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;[[fork]]()&amp;lt;/tt&amp;gt; system call is used to create new processes.  When this is done, the new process is a ''child'' of the old process, which is the ''parent''.  If the parent exits, the child is killed.  A [[daemon]] process ''reparents'' itself to be a child of [[init]], so even if the (former) parent quits, the daemon keeps running.&lt;br /&gt;
&lt;br /&gt;
In [[bash]], the immediate process ID ([[PID]]) is represented by &amp;lt;tt&amp;gt;$$&amp;lt;/tt&amp;gt;. The parent process ID ([[PPID]]) is represented by &amp;lt;tt&amp;gt;$PPID&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
''This article is a [[LQWiki:stub_articles|stub]] and needs to be finished. [[LQWiki:plunging_forward|Plunge forward]] and [[LQWiki:How_to_edit_a_page|help it grow]] !''&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Talk:Ln&amp;diff=24699</id>
		<title>Talk:Ln</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Talk:Ln&amp;diff=24699"/>
		<updated>2004-08-17T19:02:06Z</updated>

		<summary type="html">&lt;p&gt;Snags: Answer to emacs on hardlinks.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;It seems that if you edit a hard link, that the result of the edit isn't that both files are changed (what I would expect), but rather, that a duplicate is made and modified.&lt;br /&gt;
&lt;br /&gt;
Is this correct, or us [[emacs]] just being clever, and making a new file just like the original?&lt;br /&gt;
&lt;br /&gt;
[[User:LionKimbro|LionKimbro]]&lt;br /&gt;
&lt;br /&gt;
That stumps me, which means &amp;quot;take it to the LQ forums&amp;quot;. [[User:Crazyeddie|Crazyeddie]] 20:08, Aug 16, 2004 (EDT)&lt;br /&gt;
&lt;br /&gt;
It's just emacs.  For example:&lt;br /&gt;
 $ echo &amp;quot;Contents of file 1.&amp;quot; &amp;gt; file1&lt;br /&gt;
 $ ln file1 file2&lt;br /&gt;
 $ cat file2&lt;br /&gt;
 Contents of file 1.&lt;br /&gt;
 $ echo &amp;quot;Contents of file 2.&amp;quot; &amp;gt; file2&lt;br /&gt;
 $ cat file1&lt;br /&gt;
 Contents of file 2.&lt;br /&gt;
With emacs, the original, crosslinked file is saved with a tilde (~).&lt;br /&gt;
 $ emacs file1       # Change the contents, save, and exit&lt;br /&gt;
 $ [[ls]] -l&lt;br /&gt;
 -rw-rw-r--    1 Snags    Snags          19 Aug 17 14:56 file1&lt;br /&gt;
 -rw-rw-r--    2 Snags    Snags          19 Aug 17 14:56 file1~&lt;br /&gt;
 -rw-rw-r--    2 Snags    Snags          19 Aug 17 14:56 file2&lt;br /&gt;
The number just before the [[username]] is the number of hard links.&lt;br /&gt;
--[[User:Snags|Snags]] 15:02, Aug 17, 2004 (EDT)&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Talk:Lsof&amp;diff=10903</id>
		<title>Talk:Lsof</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Talk:Lsof&amp;diff=10903"/>
		<updated>2004-08-06T18:45:12Z</updated>

		<summary type="html">&lt;p&gt;Snags: Root for lsof???&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I tried killing the fam process before I found out that stopping inetd was necessary.  Killing fam did not not allow the umount to work.&lt;br /&gt;
&lt;br /&gt;
Do you know a way to make this work with kill?&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Hey, LionKimbro, you sure you have to be root to run &amp;lt;tt&amp;gt;lsof&amp;lt;/tt&amp;gt;?  I can run it as a user, it just isn't in my path.  If I do:&lt;br /&gt;
 $ /usr/sbin/lsof&lt;br /&gt;
I get a long list of results.  --[[User:Snags|Snags]] 14:45, Aug 6, 2004 (EDT)&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Xdm&amp;diff=12687</id>
		<title>Xdm</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Xdm&amp;diff=12687"/>
		<updated>2004-08-03T19:34:29Z</updated>

		<summary type="html">&lt;p&gt;Snags: Short explanation of what it does&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Xdm''' is the standard [[X]] display manager.  Other popular display managers include [[kdm]] and [[gdm]].&lt;br /&gt;
&lt;br /&gt;
If xdm is run (usually by [[init]]), it will start an X server and display a graphical [[login]] prompt.&lt;br /&gt;
&lt;br /&gt;
{{msg:stub}}&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Talk:Chown&amp;diff=10848</id>
		<title>Talk:Chown</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Talk:Chown&amp;diff=10848"/>
		<updated>2004-08-03T19:32:38Z</updated>

		<summary type="html">&lt;p&gt;Snags: Suggest dotglob to whoever wanted it.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;If you do a chown group.user -R *&lt;br /&gt;
&lt;br /&gt;
...then .dotfiles do not seem to get converted.&lt;br /&gt;
&lt;br /&gt;
Is there a way to say &amp;quot;get the dot-files as well?&amp;quot;&lt;br /&gt;
&lt;br /&gt;
...and if so, it should be in the page documentation.&lt;br /&gt;
&lt;br /&gt;
-- LionKimbro&lt;br /&gt;
&lt;br /&gt;
If bash interperted * as .* , it would get the . (current directory) and .. (parent directory) &amp;quot;files&amp;quot;. That would be bad. To avoid this, if you want to work with .files (which are supposed to be hidden anyway), you could do something like .[A-Z,a-z,0-9] or some such, I'm not familar with the syntax there. &lt;br /&gt;
&lt;br /&gt;
Also, please sign your posts with four tildes (~), this will automatically provide a link to your userpage and a timestamp. [[User:Crazyeddie|Crazyeddie]] 18:21, Aug 2, 2004 (EDT)&lt;br /&gt;
&lt;br /&gt;
In [[bash]], if you turn on the &amp;lt;tt&amp;gt;dotglob&amp;lt;/tt&amp;gt; shell option, bash will include dot files (not . or ..) if they match your wildcard expression.  To turn it on, type&lt;br /&gt;
 $ shopt -s dotglob&lt;br /&gt;
--[[User:Snags|Snags]] 15:32, Aug 3, 2004 (EDT)&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=User&amp;diff=11279</id>
		<title>User</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=User&amp;diff=11279"/>
		<updated>2004-07-13T15:17:00Z</updated>

		<summary type="html">&lt;p&gt;Snags: Expand article with respect to user accounts.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The '''user''' is a major concept in Linux/Unix and many other computing paradigms.  The term can mean any user of a system, i.e. a person.  Typically ''user'' referrs to a non-privileged user of a given computer's resources, as differentiated from the [[super user]] or [[root]], the system administrator.&lt;br /&gt;
&lt;br /&gt;
'''User''' also has a specific meaning in the system itself, that of a '''user account'''.  With each account is associated a username and a serial number called the [[UID]].  Each system has a list of valid user accounts, typically stored in the [[passwd]] file but possibly obtained from some network directory.  Most of these accounts (on a multiuser machine) correspond to actual people, but some of them are for administrative purposes.  Occasionally, systems will have some user accounts that actually belong to groups of people.&lt;br /&gt;
&lt;br /&gt;
Every [[process]] runs in the name of some user called the owner.  The [[top]] command lists processes along with the owners.  [[File]]s also have owners.  Files and other system resources are protected and can only be accessed by particular users.  Sending [[signal]]s can only be done by the user or super user of the process being signalled.&lt;br /&gt;
&lt;br /&gt;
'''/[[usr]]''' is a standard high level directory where applications and programs that are not absolutely necessary for the computer to work are kept.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[luser]]&lt;br /&gt;
&lt;br /&gt;
{{msg:stub}}&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Rm&amp;diff=22875</id>
		<title>Rm</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Rm&amp;diff=22875"/>
		<updated>2004-07-08T13:00:49Z</updated>

		<summary type="html">&lt;p&gt;Snags: =Warnings= Slight reword of hidden directory warning&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Command rm== &lt;br /&gt;
Removes files or directories. Rm removes each specified file. By default, it does not remove directories. If a file is unwritable, the standard input is a tty, and the -f or --force option is not given, rm prompts the user for whether to remove the file. If the response does not begin with `y' or `Y', the file is skipped.  &lt;br /&gt;
  &lt;br /&gt;
===Syntax===&lt;br /&gt;
'''rm ''[OPTION] file'' '''  &lt;br /&gt;
&lt;br /&gt;
===Options===&lt;br /&gt;
* ''-d'', ''--directory'' - unlink file, even if it is a non-empty directory (super-user only) &lt;br /&gt;
* ''-f'', ''--force'' - ignore nonexistent files, never prompt &lt;br /&gt;
* ''-i'', ''--interactive'' - prompt before any removal &lt;br /&gt;
* ''-r'', ''-R'', ''--recursive'' - remove the contents of directories recursively &lt;br /&gt;
* ''-v'', ''--verbose'' - explain what is being done &lt;br /&gt;
* ''--help'' - display this help and exit &lt;br /&gt;
* ''--version'' - output version information and exit &lt;br /&gt;
&lt;br /&gt;
===Examples===&lt;br /&gt;
To remove file1.txt:&lt;br /&gt;
 $ rm file1.txt&lt;br /&gt;
To remove the directory 'testing', including all files it contained:&lt;br /&gt;
 $ rm -r testing&lt;br /&gt;
To remove all files starting with the letters 'file' (eg file1.bin, filed.txt).&lt;br /&gt;
 $ rm file*&lt;br /&gt;
To have rm ask you for confirmation before deleting file1.txt.&lt;br /&gt;
 $ rm -i file1.txt&lt;br /&gt;
&lt;br /&gt;
To remove a file whose name starts with a `-', for example `-foobar', use one of these commands:&lt;br /&gt;
 $ rm ./-foobar &lt;br /&gt;
 $ rm -- -foobar &lt;br /&gt;
&lt;br /&gt;
Note that if you use rm to remove a file, it is usually possible for others to [[recover]] the contents of that file. If you want more assurance that the contents are truly unrecoverable, consider using [[shred]].&lt;br /&gt;
&lt;br /&gt;
===Warnings===&lt;br /&gt;
rm is a dangerous command (especially with [[wild cards]]) and should be treated  with a high degree of respect. So here are some warnings:&lt;br /&gt;
*'''Don't Use &amp;lt;tt&amp;gt;rm&amp;lt;/tt&amp;gt; as Root.''' Unless you absolutely have to. As with everything with linux, avoid using rm under root if you can possibly avoid it. This will help to prevent deleting vital system files, which should be protected by permissions.  Deleting vital system files is not fun to fix and very unhelpful.&lt;br /&gt;
&lt;br /&gt;
*'''Check for Typos!''' Especially for spaces.&lt;br /&gt;
*'''Be Wary of Wildcards!''' Especially if you are in a vital directory (e.g. /usr/bin).&lt;br /&gt;
&lt;br /&gt;
:I ''([[User:Geniarse|Geniarse]])'' once typed the command the command &amp;lt;tt&amp;gt;rm foo *&amp;lt;/tt&amp;gt; in /usr/bin (as root '''of course'''). Note the space between * and foo. This is a very bad typo to do as this deletes the file foo and ''then'' all files in directory, rather than all files beginning with foo as intended. SO CHECK FOR TYPING MISTAKES!&lt;br /&gt;
*'''Be VERY Careful Using the -rf Flags.''' Some people advise that if you ''do'' use the -rf (recursive and forcible) flags, that you use them at the end of the command. This prevents the following: &amp;lt;tt&amp;gt;rm -rf /''&amp;lt;your pet kitten presses the enter key&amp;gt;''&amp;lt;/tt&amp;gt;&lt;br /&gt;
*'''Don't use Wildcards to Recursively Remove Files under a Hidden Directory!''' Ever wanted to remove all files recursively under a hidden directory (name beginning with &amp;quot;.&amp;quot; e.g. &amp;quot;.foo&amp;quot;) entering command &amp;lt;tt&amp;gt;rm -R .*/*&amp;lt;/tt&amp;gt;?  Well, a hint is DON'T.  As the &amp;quot;name&amp;quot; for parent directory is listed as &amp;quot;..&amp;quot;, the parent directory will be included, hence all files and directories in parent directory will be included, not good.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
* [[rmdir]]&lt;br /&gt;
* [[shred]]&lt;br /&gt;
* [[mv]]&lt;br /&gt;
* [[mkdir]]&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
*[http://man.linuxquestions.org/index.php?query=rm&amp;amp;section=0&amp;amp;type=2 rm man page]&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Rm&amp;diff=10134</id>
		<title>Rm</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Rm&amp;diff=10134"/>
		<updated>2004-07-08T12:58:12Z</updated>

		<summary type="html">&lt;p&gt;Snags: =Examples= reformat&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Command rm== &lt;br /&gt;
Removes files or directories. Rm removes each specified file. By default, it does not remove directories. If a file is unwritable, the standard input is a tty, and the -f or --force option is not given, rm prompts the user for whether to remove the file. If the response does not begin with `y' or `Y', the file is skipped.  &lt;br /&gt;
  &lt;br /&gt;
===Syntax===&lt;br /&gt;
'''rm ''[OPTION] file'' '''  &lt;br /&gt;
&lt;br /&gt;
===Options===&lt;br /&gt;
* ''-d'', ''--directory'' - unlink file, even if it is a non-empty directory (super-user only) &lt;br /&gt;
* ''-f'', ''--force'' - ignore nonexistent files, never prompt &lt;br /&gt;
* ''-i'', ''--interactive'' - prompt before any removal &lt;br /&gt;
* ''-r'', ''-R'', ''--recursive'' - remove the contents of directories recursively &lt;br /&gt;
* ''-v'', ''--verbose'' - explain what is being done &lt;br /&gt;
* ''--help'' - display this help and exit &lt;br /&gt;
* ''--version'' - output version information and exit &lt;br /&gt;
&lt;br /&gt;
===Examples===&lt;br /&gt;
To remove file1.txt:&lt;br /&gt;
 $ rm file1.txt&lt;br /&gt;
To remove the directory 'testing', including all files it contained:&lt;br /&gt;
 $ rm -r testing&lt;br /&gt;
To remove all files starting with the letters 'file' (eg file1.bin, filed.txt).&lt;br /&gt;
 $ rm file*&lt;br /&gt;
To have rm ask you for confirmation before deleting file1.txt.&lt;br /&gt;
 $ rm -i file1.txt&lt;br /&gt;
&lt;br /&gt;
To remove a file whose name starts with a `-', for example `-foobar', use one of these commands:&lt;br /&gt;
 $ rm ./-foobar &lt;br /&gt;
 $ rm -- -foobar &lt;br /&gt;
&lt;br /&gt;
Note that if you use rm to remove a file, it is usually possible for others to [[recover]] the contents of that file. If you want more assurance that the contents are truly unrecoverable, consider using [[shred]].&lt;br /&gt;
&lt;br /&gt;
===Warnings===&lt;br /&gt;
rm is a dangerous command (especially with [[wild cards]]) and should be treated  with a high degree of respect. So here are some warnings:&lt;br /&gt;
*'''Don't Use &amp;lt;tt&amp;gt;rm&amp;lt;/tt&amp;gt; as Root.''' Unless you absolutely have to. As with everything with linux, avoid using rm under root if you can possibly avoid it. This will help to prevent deleting vital system files, which should be protected by permissions.  Deleting vital system files is not fun to fix and very unhelpful.&lt;br /&gt;
&lt;br /&gt;
*'''Check for Typos!''' Especially for spaces.&lt;br /&gt;
*'''Be Wary of Wildcards!''' Especially if you are in a vital directory (e.g. /usr/bin).&lt;br /&gt;
&lt;br /&gt;
:I ''([[User:Geniarse|Geniarse]])'' once typed the command the command &amp;lt;tt&amp;gt;rm foo *&amp;lt;/tt&amp;gt; in /usr/bin (as root '''of course'''). Note the space between * and foo. This is a very bad typo to do as this deletes the file foo and ''then'' all files in directory, rather than all files beginning with foo as intended. SO CHECK FOR TYPING MISTAKES!&lt;br /&gt;
*'''Be VERY Careful Using the -rf Flags.''' Some people advise that if you ''do'' use the -rf (recursive and forcible) flags, that you use them at the end of the command. This prevents the following: &amp;lt;tt&amp;gt;rm -rf /''&amp;lt;your pet kitten presses the enter key&amp;gt;''&amp;lt;/tt&amp;gt;&lt;br /&gt;
*'''Don't Recursively Remove Files under a Hidden Directory!''' Ever wanted to remove all files recursively under a hidden directory (name beginning with &amp;quot;.&amp;quot; e.g. &amp;quot;.foo&amp;quot;) entering command &amp;lt;tt&amp;gt;rm -R .*/*&amp;lt;/tt&amp;gt;? Well, a hint is DON'T. As the &amp;quot;name&amp;quot; for parent directory is listed as &amp;quot;..&amp;quot;, the parent directory will be included, hence all files and directories in parent directory will be included, not good.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
* [[rmdir]]&lt;br /&gt;
* [[shred]]&lt;br /&gt;
* [[mv]]&lt;br /&gt;
* [[mkdir]]&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
*[http://man.linuxquestions.org/index.php?query=rm&amp;amp;section=0&amp;amp;type=2 rm man page]&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Rm&amp;diff=10133</id>
		<title>Rm</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Rm&amp;diff=10133"/>
		<updated>2004-07-08T12:55:22Z</updated>

		<summary type="html">&lt;p&gt;Snags: Link manpage (can't believe I missed this one)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Command rm== &lt;br /&gt;
Removes files or directories. Rm removes each specified file. By default, it does not remove directories. If a file is unwritable, the standard input is a tty, and the -f or --force option is not given, rm prompts the user for whether to remove the file. If the response does not begin with `y' or `Y', the file is skipped.  &lt;br /&gt;
  &lt;br /&gt;
===Syntax===&lt;br /&gt;
'''rm ''[OPTION] file'' '''  &lt;br /&gt;
&lt;br /&gt;
===Options===&lt;br /&gt;
* ''-d'', ''--directory'' - unlink file, even if it is a non-empty directory (super-user only) &lt;br /&gt;
* ''-f'', ''--force'' - ignore nonexistent files, never prompt &lt;br /&gt;
* ''-i'', ''--interactive'' - prompt before any removal &lt;br /&gt;
* ''-r'', ''-R'', ''--recursive'' - remove the contents of directories recursively &lt;br /&gt;
* ''-v'', ''--verbose'' - explain what is being done &lt;br /&gt;
* ''--help'' - display this help and exit &lt;br /&gt;
* ''--version'' - output version information and exit &lt;br /&gt;
&lt;br /&gt;
===Examples===&lt;br /&gt;
* rm file1.txt&lt;br /&gt;
** removes file1.txt&lt;br /&gt;
* rm -r testing&lt;br /&gt;
** removes the directory 'testing', including all files it contained.&lt;br /&gt;
* rm file*&lt;br /&gt;
** removes all files starting with the letters 'file' (eg file1.bin, filed.txt).&lt;br /&gt;
* rm -i file1.txt&lt;br /&gt;
** asks you for confirmation before deleting file1.txt.&lt;br /&gt;
&lt;br /&gt;
To remove a file whose name starts with a `-', for example `-foobar', use one of these commands:&lt;br /&gt;
&lt;br /&gt;
* rm ./-foobar &lt;br /&gt;
* rm -- -foobar &lt;br /&gt;
&lt;br /&gt;
Note that if you use rm to remove a file, it is usually possible for others to [[recover]] the contents of that file. If you want more assurance that the contents are truly unrecoverable, consider using [[shred]].&lt;br /&gt;
&lt;br /&gt;
===Warnings===&lt;br /&gt;
rm is a dangerous command (especially with [[wild cards]]) and should be treated  with a high degree of respect. So here are some warnings:&lt;br /&gt;
*'''Don't Use &amp;lt;tt&amp;gt;rm&amp;lt;/tt&amp;gt; as Root.''' Unless you absolutely have to. As with everything with linux, avoid using rm under root if you can possibly avoid it. This will help to prevent deleting vital system files, which should be protected by permissions.  Deleting vital system files is not fun to fix and very unhelpful.&lt;br /&gt;
&lt;br /&gt;
*'''Check for Typos!''' Especially for spaces.&lt;br /&gt;
*'''Be Wary of Wildcards!''' Especially if you are in a vital directory (e.g. /usr/bin).&lt;br /&gt;
&lt;br /&gt;
:I ''([[User:Geniarse|Geniarse]])'' once typed the command the command &amp;lt;tt&amp;gt;rm foo *&amp;lt;/tt&amp;gt; in /usr/bin (as root '''of course'''). Note the space between * and foo. This is a very bad typo to do as this deletes the file foo and ''then'' all files in directory, rather than all files beginning with foo as intended. SO CHECK FOR TYPING MISTAKES!&lt;br /&gt;
*'''Be VERY Careful Using the -rf Flags.''' Some people advise that if you ''do'' use the -rf (recursive and forcible) flags, that you use them at the end of the command. This prevents the following: &amp;lt;tt&amp;gt;rm -rf /''&amp;lt;your pet kitten presses the enter key&amp;gt;''&amp;lt;/tt&amp;gt;&lt;br /&gt;
*'''Don't Recursively Remove Files under a Hidden Directory!''' Ever wanted to remove all files recursively under a hidden directory (name beginning with &amp;quot;.&amp;quot; e.g. &amp;quot;.foo&amp;quot;) entering command &amp;lt;tt&amp;gt;rm -R .*/*&amp;lt;/tt&amp;gt;? Well, a hint is DON'T. As the &amp;quot;name&amp;quot; for parent directory is listed as &amp;quot;..&amp;quot;, the parent directory will be included, hence all files and directories in parent directory will be included, not good.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
* [[rmdir]]&lt;br /&gt;
* [[shred]]&lt;br /&gt;
* [[mv]]&lt;br /&gt;
* [[mkdir]]&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
*[http://man.linuxquestions.org/index.php?query=rm&amp;amp;section=0&amp;amp;type=2 rm man page]&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Dd&amp;diff=10101</id>
		<title>Dd</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Dd&amp;diff=10101"/>
		<updated>2004-07-08T01:05:25Z</updated>

		<summary type="html">&lt;p&gt;Snags: Reformat, some rewording&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The '''dd''' command copies data from one place to another.  Sometimes [[cat]] can do the same thing (with [[redirection]]), but dd has options to translate data, selectively copy only part of a data stream, and buffer its reads and writes.&lt;br /&gt;
&lt;br /&gt;
Dd can [[Making_an_ISO_from_CDROM|copy a CD to an ISO file]], copy one partition to another, or restore an image file to a disk.  Using the &amp;lt;tt&amp;gt;seek&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;count&amp;lt;/tt&amp;gt; options, an individual sector of a disk can be extracted without having to wait for the entire rest of the disk to be read.&lt;br /&gt;
&lt;br /&gt;
Also see the very useful tool [[dd_rescue]], which you can use to recover media with errors on it.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
===Creating a hard drive backup image===&lt;br /&gt;
&lt;br /&gt;
The main options to be concerned about are if= (input file) and of= (output file). By default, dd reads from [[stdin]] and writes to [[stdout]]. Here is an example of a use for dd:&lt;br /&gt;
&lt;br /&gt;
 $ dd if=/dev/hda | gzip &amp;gt; /mnt/hdb1/system_drive_backup.img.gz&lt;br /&gt;
&lt;br /&gt;
Here dd is making an image of the first harddrive, and piping it through the [[gzip]] compression program.  The compressed image is then placed in a file on a seperate drive.  To reverse the process:&lt;br /&gt;
&lt;br /&gt;
 $ gzip -dc /mnt/hdb1/system_drive_backup.img.gz | dd of=/dev/hda&lt;br /&gt;
&lt;br /&gt;
Here, gzip is decompressing (the -d switch) the file, sending the results to stdout (the -c switch), which are piped to dd, and then written to /dev/hda.&lt;br /&gt;
&lt;br /&gt;
===Backing up your Master Boot Record ([[MBR]]).===&lt;br /&gt;
You should do this before you edit your partition table so that you can put it back if you mess things up.&lt;br /&gt;
&lt;br /&gt;
 $ dd if=/dev/hda of=/root/hda.boot.mbr bs=512 count=1&lt;br /&gt;
&lt;br /&gt;
If things mess up, you can boot with [[Knoppix]], mount the partition containing /root (hda1 in this example) and put back the MBR with the command:&lt;br /&gt;
&lt;br /&gt;
 $ dd if=/mnt/hda1/root/hda.boot.mbr of=/dev/hda bs=512 count=1&lt;br /&gt;
&lt;br /&gt;
===Getting around file size limitations using split===&lt;br /&gt;
When making images, it's quite easy to run up against 2-gigabyte file size limitations.  One way to work around it is to use the [[split]] command.&lt;br /&gt;
&lt;br /&gt;
 $ dd if=/dev/hda1 | gzip -c | split -b 2000m - /mnt/hdc1/backup.img.gz.&lt;br /&gt;
&lt;br /&gt;
# This example is using dd to take an image of the first partition on the first harddrive.&lt;br /&gt;
# The results are passed through to [[gzip]] for compression&lt;br /&gt;
#* The -c option switch is used to output the result to [[stdout]].&lt;br /&gt;
# The compressed image is then piped to the [[split]] tool&lt;br /&gt;
#* The -b 2000m switch tells split how big to make the individual files. You can use k and m to tell switch kilobytes and megabytes (this option uses bytes by default).&lt;br /&gt;
#* The - option tells split to read from [[stdin]]. Otherwise, split would interpret the /mnt/hdc1... as the file to be split.&lt;br /&gt;
#* The /mnt/hdc1... is the prefix for the created files. Split will create files named backup.img.gz.aa, backup.img.gz.ab, etc.&lt;br /&gt;
&lt;br /&gt;
To restore the multi-file backup, do the following:&lt;br /&gt;
&lt;br /&gt;
 $ cat /mnt/hdc1/backup.img.gz.* | gzip -dc | dd of=/dev/hda1&lt;br /&gt;
&lt;br /&gt;
#Cat recombines contents of the compressed and split image files to [[stdout]], in order.&lt;br /&gt;
#Results are piped through gzip for decompression.&lt;br /&gt;
#And are then written to the first partition of the hard drive with dd.&lt;br /&gt;
&lt;br /&gt;
==Jargon File Entry==&lt;br /&gt;
This is what the [[Jargon File]] has to say about dd:&lt;br /&gt;
&lt;br /&gt;
[Unix: from IBM JCL] Equivalent to [[cat]] or BLT. Originally the name of a Unix copy command with special options suitable for [[block device|block-oriented devices]]; it was often used in heavy-handed system maintenance, as in &amp;quot;Let's dd the [[root]] partition onto a tape, then use the boot PROM to load it back on to a new disk&amp;quot;. The Unix dd(1)was designed with a weird, distinctly non-Unixy keyword option syntax reminiscent of IBM System/360 JCL (which had an elaborate DD &amp;quot;Dataset Definition&amp;quot; specification for I/O devices); though the command filled a need, the interface design was clearly a prank. The jargon usage is now very rare outside Unix sites and now nearly obsolete even there, as dd(1)  has been deprecated for a long time (though it has no exact replacement). The term has been displaced by BLT or simple English &amp;quot;copy&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[image]]&lt;br /&gt;
* [[Blanking a hard drive]]&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
* [http://man.linuxquestions.org/index.php?query=dd&amp;amp;section=0&amp;amp;type=2 dd man page]&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Xev&amp;diff=12705</id>
		<title>Xev</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Xev&amp;diff=12705"/>
		<updated>2004-07-07T20:04:57Z</updated>

		<summary type="html">&lt;p&gt;Snags: Create article.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The '''xev''' program displays [[X]] events.  It can create its own window or grab events sent to some other window.  Xev is useful for debugging X applications or [[X server]] configurations.&lt;br /&gt;
&lt;br /&gt;
The events seen by xev include key presses (and releases), mouse motion and button presses (and releases) (including specifically when the mouse enters and leaves the window), focus changes, and redraw requests.&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
&lt;br /&gt;
*[http://man.linuxquestions.org/index.php?query=xev&amp;amp;section=0&amp;amp;type=2 xev man page]&lt;br /&gt;
&lt;br /&gt;
{{msg:stub}}&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Unzip&amp;diff=9910</id>
		<title>Unzip</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Unzip&amp;diff=9910"/>
		<updated>2004-06-30T13:59:59Z</updated>

		<summary type="html">&lt;p&gt;Snags: Format, expand intro&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===Basics===&lt;br /&gt;
&lt;br /&gt;
'''unzip''' is the most straighforward of the decompression utilities.  It operates on &amp;lt;tt&amp;gt;.zip&amp;lt;/tt&amp;gt; files created by [[zip]], PKZip, Winzip, or other programs.  The term '''unzip''' is also used loosely to describe the act of decompressing any [[compress]]ed data, especially data in the [[gzip]] format.&lt;br /&gt;
&lt;br /&gt;
To invoke it simply use:&lt;br /&gt;
&lt;br /&gt;
 $ unzip &amp;lt;i&amp;gt;filename&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create all the appropriate subdirectories.&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
&lt;br /&gt;
-q will make unzip quiet, quite useful to avoid clutter.&amp;lt;br&amp;gt;&lt;br /&gt;
-f will extract only newer, or non-existing files, nice for just updating.&amp;lt;br&amp;gt;&lt;br /&gt;
-t will test an archive to make sure it's good ([[zip]] can fix it many times)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
*[[gunzip]]&lt;br /&gt;
*[[gzip]]&lt;br /&gt;
*[[tar]]&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=User_talk:Snags&amp;diff=9922</id>
		<title>User talk:Snags</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=User_talk:Snags&amp;diff=9922"/>
		<updated>2004-06-30T13:54:34Z</updated>

		<summary type="html">&lt;p&gt;Snags: =June 29= Reply to Crazieeddie&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I'd like to organize this in sections, with the newest info at the top.  It'll make it easier to edit and draws attention to the new stuff.  Replies in each section can be in chronological order.  Don't forget (like I do) to sign with four tildes (&amp;quot;&amp;amp;tilde;&amp;amp;tilde;&amp;amp;tilde;&amp;amp;tilde;&amp;quot;).  --[[User:Snags|Snags]]&lt;br /&gt;
&lt;br /&gt;
==June 29==&lt;br /&gt;
Noticed your boilerplate section. Are you sure what you're copy-and-pasting is CC-by-sa compatible? Most man pages are GFDL, which can't be released under Creative Commons. [[User:Crazyeddie|Crazyeddie]] 00:10, Jun 30, 2004 (EDT)&lt;br /&gt;
&lt;br /&gt;
*Well, being as I'm posting a link to a webpage, yes.  The actual text of the manpages is hosted elsewhere.  --[[User:Snags|Snags]] 09:54, Jun 30, 2004 (EDT)&lt;br /&gt;
&lt;br /&gt;
==April 10==&lt;br /&gt;
&lt;br /&gt;
Why did 'Encryption' have two links to wikipedia articles, one of which (cryptography) clobbered an already existing LQWiki article - correction, an laready existing stub *rolleyes* (but the principles the same) - and the other of which (public-key [cryptography]) could be written here? [[User:Digiot|Digiot]] 15:55, Apr 10, 2004 (EDT)&lt;br /&gt;
&lt;br /&gt;
:Well, when I wrote that text, I didn't clobber anything.  You can't clobber something in fresh text.  [[Cryptography]] should probably be a REDIRECT to [[encryption]], anyway.  [[Gpg]] covers the basics of public-key cryptography, and it's already linked in [[encryption]].  I linked to wikipedia because they already have great articles on the non-Linux-specific subject covered in this LQWiki article.  Of course, I'm not offended by edits to my text.  But don't be surprised to find and &amp;quot;External links&amp;quot; section.  --[[User:Snags|Snags]] 16:41, Apr 10, 2004 (EDT)&lt;br /&gt;
&lt;br /&gt;
::Well, what I meant was that clicking on that link would have taken them offsite rather then to the onsite 'content' with the same title. However, that was before I noticed there ''was'' no actual content. Still, in principle, as I say, it'd be better for a cryptography link to go to the LQWiki rather than the wikipedia if each had articles of the same name. However, you bring up an excellent point regarding the non-Linux-specific nature of the material. And external links would of course be fine either way. (I actually should have done that myself.) My concern was solely with them being in the body of the text and - intercepting (maybe better than 'clobber'?) - intercepting a theoretical LQWiki link.&lt;br /&gt;
&lt;br /&gt;
::As far as the redirects, the unfortunate thing is that I think 'cryptography' is a slightly more general term and 'encryption' was originally created hierarchically in 'commands' - the focus of the article is supposed to be on Linux encryption commands. The paragraph(s) at the top are merely supposed to be minimally explanatory. Many of the things that redirect to it should redirect to the not-yet-existing 'cryptography'. Really, 'encryption' need to be renamed. *sigh* [[User:Digiot|Digiot]] 17:16, Apr 10, 2004 (EDT)&lt;br /&gt;
&lt;br /&gt;
==March 26==&lt;br /&gt;
&lt;br /&gt;
I noticed you were 'piping' links such as 'gzip' on the 'compress' page, but the links work without the &amp;lt;nowiki&amp;gt;[[gzip|foo]]&amp;lt;/nowiki&amp;gt;. Is there a reason I'm missing? Not a big deal as they work either way, but I was confused and it doesn't seem necessary.&lt;br /&gt;
&lt;br /&gt;
[[User:Digiot|Digiot]] 15:25, Mar 26, 2004 (EST)&lt;br /&gt;
&lt;br /&gt;
: The confirmation page when I clicked &amp;quot;Move this page&amp;quot; implied that I should remove double redirects.  Also, I saw others going around doing this, so I figured it wasn't a bad thing to do.&lt;br /&gt;
&lt;br /&gt;
: I took your advice on the &amp;quot;Flags&amp;quot; versus &amp;quot;Options&amp;quot;.  The article is now called [[Command options]] (should that be command-line options?).  It makes sense, because the function designed to deal with them is called &amp;lt;tt&amp;gt;getopt()&amp;lt;/tt&amp;gt;.  --[[User:Snags|Snags]] 15:45, Mar 26, 2004 (EST)&lt;br /&gt;
&lt;br /&gt;
::Oh. No, avoiding double redirects is good. :) Usually that can be taken care of by directly editing the redirect that doubles, though. (Not always - sometimes they get a little 'hung'.)&lt;br /&gt;
&lt;br /&gt;
::And I didn't realize the 'flags' thing was so widespread. Like I say, I think 'flags' is fine but was just thinking that if there were one or two, they might as well be called 'options'. If it's a mass-changing issue... well, whichever you think. Hm. As far as what to call the main page, I'd almost like 'options' but I suppose that's too vague. I think either's fine. 'Command-line options' might be a little better but maybe not worth moving it again. Again, whichever you'd prefer or maybe some other folks have some ideas.&lt;br /&gt;
&lt;br /&gt;
::[[User:Digiot|Digiot]] 15:52, Mar 26, 2004 (EST)&lt;br /&gt;
&lt;br /&gt;
:::Most instances of &amp;quot;flags&amp;quot; were written by me.  Once you said options, I agreed.  To me, a flag is an on|off option.  I'll leave it to someone with more motivation than I to rename it Command-line options.  --[[User:Snags|Snags]]&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Dd&amp;diff=9919</id>
		<title>Dd</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Dd&amp;diff=9919"/>
		<updated>2004-06-24T13:56:13Z</updated>

		<summary type="html">&lt;p&gt;Snags: Reduce language exaggerating its usefulness.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The '''dd''' command copies data from one place to another.  Sometimes [[cat]] can do the same thing (with [[redirection]]), but dd has options to translate data, selectively copy only part of a data stream, and buffer its reads and writes.&lt;br /&gt;
&lt;br /&gt;
Dd can [[Making_an_ISO_from_CDROM|copy a CD to an ISO file]], copy one partition to another, or restore an image file to a disk.  Using the &amp;lt;tt&amp;gt;seek&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;count&amp;lt;/tt&amp;gt; options, an individual sector of a disk can be extracted without having to wait for the entire rest of the disk to be read.&lt;br /&gt;
&lt;br /&gt;
Also see the very useful tool [[dd_rescue]], which you can use to recover media with errors on it.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
The main options to be concerned about are if= (input file) and of= (output file). By default, dd reads from [[stdin]] and writes to [[stdout]]. Here is an example of a use for dd:&lt;br /&gt;
&lt;br /&gt;
dd if=/dev/hda | gzip&amp;gt;&amp;gt;/mnt/fat32/system_drive_backup.img.gz&lt;br /&gt;
&lt;br /&gt;
Here dd is making an image of the first harddrive, and piping it through the [[gzip]] compression program. The compressed image is then placed in a file on a seperate, fat32 partition. To reverse the process:&lt;br /&gt;
&lt;br /&gt;
gzip -dc /mnt/fat32/system_drive_backup.img.gz | dd of=/dev/hda&lt;br /&gt;
&lt;br /&gt;
Here, gzip is decompressing (the -d switch) the file, sending the results to stdout (the -c switch), which are piped to dd, and then written to /dev/hda.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Tips and Tricks==&lt;br /&gt;
&lt;br /&gt;
===Backing up your Master Boot Record ([[MBR]]).===&lt;br /&gt;
You should do this before you edit your partition table so that you can put it back if you mess things up.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;dd if=/dev/hda of=/root/hda.boot.mbr bs=512 count=1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If things mess up, you can boot with [[Knoppix]], mount the partition containing /root (hda1 in this example) and put back the MBR with the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;dd if=/mnt/hda1/root/hda.boot.mbr of=/dev/hda bs=512 count=1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Getting around file size limitations using split===&lt;br /&gt;
When making images, it's quite easy to run up against file size limitations. One was to work around it is to use the [[split]] command.&lt;br /&gt;
&lt;br /&gt;
====Example====&lt;br /&gt;
&lt;br /&gt;
:dd if=/dev/hda1 | gzip -c | split -b 2000m - /mnt/hdc1/backup.img.gz.&lt;br /&gt;
&lt;br /&gt;
# This example is using dd to take an image of the first partition on the first harddrive.&lt;br /&gt;
# The results are passed through to [[gzip]] for compression&lt;br /&gt;
## The -c option switch is used to output the result to [[stdout]].&lt;br /&gt;
# The compressed image is then piped to the [[split]] tool&lt;br /&gt;
## The -b 2000m switch tells split how big to make the individual files. You can use k and m to tell switch kilobytes and megabytes (this option uses bytes by default).&lt;br /&gt;
## The - option tells split to read from [[stdin]]. Otherwise, split would interpret the /mnt/hdc1... as the file to be split.&lt;br /&gt;
## The /mnt/hdc1... is the prefix for the created files. Split will create files named backup.img.gz.aa, backup.img.gz.ab, etc.&lt;br /&gt;
&lt;br /&gt;
''Need an entry on how to reverse process!''&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[image]]&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
* [http://man.linuxquestions.org/index.php?query=dd&amp;amp;section=0&amp;amp;type=2 dd man page]&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Killall&amp;diff=24317</id>
		<title>Killall</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Killall&amp;diff=24317"/>
		<updated>2004-06-23T15:31:02Z</updated>

		<summary type="html">&lt;p&gt;Snags: Other signals, Caution for non-linux systems, Example&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The '''killall''' [[command]] kills [[process]]es by name, alleviating the need to run [[ps]] to find the [[pid]] before issuing a [[kill]] command.  [[Signal]]s other than the kill signal can also be sent.&lt;br /&gt;
&lt;br /&gt;
Caution should be used on non-Linux systems, where killall may have a different behavior, like killing all processes attached to the current [[terminal]].&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
 $ killall mozilla-bin&lt;br /&gt;
Kills a locked-up Mozilla browser.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[[kill]]&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
*[http://man.linuxquestions.org/index.php?query=killall&amp;amp;section=0&amp;amp;type=2 killall man page]&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Killall&amp;diff=9728</id>
		<title>Killall</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Killall&amp;diff=9728"/>
		<updated>2004-06-23T15:24:38Z</updated>

		<summary type="html">&lt;p&gt;Snags: Link manpage&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The '''killall''' [[command]] kills [[process]]es by name.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[[kill]]&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
*[http://man.linuxquestions.org/index.php?query=killall&amp;amp;section=0&amp;amp;type=2 killall man page]&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Piping&amp;diff=18485</id>
		<title>Piping</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Piping&amp;diff=18485"/>
		<updated>2004-06-22T18:09:20Z</updated>

		<summary type="html">&lt;p&gt;Snags: =Programming details=&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=VNC&amp;diff=11186</id>
		<title>VNC</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=VNC&amp;diff=11186"/>
		<updated>2004-06-22T12:34:19Z</updated>

		<summary type="html">&lt;p&gt;Snags: Trim X discussion&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''VNC''' stands for '''Virtual Network Computing'''. VNC uses the remote frame buffer ([[RFB]]) protocol to allow a user to access a graphical desktop without having physical access to the machine. The user uses a VNC client to connect to the VNC server. The client sends mouse movements and clicks to the server, which in return sends the graphical display itself back to the client.&lt;br /&gt;
&lt;br /&gt;
VNC is network transparent and platform independent.&lt;br /&gt;
&lt;br /&gt;
You could, for example, use a VNC client running on your workplace's [[Microsoft Windows]] desktop to connect through the network to your home Linux desktop.&lt;br /&gt;
&lt;br /&gt;
The original VNC implementation is [http://www.realvnc.com RealVNC], developed at AT&amp;amp;T. Another popular VNC implementation is [http://tightvnc.com TightVNC], which is an optimized and [[GPL]]'d version of RealVNC. There are even clients for cell phones, [http://j2mevnc.sf.net j2mevnc].&lt;br /&gt;
&lt;br /&gt;
Each of these implementations provides a client program, called vncviewer, in addition to the (separate) server program (vncserver). Other clients are also available, such as the Remote Desktop Connection application of [[KDE]].&lt;br /&gt;
&lt;br /&gt;
Operating systems using the [[X Window System]] can use the X Display Manager Control Protocol ([[XDMCP]]) to allow network based access to a remote system's graphical desktop.  [[XDMCP]] uses much less network bandwith than VNC, but it requires an X server.  There are [[X#For_other_OS|X servers]] available for non-UNIX OS's.&lt;br /&gt;
&lt;br /&gt;
=VNC Usage=&lt;br /&gt;
Over SSH: http://www.ltsp.org/contrib/vnc.html&lt;br /&gt;
&lt;br /&gt;
==Invoking VNC==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vncviewer &amp;lt;ip&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will prompt for password of VNC server, before displaying window with desktop of remote machine.&lt;br /&gt;
&lt;br /&gt;
It is possible to connect to a VNC viewer using a java enabled browser. This is makes VNC technology much more flexible, as no special software required on the client. This is done by entering the IP address of VNC server followed by the port 5800 +display number though ports are customisable. e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;http://192.168.1.1:5801&amp;lt;/pre&amp;gt; - Typical for a windows box&lt;br /&gt;
&amp;lt;pre&amp;gt;http://192.168.1.1:5802&amp;lt;/pre&amp;gt; - Typical for a linux box (displays second X display)&lt;br /&gt;
&lt;br /&gt;
==Setting up==&lt;br /&gt;
&lt;br /&gt;
VNC server is really easy to install on Windows, so you can use &amp;lt;tt&amp;gt;vncviewer&amp;lt;/tt&amp;gt; to log into your Windows box. (See Also [[rdesktop]] for a way to log into windows native remote system)&lt;br /&gt;
&lt;br /&gt;
VNC is installed by default in recent versions of [[KDE]]:&lt;br /&gt;
&lt;br /&gt;
K menu--&amp;gt;Settings --&amp;gt; Control Center --&amp;gt; Internet and Networking --&amp;gt; Desktop Sharing&lt;br /&gt;
&lt;br /&gt;
=Products=&lt;br /&gt;
&lt;br /&gt;
* realvnc http://www.realvnc.org&lt;br /&gt;
* tightvnc http://www.tightvnc.org&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
* [[Remote login]]&lt;br /&gt;
* [[X forwarding]]&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=X_Window_System&amp;diff=9723</id>
		<title>X Window System</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=X_Window_System&amp;diff=9723"/>
		<updated>2004-06-22T12:30:25Z</updated>

		<summary type="html">&lt;p&gt;Snags: =For other OS= Add a few other Windows X servers&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The '''X Window System''' (X or [[X11]] for version 11, for short) is a method of providing networked graphics capabilities  to an operating system. It is most commonly used on Unix and Unix-like systems such as Linux.&lt;br /&gt;
&lt;br /&gt;
While other systems for providing graphics capabilities are possible, the standard graphical interface system on Linux is the X Window System.&lt;br /&gt;
&lt;br /&gt;
==X mechanics==&lt;br /&gt;
Essentially, what X provides is a program (the [[X server]]) which controls the graphics card and performs actual graphics drawing tasks such as splitting the screen into windows, drawing the mouse pointer, drawing lines, accessing the keyboard, etc.  It runs the actual video driver, as well as provides an interface through which other programs can issue drawing commands (using the [[X11 protocol]]).  &lt;br /&gt;
&lt;br /&gt;
Programs which attach to the X server are called [[X client]]s, and include applications such as word processors, games, etc.  &lt;br /&gt;
&lt;br /&gt;
===Window managers===&lt;br /&gt;
One client is special, and is the [[window manager]] - X on its own does not manage drawing the window widgets (title bar and borders) and minimizing, maximizing, raising, and other specifics - this is delegated to the window manager. Before [[desktop environment]]s became more commonly used, the [[window manager]] was the primary piece of software responsible for determining the look and feel of the [[GUI]], however, window managers can only address look and feel at the window level - within the application consistency is derived from the use of a common toolkit, which was not a feature of X applications previously. Many [[window manager]]s are available, such as [[Window Maker]], [[Enlightenment]], and [[FVWM]].&lt;br /&gt;
&lt;br /&gt;
===Network capabilities===&lt;br /&gt;
X is notable in a number of ways as a graphical interface system.  One interesting feature is that, since the [[X protocol]] is designed to operate as a serialized sequence of commands, it supports operating transparently over a network.  Thus, an X client may run on a remote machine in almost the same way as one can run locally.  Its windows will appear on the screen just like other programs running on the local system.  However, a program running locally will use more efficient communication mechanisms such as Unix sockets and SHM than a remote program, and hence will be significantly faster and more efficient.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Comment: I removed &amp;quot;using XDMCP in almost...&amp;quot; because XDMCP is not very often used to run clients remotely.  It's used as a login process to run your entire session off a remote host.  More commonly, someone simply logs into a machine and executes a program there with DISPLAY set appropriately. &lt;br /&gt;
-Elladan &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The [[X protocol]] is extensible, so new features can be added as time goes on.  For example, some recent features that were added include support for anti-aliased fonts, truetype fonts, alpha-blending, and hardware-accelerated 3D graphics.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==X server implementations==&lt;br /&gt;
===XFree86===&lt;br /&gt;
The most popular X server for Linux is called [[XFree86]].  It's actually a suite of programs including an [[X Server]], drivers for a vast array of graphics cards, support files such as fonts etc., and a number of standard utilities such as [[xterm]] and [[twm]].&lt;br /&gt;
&lt;br /&gt;
===TinyX/XKdrive===&lt;br /&gt;
TinyX (also knows as XKdrive) is an X server designed for special environments with limited memory or disk space. Each TinyX server is compiled for a specific driver (for a graphics chipset) and with a selected number of extensions. It doesn't use XFree86's more modular approach to reduce it's size. It is included in the source of XFree86.&lt;br /&gt;
&lt;br /&gt;
===Accelerated-X===&lt;br /&gt;
[[Accelerated-X]] is a commercial X server from Xi graphics[http://www.xig.com].  It supports some graphics cards [[XFree86]] does not and has been claimed to be faster by some people.&lt;br /&gt;
&lt;br /&gt;
===X.org===&lt;br /&gt;
The X.Org Foundation also develops an X server (usually refered to as ''Xorg''). Development was recently opened up and put on the freedeskop site[http://freedesktop.org/Software/xorg]. The latest release is X11R6.7 which is based on XFree86 4.4 RC2 just before the license change and many new updates where added since. It can be downloaded at the [http://x.org/ x.org website].&lt;br /&gt;
&lt;br /&gt;
===In development===&lt;br /&gt;
*Freedesktop X server -- A project to test out new experimental X extensions and other features. Currently has 3 different X servers. kdrive (based on kdrive/tinyX from XFree86), Xizzle (fork of XFree86 server) and Cygwin/X.[http://freedesktop.org/Software/xserver]&lt;br /&gt;
&lt;br /&gt;
===For other OS===&lt;br /&gt;
For Windows:&lt;br /&gt;
*[http://x.cygwin.com Cygwin/X] - Free&lt;br /&gt;
*[http://www.hummingbird.com/products/nc/exceed/ Exceed]&lt;br /&gt;
*[http://www.wrq.com/products/reflection/ ReflectionX]&lt;br /&gt;
*[http://www.starnet.com/products/ XWin32]&lt;br /&gt;
&lt;br /&gt;
==Criticism==&lt;br /&gt;
The X Window System has been criticized in recent times for a number of reasons.  The most common criticisms are that its dependence on the X protocol renders it less efficient than some other styles of GUI design, and that the X Protocol itself is showing its age and does not provide features popular in modern [[GUI]] systems.  While these criticisms have been quite popular in some circles, there is widespread disagreement with their conclusions.  In any case, it would be very impractical to replace [[X11]], since so much software already exists for it.  A number of projects exist to continue to improve X11 and keep it up to date with developments in computer graphical interfaces.&lt;br /&gt;
&lt;br /&gt;
===Alternatives===&lt;br /&gt;
*[[DirectFB]] -- GUI on the linux [[framebuffer]] device&lt;br /&gt;
*[[GGI]] -- General Graphics Interface, supports multiple different output targets&lt;br /&gt;
*[[Y Window System]]&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Xhost&amp;diff=24292</id>
		<title>Xhost</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Xhost&amp;diff=24292"/>
		<updated>2004-06-18T20:50:33Z</updated>

		<summary type="html">&lt;p&gt;Snags: Create article.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The '''xhost''' command is used to tell your local [[X]] server to allow remote programs from another computer to access your display, keyboard, and mouse.  Because there is no distinction of who on the remote computer can use the X server, the xhost method is not a very secure way of enabling remote access.  It is better to use [[xauth]] or [[ssh]].&lt;br /&gt;
&lt;br /&gt;
==Using xhost==&lt;br /&gt;
&lt;br /&gt;
To tell your X server to allow access from a particular host:&lt;br /&gt;
 LocalBox$ xhost +OtherBox.company.com&lt;br /&gt;
Then, when you log in to Otherbox, you have to set the DISPLAY variable so that applications know where to show their output:&lt;br /&gt;
 OtherBox$ export DISPLAY=Localbox.company.com:0&lt;br /&gt;
(If you use [[csh]], use the proper syntax instead of the [[export]] command.)&lt;br /&gt;
&lt;br /&gt;
To totally remove access control (not a good idea), run the command:&lt;br /&gt;
 LocalBox$ xhost +&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
&lt;br /&gt;
*[http://man.linuxquestions.org/index.php?query=xhost&amp;amp;section=0&amp;amp;type=2 xhost man page]&lt;br /&gt;
*[http://www.xs4all.nl/~zweije/xauth-6.html#ss6.1 Remote X Apps mini-HOWTO]&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Xauth&amp;diff=9581</id>
		<title>Xauth</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Xauth&amp;diff=9581"/>
		<updated>2004-06-18T13:17:39Z</updated>

		<summary type="html">&lt;p&gt;Snags: Start article&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The '''xauth''' program is used to provide remote applications with a numerical cookie (a password of sorts) so that your local [[X]] server will allow them to ''directly'' display and receive keystrokes, mouse clicks, and other events.  Without the cookie, the remote application will be refused (unless the [[xhost]] command was used to allow the remote [[host]]).  In addition to having the proper cookie, the remote applications must be told where the local X server is through the setting of the DISPLAY variable.&lt;br /&gt;
&lt;br /&gt;
For many applications, [[ssh]] provides an excellent alternative to using xauth to allow the remote applications.  Ssh will automatically set the DISPLAY variable, provide a temporary xauth cookie, and shuttle the communications through the encrypted connection.  Using a direct connection and xauth removes the encryption, but allows faster throughput and response times.&lt;br /&gt;
&lt;br /&gt;
==Using xauth==&lt;br /&gt;
&lt;br /&gt;
To use xauth, the X server must have been started with it enabled.  This is usually true if you log in with [[xdm]], [[gdm]], etc. or if you use [[startx]] from the console command line ([[xinit]] may or may not enable xauth).&lt;br /&gt;
&lt;br /&gt;
To find out what the cookie is, run the following command:&lt;br /&gt;
 MyLinuxBox$ xauth list&lt;br /&gt;
 MyLinuxBox/unix:0  MIT-MAGIC-COOKIE-1  7baa0cff510bd092cdce4286e72356df&lt;br /&gt;
 MyLinuxBox.mycompany.com:0  MIT-MAGIC-COOKIE-1  7baa0cff510bd092cdce4286e72356df&lt;br /&gt;
 MyLinuxBox/unix:10  MIT-MAGIC-COOKIE-1  e2de05a5fa80f36772f8b08419e3c926&lt;br /&gt;
The one that matches your [[DISPLAY]] variable is the one you want.  Extras may be left around by [[ssh]] and are likely not valid any more.&lt;br /&gt;
&lt;br /&gt;
Once you know the cookie, log in to the remote machine.  Then set the cookie using cut-and-paste:&lt;br /&gt;
 OtherBox$ xauth add MyLinuxBox.mycompany.com:0 MIT-MAGIC-COOKIE-1 \&lt;br /&gt;
    7baa0cff510bd092cdce4286e72356df&lt;br /&gt;
 OtherBox$ export DISPLAY=MyLinuxBox.mycompany.com:0&lt;br /&gt;
(If you use [[csh]], use the proper syntax instead of the export command.)  The DISPLAY variable must match the entry that xauth enters, which may be slightly different than how you typed it.&lt;br /&gt;
&lt;br /&gt;
Another way of transferring the xauth cookie is mentioned in the xauth man page.&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
&lt;br /&gt;
*[http://man.linuxquestions.org/index.php?query=xauth&amp;amp;section=0&amp;amp;type=2 xauth man page]&lt;br /&gt;
*[http://www.xs4all.nl/~zweije/xauth-6.html#ss6.2 Remote X Apps mini-HOWTO]&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Talk:Configuring_X&amp;diff=23489</id>
		<title>Talk:Configuring X</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Talk:Configuring_X&amp;diff=23489"/>
		<updated>2004-06-17T15:17:42Z</updated>

		<summary type="html">&lt;p&gt;Snags: Ask about x.org&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Ack! The [[Configuring]] page should &amp;lt;b&amp;gt;really&amp;lt;/b&amp;gt; be [[X:Configuring]] or [[X:Configuration]] instead.&lt;br /&gt;
&lt;br /&gt;
[[User:JohnMG|JohnMG]] 15:34, Mar 25, 2004 (EST)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Ack! Ack! There's actually a [[Configuring_X]] page, and [[Configuring]] is just a link to it!&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;i&amp;gt;Oh the tangled wiki we weave, ...&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[User:JohnMG|JohnMG]] 15:38, Mar 25, 2004 (EST)&lt;br /&gt;
----&lt;br /&gt;
Yeah, the redirect from configuring should probably be removed and all pages linking to it fixed. Not sure what to put on the page though... since 'configuring' pages seem to usually be on the page with the software package name (and there are a couple of 'using...' 'installing...' etc pages).&amp;lt;br&amp;gt;&lt;br /&gt;
Ohh, I'd also suggest moving this page &amp;quot;Configuring X&amp;quot; to &amp;quot;Configuring XFree86&amp;quot;, specially with the current rise of interest in alternative X servers :)&amp;lt;br&amp;gt;&lt;br /&gt;
[[User:Jor|Jor]] 20:42, Mar 25, 2004 (EST)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Just talking about this elsewhere. Hm. The problem with a lot of the pages here is that I think we want to basically be defining nouns. 'Configuring' shouldn't exist at all, just on grammatical grounds. A redirect seemed to be the change that would have the least impact and still fix it. Or sweep it under the rug, as the case may be. But the same goes for this one. And each article really has to be self-sufficient. If it's not, why is it split off in the first place? If it's not, it should be a section of some other article.&lt;br /&gt;
&lt;br /&gt;
We seem to have an aversion to long articles but, with a ToC, I don't see the problem with having an 'XFree86' article that includes a 'configuration' section. There's no such thing as 'configuring' unless someone wanted to create an article whose entire contents were&lt;br /&gt;
&lt;br /&gt;
'''Configuring''' is the process of supplying programs with needed information and/or default behaviors.&lt;br /&gt;
&lt;br /&gt;
(Followed by a 'See also' list several miles long that duplicated the 'Applications' and 'Commands' sections.) :)&lt;br /&gt;
&lt;br /&gt;
This is one of those 'my two cents'. ;)&lt;br /&gt;
&lt;br /&gt;
[[User:Digiot|Digiot]] 21:04, Mar 25, 2004 (EST)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
Well, I see you point on self-sufficient pages, but following you thought on the XFree86 page would mean it gets sections for every bit of possible configuration issue with it. That will become pretty huge, e.g. it would include the content of [[Using multiple monitors with XFree86]],[[OpenGL]],[[Installing_NVIDIA_drivers]],[[Configuring TV out]],[[Configuring mice (Serial, PS/2, USB)]],[[Configuring keyboards]] and many many not yet written content. Not that I mind big pages (my download speeds from this server seems OK), but the TOC itself would span multiple pages and don't even think about the indendation levels :)&lt;br /&gt;
I kinda like seperation of pages with just info/definitions/what-is-it stuff and pages with more using/doing/howto like stuff. And that's my 'two cents' :) [[User:Jor|Jor]] 21:29, Mar 25, 2004 (EST)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
True. A single XFree86 wouldn't be workable - entire books (series of books) have been written and don't scratch the surface. But a general overview and specific topics make more sense. An 'X configuration' section in 'XFree86' which explains the bare concepts - what tools? xf86cfg, etc. What files? XF86Config, etc. Then specfics spun out from there. 'X Configuration' seems to land in that hazy 'in between' area. Every topic you listed should maybe go on this page rather than X, whereas the X article would just explain the whole concept of the networked GUI. And then this page has the same problem of being huge. Or of being just another link to go through from the X page to the 'I need to get my mouse working' part. I dunno. There's no way one way to do it and any approach is going to have upsides and downsides, I guess.&lt;br /&gt;
&lt;br /&gt;
[[User:Digiot|Digiot]] 23:15, Mar 25, 2004 (EST)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Okay. The 'X Window System' tree has always been kind of weird on the 'Applications' page. What it is now is&lt;br /&gt;
&lt;br /&gt;
    *  X Window System&lt;br /&gt;
          o General Tips&lt;br /&gt;
          o Programming&lt;br /&gt;
          o Configuring&lt;br /&gt;
          o Screenshots&lt;br /&gt;
          o Remote Desktop Connection &lt;br /&gt;
&lt;br /&gt;
But RDC is a separate topic and basically repeats what should be found under other 'Application' or 'Command' pages. Everything on it is a program. And 'telnet' has exactly zero to do with X, besides. Screenshots is more a 'Common Task', wherever that went. Programming in X belongs in 'Programming'. No user of X cares about programming and every programmer of X is going to be wandering around in 'Programming' anyway. There's no such thing as a 'General Tip'. There is no /bin/general. Find the right niche for those.&lt;br /&gt;
&lt;br /&gt;
That leaves 'X Window System' itself, and 'Configuring X'. So merge a generic 'Configuration' section into a general 'X Window System' and turn the 'Applications' entry into a single line.&lt;br /&gt;
&lt;br /&gt;
Then create a reference structure where the key 'Installing nVidia drivers' stuff is linked to the generic 'X Window System' under the 'Video' section or whatever.&lt;br /&gt;
&lt;br /&gt;
Kind of like how [[Security]] is, but with explanatory text knitting together the link sections. Or something.&lt;br /&gt;
&lt;br /&gt;
Or not. :)&lt;br /&gt;
&lt;br /&gt;
[[User:Digiot|Digiot]] 23:32, Mar 25, 2004 (EST)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Well I've tried what you suggested, I've moved/itegrated most of the content of this page to [[XFree86]] and linked to all the other related pages there. I'm still not sure if I like it on 1 big page like this and what to do with distribution specific configuration. I'll just see and wait what happens with it and other big topics on this wiki. But this page itself should probably be deleted, or re-directed :/ [[User:Jor|Jor]] 15:17, Mar 29, 2004 (EST)&lt;br /&gt;
&lt;br /&gt;
: Looking at it, I'm not sure if I like it either. :) I touched it up a bit. Quite a bit could removed without actually removing any information. However, it's either got too much text for a links page or too many links for an actual article. That starts at XFree86, too. It seems like a double-approach would be best. We want people to hit the front page and check out applications, and then see X and then learn about XFree86 specifically, but still with an overview approach. And then specific links to specific things. That way it's hierarchical. But the wiki's not primarily a hierarchy in use, right? So if people are wandering around from link to link, they can ignore the top level pages and just get small solid articles. Maybe? So I like the idea of a few top level things being mostly link lists that people can follow 'down' to specific information - while the articles below that level all link to each other with details. So it's actually starting at the Applications page and working on down that could all be revised. Or just leave the whole thing alone. I agree with the wait and see. And maybe wait a bit before doing anything with this page, too. If it turns out it should be put back, it's only one thing to put back. [[User:Digiot|Digiot]] 18:08, Mar 29, 2004 (EST)&lt;br /&gt;
&lt;br /&gt;
--&lt;br /&gt;
&lt;br /&gt;
This page is pretty specific to [[XFree86]].  How long until someone takes a look at x.org [http://www.x.org/] and writes configuration instructions for it?  Many new linux releases are using it.  I'm willing to do it, but it won't be until early July.  --[[User:Snags|Snags]] 11:17, Jun 17, 2004 (EDT)&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Umount&amp;diff=9844</id>
		<title>Umount</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Umount&amp;diff=9844"/>
		<updated>2004-06-11T20:50:29Z</updated>

		<summary type="html">&lt;p&gt;Snags: Link manpage&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''umount''' (''not'' &amp;quot;u'''n'''mount&amp;quot;) detaches a volume from the file hierarchy - unmounting it. For example, if /dev/hdc1 is mounted as /mnt/onedisk then you will be able to browse the contents of hdc1 as though it were just another directory. However, once you &amp;quot;umount&amp;quot; it, it will appear devoid of content. It doesn't mean that there isn't anything on hdc1 - it just means that the kernel is no longer associating /mnt/onedisk with hdc1. This can be remedied by using [[mount]] to restore this association.&lt;br /&gt;
&lt;br /&gt;
A common issue when attempting to unmount devices currently mounted is that umount will refuse, stating that the device is currently busy. One must close the file in all the processes that are using the device (that is, accessing files or using the device directly).  If you don't know what is using the device, see [[lsof]]. Alternatively, if the device is mounted in the filesystem, and you are currently in that filesystem, simply changing directory first will often allow umount to do its work.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--One of the funnier things I've seen lately, paraphrasing from /.: 'why the *bleep* is it 'umount'? Do I really get such a benefit from not typing the 'n'? Well then what's with the other one? Why the *bleep* isn't it 'umout' then?' A parallel case with 'creat()' - why not 'crat()'?--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
&lt;br /&gt;
*[http://man.linuxquestions.org/index.php?query=umount&amp;amp;section=0&amp;amp;type=2 umount man page]&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Ipchains&amp;diff=10315</id>
		<title>Ipchains</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Ipchains&amp;diff=10315"/>
		<updated>2004-06-02T19:05:29Z</updated>

		<summary type="html">&lt;p&gt;Snags: Mention iptables, wikify stub message, minor edits.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Ipchains''' is the older firewalling ruleset for linux.  Ipchains operates by ''chaining'' rules together in order to create a comprehensive ruleset.  Ipchains is usually initialized with the system V style [[init]] scripts in the &amp;lt;tt&amp;gt;/etc/init.d&amp;lt;/tt&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
Users of kernels from 2.4 on are encouraged to use [[iptables]] instead.&lt;br /&gt;
&lt;br /&gt;
{{msg:stub}}&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Md5sum&amp;diff=14038</id>
		<title>Md5sum</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Md5sum&amp;diff=14038"/>
		<updated>2004-05-31T17:28:34Z</updated>

		<summary type="html">&lt;p&gt;Snags: Expand article, link manpage.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''md5sum''' is a program for verifying that contents of a file have been exactly reproduced without having access to the original file.  It is often used for large files like [[ISO]] images that must be verified before they are used.  A large number called the MD5 checksum (MD5sum) is calculated from the file's contents in a reproducible way that, with extremely high probability, will never produce the same MD5sum for different files.  The user compares the MD5sum of the downloaded file to that obtained separately from the original source.&lt;br /&gt;
&lt;br /&gt;
The algorithm is designed to make it difficult to tamper with the file while still producing the same MD5sum for the tampered file.  If two instances of a file have the same MD5sum, the user is assured that the instances are identical.  If one is the official version, so is the other.&lt;br /&gt;
&lt;br /&gt;
To compute the MD5sum of a file (e.g., tmp.iso) and display it as a [[hex]] number, execute the command:&lt;br /&gt;
 $ md5sum tmp.iso&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
&lt;br /&gt;
*[http://man.linuxquestions.org/index.php?query=md5sum&amp;amp;section=0&amp;amp;type=2 md5sum man page]&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Process&amp;diff=11067</id>
		<title>Process</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Process&amp;diff=11067"/>
		<updated>2004-05-26T19:35:14Z</updated>

		<summary type="html">&lt;p&gt;Snags: Link top, move a sentence&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A '''process''' is one program that a multi-processing computer system is running.  &lt;br /&gt;
Other words meaning basically the same thing are ''job'' and ''task''.  Generally, each running program is contained in one process.  Some complex programs split their work into multiple processes, each of which contains a small part of the program that performs a specific task.&lt;br /&gt;
&lt;br /&gt;
The [[ps]] command is used to list processes on Linux systems.  The [[top]] command provides a continuously updating list of processes with some resource information at the top of the screen.  The list of all processes with parent/child relationships can be displayed with [[pstree]].  The [[jobs]] command lists the [[background]] processes created by the current shell.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;[[fork]]()&amp;lt;/tt&amp;gt; system call is used to create new processes.  When this is done, the new process is a ''child'' of the old process, which is the ''parent''.  A [[daemon]] process ''reparents'' itself to be a child of [[init]], so even if the (former) parent quits, the daemon keeps running.&lt;br /&gt;
&lt;br /&gt;
''This article is a [[LinuxQuestions.org_Wiki:stub_articles|stub]] and needs to be finished. [[LinuxQuestions.org_Wiki:plunging_forward|Plunge forward]] and [[LinuxQuestions.org_Wiki:How_to_edit_a_page|help it grow]] !''&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Xv&amp;diff=10653</id>
		<title>Xv</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Xv&amp;diff=10653"/>
		<updated>2004-05-19T21:03:10Z</updated>

		<summary type="html">&lt;p&gt;Snags: Merge in content of XV&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''xv''' is a small but powerful image viewing program for the [[X Window System]] with some abilities to make manipulations and conversions.  It is freely available, though not [[GPL]].  It can operate on images in the GIF, JPEG, TIFF, PBM, PGM, PPM, XPM, X11 bitmap, Sun Rasterfile, Targa, RLE, RGB, BMP, PCX, FITS, and PM formats on all known types of X displays.&lt;br /&gt;
&lt;br /&gt;
xv will run on any system that has the Gnu C Compiler, [[GCC]] as xv is distributed as source.  When installing &amp;lt;tt&amp;gt;xv&amp;lt;/tt&amp;gt; it is important to apply all of the [[patch]]es before [[compile|compiling]].&lt;br /&gt;
&lt;br /&gt;
xv can do a lot with the image such as adjust hue and brightness, magnify any portion of the image, grab any rectangular portion of your screen and turn into an image, ie, it is also a screen capture tool, among other things.&lt;br /&gt;
&lt;br /&gt;
=How to use &amp;lt;tt&amp;gt;xv&amp;lt;/tt&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
The right mouse button brings up the &amp;lt;tt&amp;gt;xv&amp;lt;/tt&amp;gt; controls dialog box.&lt;br /&gt;
&lt;br /&gt;
=Hints and Tips=&lt;br /&gt;
&lt;br /&gt;
* When saving an image, make sure to check the &amp;quot;Normal Size&amp;quot; box in the save dialog, unless you want the image resized to fit on the screen.&lt;br /&gt;
&lt;br /&gt;
=External links=&lt;br /&gt;
&lt;br /&gt;
*[http://www.trilon.com/xv/ Jon's World of XV 'n' Stuff] - from the author&lt;br /&gt;
*[http://www.trilon.com/xv/manual/xv-3.10a/cover.html xv online manual]&lt;br /&gt;
&lt;br /&gt;
{{msg:stub}}&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=XV&amp;diff=21854</id>
		<title>XV</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=XV&amp;diff=21854"/>
		<updated>2004-05-19T21:03:05Z</updated>

		<summary type="html">&lt;p&gt;Snags: Redirect to xv&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[xv]]&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=PDF&amp;diff=8954</id>
		<title>PDF</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=PDF&amp;diff=8954"/>
		<updated>2004-05-17T13:19:37Z</updated>

		<summary type="html">&lt;p&gt;Snags: =Programs that support PDF=&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''PDF''' ('''P'''ortable '''D'''ocument '''F'''ormat) is a file format with the same [[file extension]] to identify it.&lt;br /&gt;
&lt;br /&gt;
PDF's are extremely widely used for online copies of print documentation and can have digital rights management, which may contribute to its popularity with some distributors.&lt;br /&gt;
&lt;br /&gt;
As this file format can have pictures embedded in it, it is common for people to scan documents and place the picture in a PDF file, as it will be printed consistently when this is done.&lt;br /&gt;
&lt;br /&gt;
==Programs that support PDF==&lt;br /&gt;
* [[OpenOffice.org]] - can output to PDF&lt;br /&gt;
* [[kprinter]] - can make your files in any application be printed to PDF&lt;br /&gt;
* [[ghostscript]]&lt;br /&gt;
* [[ghostview]]&lt;br /&gt;
* [[kpdf]]&lt;br /&gt;
* [[imagemagick]] - lets you treat them as a picture&lt;br /&gt;
* [[acroread]] - Adobe Acrobat Reader for Linux.  Allows conversion to [[PostScript]].&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
* [http://www.adobe.com Adobe.com]&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Ulimit&amp;diff=8713</id>
		<title>Ulimit</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Ulimit&amp;diff=8713"/>
		<updated>2004-05-07T14:20:18Z</updated>

		<summary type="html">&lt;p&gt;Snags: Mention that it's builtin&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''ulimit''' is a [[builtin]] [[command]] used to show and set various restrictions on resource usage for a shell.  Among the limitations that can be set you find, maximum file size, maximum core file size, maximum size of resident memory.  Though the restrictions are shell-independent, the exact syntax depends on what [[shell]] you are running.&lt;br /&gt;
&lt;br /&gt;
It's a good practice to set some of these limitations to prevent for instance a faulty shell script to start unlimited copies of it self or to prevent users on the system to start processes that run forever.&lt;br /&gt;
&lt;br /&gt;
{{msg:stub}}&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Xv&amp;diff=9013</id>
		<title>Xv</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Xv&amp;diff=9013"/>
		<updated>2004-05-05T18:25:07Z</updated>

		<summary type="html">&lt;p&gt;Snags: Create article.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''xv''' is a small but powerful image viewing program with some abilities to make modifications and conversions.  It is freely available, though not [[GPL]].  When installing &amp;lt;tt&amp;gt;xv&amp;lt;/tt&amp;gt; it is important to apply all of the [[patch]]es before [[compile|compiling]].&lt;br /&gt;
&lt;br /&gt;
=How to use &amp;lt;tt&amp;gt;xv&amp;lt;/tt&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
The right mouse button brings up the &amp;lt;tt&amp;gt;xv&amp;lt;/tt&amp;gt; controls dialog box.&lt;br /&gt;
&lt;br /&gt;
=Hints and Tips=&lt;br /&gt;
&lt;br /&gt;
* When saving an image, make sure to check the &amp;quot;Normal Size&amp;quot; box in the save dialog, unless you want the image resized to fit on the screen.&lt;br /&gt;
&lt;br /&gt;
=External links=&lt;br /&gt;
&lt;br /&gt;
*[http://www.trilon.com/xv/ Jon's World of XV 'n' Stuff] - from the author&lt;br /&gt;
*[http://www.trilon.com/xv/manual/xv-3.10a/cover.html xv online manual]&lt;br /&gt;
&lt;br /&gt;
{{msg:stub}}&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Viewing_files&amp;diff=8594</id>
		<title>Viewing files</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Viewing_files&amp;diff=8594"/>
		<updated>2004-05-05T14:30:09Z</updated>

		<summary type="html">&lt;p&gt;Snags: Create article.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There's more than one way to skin a cat.  And there's more than one way to view a file.  Here are a few file viewing methods for the arsenal.&lt;br /&gt;
&lt;br /&gt;
=Text Files=&lt;br /&gt;
Most linux programs use text files for input, output, and configuration.  Being able to view them easily is vital to using the system.  Of course, any [[editor]] can also be used to view files.&lt;br /&gt;
&lt;br /&gt;
==Command-line ([[terminal]]) programs==&lt;br /&gt;
* [[cat]] - Displays the entire contents of a set of files to the screen.&lt;br /&gt;
* [[head]] - Displays the top few lines of a file.&lt;br /&gt;
* [[tail]] - Displays the last few lines of a file.&lt;br /&gt;
* [[less]] - Displays a file page-by-page.&lt;br /&gt;
* [[grep]] - Displays selected lines of input files.&lt;br /&gt;
&lt;br /&gt;
==Graphical ([[X|X windows]]) programs==&lt;br /&gt;
* [[xterm]] - Call with &amp;lt;tt&amp;gt;xterm -e less ''filename''&amp;lt;/tt&amp;gt; for a quick-and-dirty, [[portable]] file viewer.&lt;br /&gt;
* [[emacs]] - In emacs, the &amp;lt;tt&amp;gt;Ctrl-X Ctrl-Q&amp;lt;/tt&amp;gt; sequence write-protects a buffer, if it isn't already.  A percent sign (%) is displayed in the mode line (status bar) for protected buffers.&lt;br /&gt;
&lt;br /&gt;
=Graphics Files=&lt;br /&gt;
These include bmp, gif, [[JPEG]], tiff, pcx, [[PNG]], and countless other formats.&lt;br /&gt;
&lt;br /&gt;
* [[xv]]&lt;br /&gt;
* [[ImageMagick|display]] - part of ImageMagick&lt;br /&gt;
* [[eog]] - Eye of [[gnome]]&lt;br /&gt;
&lt;br /&gt;
=Video Files=&lt;br /&gt;
* [[xanim]]&lt;br /&gt;
&lt;br /&gt;
=Other Files=&lt;br /&gt;
* Compressed files of various kinds can be viewed with the methods listed in [[Uncompressing files]]&lt;br /&gt;
* [[PDF]] files can be viewed with [[acroread]], [[xpdf]], or [[gv]].&lt;br /&gt;
* [[Postscript]] files can be viewed with [[gv]].&lt;br /&gt;
* MSWord files (probably [[email]]ed from [[Windows]] users) can be viewed with [[OpenOffice]], but it may be better to just bite the bullet and use MSWord for real somehow.&lt;br /&gt;
&lt;br /&gt;
{{msg:stub}}&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Common_Tasks&amp;diff=9140</id>
		<title>Common Tasks</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Common_Tasks&amp;diff=9140"/>
		<updated>2004-05-05T14:30:04Z</updated>

		<summary type="html">&lt;p&gt;Snags: New common task: viewing files =Productivity=&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Desktop Linux is still under heavy development. While we all wish Linux was so intuitive nobody needed instructions, currently that isn't always the case. This section is meant for '''notes and quick guides''' on how to perform common tasks on Linux. &lt;br /&gt;
&lt;br /&gt;
If a section isn't yet written and you are able to write it, please do so!&lt;br /&gt;
&lt;br /&gt;
== General user tasks ==&lt;br /&gt;
&lt;br /&gt;
===Productivity===&lt;br /&gt;
* [[Browsing tasks]] - browsing the WWW and downloading safely&lt;br /&gt;
* [[Burning a CDROM]] - some pointers on how to write CDs.&lt;br /&gt;
* [[Emailing tasks]] - sending and receiving emails, setting up different mail applications&lt;br /&gt;
* [[Office tasks]] - word processing, spreadsheet, presentation, image manipulation and other&lt;br /&gt;
* [[Scanning]] - use a [[Scanner]] to convert you paper documents or images to an electronic format&lt;br /&gt;
* [[Viewing files]] - various ways to view the contents of files&lt;br /&gt;
&lt;br /&gt;
===Fun===&lt;br /&gt;
* [[Gaming]] - pass some time ''not'' working&lt;br /&gt;
* [[Multimedia tasks]] - listen to music, extract CDs, watch videos and DVDs&lt;br /&gt;
* [[Talking to friends online]] - how to access common instant messaging networks, see also [[IM]].&lt;br /&gt;
&lt;br /&gt;
===Technical===&lt;br /&gt;
* [[Command Line User Interface]] - Techniques for better experience&lt;br /&gt;
* [[Connecting to the net]] -  using your modem/network connection to get online&lt;br /&gt;
* [[GRUB Menu]] - Single Task - Removing  old kernel entries from your GRUB Menu boot up selections.&lt;br /&gt;
* [http://home.gagme.com/greg/linux/usbcamera.php How to Connect a Digital Camera to Linux (outside link)] - an excellent how-to on connecting digital cameras to Linux.&lt;br /&gt;
* [[Installing Software]] - how to find and manage additional software on a running Linux system&lt;br /&gt;
* [[Installing Windows fonts]] - installing your Windows fonts so they work with your Linux install.&lt;br /&gt;
* [[screenshots|Taking screenshots]] - You want to show somebody your desktop? There are tools that will help you make a [[screenshots | screenshot]] and [[record your desktop]] so that you can send movie-files of how nice your desktop looks.&lt;br /&gt;
&lt;br /&gt;
== Power user tasks ==&lt;br /&gt;
&lt;br /&gt;
* [[Compiling a Kernel]] - here is a guide for compiling a kernel&lt;br /&gt;
* [[Configure Storage Devices]] - how to partition a hard drive, add a new hard drive, use software RAID, or use LVM (logical volume management).&lt;br /&gt;
* [[Getting help from IRC]] - LinuxQuestions is a great forum, but it isn't the only one. If you know how, the IRC chat networks can also be a useful resource.&lt;br /&gt;
* [[GRUB boot menu]] - Configuration Guide.&lt;br /&gt;
* [[Installing NVIDIA drivers]] - Information on installing the newer (but closed-source) drivers released by NVIDIA. These drivers are sometimes required to run some games, like Unreal or Quake.&lt;br /&gt;
* [[Recover a Terminal Session]] - What to do if your screen's garbaged.&lt;br /&gt;
* [[Remote_Desktop_Connection|Access your System Remotely]] - Access your Linux system from another computer (running Linux, or some other OS) or use your Linux box to access another computer (running Linux, or some other OS).&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[Distro specific tips &amp;amp; tricks]]&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=System_information&amp;diff=15492</id>
		<title>System information</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=System_information&amp;diff=15492"/>
		<updated>2004-05-05T14:01:17Z</updated>

		<summary type="html">&lt;p&gt;Snags: Links, minor changes =Disk and File System Diagnostic Tools/Utilities=&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are several ways to gather '''system information'''. It is a good idea to keep abreast of your machine's utilization and capacities.&lt;br /&gt;
&lt;br /&gt;
==Tips==&lt;br /&gt;
===General System Information Tools/Utilities===&lt;br /&gt;
*&amp;lt;tt&amp;gt;[[uname]] -a&amp;lt;/tt&amp;gt; -- brief OS and kernel information.&lt;br /&gt;
*&amp;lt;tt&amp;gt;[[dmesg]]&amp;lt;/tt&amp;gt; -- kernel messages given during booting.&lt;br /&gt;
*&amp;lt;tt&amp;gt;cat /var/log/messages&amp;lt;/tt&amp;gt; -- is the same as &amp;lt;tt&amp;gt;dmesg&amp;lt;/tt&amp;gt;&lt;br /&gt;
*&amp;lt;tt&amp;gt;tail -f /var/log/messages&amp;lt;/tt&amp;gt; -- show the last couple of lines an keep outputting new lines&lt;br /&gt;
&lt;br /&gt;
===Memory Diagnostic Tools/Utilities===&lt;br /&gt;
*&amp;lt;tt&amp;gt;cat /proc/meminfo&amp;lt;/tt&amp;gt; -- static information about your [[RAM]]&lt;br /&gt;
*&amp;lt;tt&amp;gt;top&amp;lt;/tt&amp;gt; -- [[real-time]] RAM and [[CPU]] utilization printout&lt;br /&gt;
*&amp;lt;tt&amp;gt;[[free (command)|free]]&amp;lt;/tt&amp;gt; -- Current memory/swap utilization.&lt;br /&gt;
&lt;br /&gt;
===CPU Diagnostic Tools/Utilities===&lt;br /&gt;
*&amp;lt;tt&amp;gt;cat /proc/cpuinfo&amp;lt;/tt&amp;gt; -- static information about your [[cpu]]&lt;br /&gt;
&lt;br /&gt;
===Disk and File System Diagnostic Tools/Utilities===&lt;br /&gt;
*&amp;lt;tt&amp;gt;[[df]] -h&amp;lt;/tt&amp;gt; -- current disk space usage (&amp;quot;-h&amp;quot; gives human-readable output)&lt;br /&gt;
*&amp;lt;tt&amp;gt;[[du]] -h&amp;lt;/tt&amp;gt; -- determine how much disk space is being used by [[Cwd]], or any directory you specify after the du command (as in df, the &amp;quot;-h&amp;quot; means human-readable)&lt;br /&gt;
*&amp;lt;tt&amp;gt;[[mount]]&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;cat /etc/mtab&amp;lt;/tt&amp;gt; -- show currently mounted file systems.&lt;br /&gt;
*&amp;lt;tt&amp;gt;[[cat]] /etc/fstab&amp;lt;/tt&amp;gt; -- show configuration file for file system mounting.&lt;br /&gt;
*&amp;lt;tt&amp;gt;[[fdisk]] -l [/dev/hda]&amp;lt;/tt&amp;gt; -- show partition table(s), leave off device name to list all&lt;br /&gt;
&lt;br /&gt;
===Local Devices Diagnostic Tools/Utilities===&lt;br /&gt;
*&amp;lt;tt&amp;gt;[[lspci]]&amp;lt;/tt&amp;gt; -- list devices on the pci bus.&lt;br /&gt;
&lt;br /&gt;
===Kernel and Kernel Module Diagnostic Tools/Utilities===&lt;br /&gt;
*&amp;lt;tt&amp;gt;[[lsmod]]&amp;lt;/tt&amp;gt; -- list kernel modules currently loaded.&lt;br /&gt;
&lt;br /&gt;
===Network Diagnostic Tools/Utilities===&lt;br /&gt;
*&amp;lt;tt&amp;gt;[[route]] -n&amp;lt;/tt&amp;gt; -- show routing table, using numerical addresses.&lt;br /&gt;
*&amp;lt;tt&amp;gt;ifconfig $interface&amp;lt;/tt&amp;gt; -- show the information for $interface (usually something like &amp;lt;tt&amp;gt;ifconfig eth0&amp;lt;/tt&amp;gt;)&lt;br /&gt;
*&amp;lt;tt&amp;gt;ifconfig -a&amp;lt;/tt&amp;gt; -- show all current network interface information&lt;br /&gt;
*&amp;lt;tt&amp;gt;ping $host&amp;lt;/tt&amp;gt; -- use [[ping]] to determine if $host is alive on the network (for troubleshooting your local machine $host can equal &amp;quot;[[127.0.0.1]]&amp;quot; or &amp;quot;[[localhost]]&amp;quot;&lt;br /&gt;
*&amp;lt;tt&amp;gt;Directory /proc/net/&lt;br /&gt;
**File arp: arp cache.  Maps IP address to MAC address&lt;br /&gt;
**File dev: byte and packet statistics on a per device basis.&lt;br /&gt;
**File netstat: various statistics&lt;br /&gt;
**File tcp: established connections.&lt;br /&gt;
*&amp;lt;tt&amp;gt;Directory /proc/sys/net/ipv4/&lt;br /&gt;
**File: ip_forward: read/write.  Whether or not the kernal will forward IP packets from one interface to another.  This is turned on if you want the machine to work as a router or a firewall.&lt;br /&gt;
If you want to set up a proxy firewall, this should be off, as it will be the application that forwards traffic, not the kernal.&lt;br /&gt;
**File: ip_local_port_range: read/write.  The range of ports that are used as source ports for outgoing connections.&lt;br /&gt;
**File: tcp_sack: read/write.  Whether or not TCP connections use selective acknowledgement.  One=yes, zero=no.&lt;br /&gt;
**File: tcp_timestamps: read/write.  Whether or not TCP connections add timestamps to their connections.  One=yes, zero=no.&lt;br /&gt;
&lt;br /&gt;
===X-Windows Troubleshooting Tools/Utilities===&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;tt&amp;gt;cat /var/log/XFree86.0.log&amp;lt;/tt&amp;gt; -- print out the XFree86 error log. **Note that some systems do not store this log in /var/log. Use either &amp;lt;tt&amp;gt;locate XFree86.0.log&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt; find / -name XFree86.0.log&amp;lt;/tt&amp;gt; to find it.&lt;br /&gt;
* &amp;lt;tt&amp;gt;[[glxinfo]]&amp;lt;/tt&amp;gt; -- show the status of your [[OpenGL]] subsystem.&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=System_information&amp;diff=8575</id>
		<title>System information</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=System_information&amp;diff=8575"/>
		<updated>2004-05-05T13:57:02Z</updated>

		<summary type="html">&lt;p&gt;Snags: Link to free (command) =Memory Diagnostic Tools/Utilities=&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are several ways to gather '''system information'''. It is a good idea to keep abreast of your machine's utilization and capacities.&lt;br /&gt;
&lt;br /&gt;
==Tips==&lt;br /&gt;
===General System Information Tools/Utilities===&lt;br /&gt;
*&amp;lt;tt&amp;gt;[[uname]] -a&amp;lt;/tt&amp;gt; -- brief OS and kernel information.&lt;br /&gt;
*&amp;lt;tt&amp;gt;[[dmesg]]&amp;lt;/tt&amp;gt; -- kernel messages given during booting.&lt;br /&gt;
*&amp;lt;tt&amp;gt;cat /var/log/messages&amp;lt;/tt&amp;gt; -- is the same as &amp;lt;tt&amp;gt;dmesg&amp;lt;/tt&amp;gt;&lt;br /&gt;
*&amp;lt;tt&amp;gt;tail -f /var/log/messages&amp;lt;/tt&amp;gt; -- show the last couple of lines an keep outputting new lines&lt;br /&gt;
&lt;br /&gt;
===Memory Diagnostic Tools/Utilities===&lt;br /&gt;
*&amp;lt;tt&amp;gt;cat /proc/meminfo&amp;lt;/tt&amp;gt; -- static information about your [[RAM]]&lt;br /&gt;
*&amp;lt;tt&amp;gt;top&amp;lt;/tt&amp;gt; -- [[real-time]] RAM and [[CPU]] utilization printout&lt;br /&gt;
*&amp;lt;tt&amp;gt;[[free (command)|free]]&amp;lt;/tt&amp;gt; -- Current memory/swap utilization.&lt;br /&gt;
&lt;br /&gt;
===CPU Diagnostic Tools/Utilities===&lt;br /&gt;
*&amp;lt;tt&amp;gt;cat /proc/cpuinfo&amp;lt;/tt&amp;gt; -- static information about your [[cpu]]&lt;br /&gt;
&lt;br /&gt;
===Disk and File System Diagnostic Tools/Utilities===&lt;br /&gt;
*&amp;lt;tt&amp;gt;df -h&amp;lt;/tt&amp;gt; -- current disk space usage (&amp;quot;-h&amp;quot; gives human-readable output)&lt;br /&gt;
*&amp;lt;tt&amp;gt;du -h&amp;lt;/tt&amp;gt; -- determine how much disk space is being used by [[CWD]], or any directory you specify after the du command (as in df, the &amp;quot;-h&amp;quot; means human-readable)&lt;br /&gt;
*&amp;lt;tt&amp;gt;cat /etc/mtab&amp;lt;/tt&amp;gt; -- show currently mounted file systems.&lt;br /&gt;
*&amp;lt;tt&amp;gt;cat /etc/fstab&amp;lt;/tt&amp;gt; -- show configuration file for file system mounting.&lt;br /&gt;
*&amp;lt;tt&amp;gt;[[fdisk]] -l /dev/hda&amp;lt;/tt&amp;gt; (or whatever disk you want information on) -- show partition table for &amp;lt;tt&amp;gt;/dev/hda&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Local Devices Diagnostic Tools/Utilities===&lt;br /&gt;
*&amp;lt;tt&amp;gt;[[lspci]]&amp;lt;/tt&amp;gt; -- list devices on the pci bus.&lt;br /&gt;
&lt;br /&gt;
===Kernel and Kernel Module Diagnostic Tools/Utilities===&lt;br /&gt;
*&amp;lt;tt&amp;gt;[[lsmod]]&amp;lt;/tt&amp;gt; -- list kernel modules currently loaded.&lt;br /&gt;
&lt;br /&gt;
===Network Diagnostic Tools/Utilities===&lt;br /&gt;
*&amp;lt;tt&amp;gt;[[route]] -n&amp;lt;/tt&amp;gt; -- show routing table, using numerical addresses.&lt;br /&gt;
*&amp;lt;tt&amp;gt;ifconfig $interface&amp;lt;/tt&amp;gt; -- show the information for $interface (usually something like &amp;lt;tt&amp;gt;ifconfig eth0&amp;lt;/tt&amp;gt;)&lt;br /&gt;
*&amp;lt;tt&amp;gt;ifconfig -a&amp;lt;/tt&amp;gt; -- show all current network interface information&lt;br /&gt;
*&amp;lt;tt&amp;gt;ping $host&amp;lt;/tt&amp;gt; -- use [[ping]] to determine if $host is alive on the network (for troubleshooting your local machine $host can equal &amp;quot;[[127.0.0.1]]&amp;quot; or &amp;quot;[[localhost]]&amp;quot;&lt;br /&gt;
*&amp;lt;tt&amp;gt;Directory /proc/net/&lt;br /&gt;
**File arp: arp cache.  Maps IP address to MAC address&lt;br /&gt;
**File dev: byte and packet statistics on a per device basis.&lt;br /&gt;
**File netstat: various statistics&lt;br /&gt;
**File tcp: established connections.&lt;br /&gt;
*&amp;lt;tt&amp;gt;Directory /proc/sys/net/ipv4/&lt;br /&gt;
**File: ip_forward: read/write.  Whether or not the kernal will forward IP packets from one interface to another.  This is turned on if you want the machine to work as a router or a firewall.&lt;br /&gt;
If you want to set up a proxy firewall, this should be off, as it will be the application that forwards traffic, not the kernal.&lt;br /&gt;
**File: ip_local_port_range: read/write.  The range of ports that are used as source ports for outgoing connections.&lt;br /&gt;
**File: tcp_sack: read/write.  Whether or not TCP connections use selective acknowledgement.  One=yes, zero=no.&lt;br /&gt;
**File: tcp_timestamps: read/write.  Whether or not TCP connections add timestamps to their connections.  One=yes, zero=no.&lt;br /&gt;
&lt;br /&gt;
===X-Windows Troubleshooting Tools/Utilities===&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;tt&amp;gt;cat /var/log/XFree86.0.log&amp;lt;/tt&amp;gt; -- print out the XFree86 error log. **Note that some systems do not store this log in /var/log. Use either &amp;lt;tt&amp;gt;locate XFree86.0.log&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt; find / -name XFree86.0.log&amp;lt;/tt&amp;gt; to find it.&lt;br /&gt;
* &amp;lt;tt&amp;gt;[[glxinfo]]&amp;lt;/tt&amp;gt; -- show the status of your [[OpenGL]] subsystem.&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Bash_tips&amp;diff=10099</id>
		<title>Bash tips</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Bash_tips&amp;diff=10099"/>
		<updated>2004-05-04T14:03:13Z</updated>

		<summary type="html">&lt;p&gt;Snags: Quoting&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==== Some General Comments ====&lt;br /&gt;
If you type in a rather long and complex [[command]] at the [[command line]], you might want to save that command in a [[text file]], so you can execute it later without having to type the whole long thing in again. If you add a line to the beginning of that file, like &amp;quot;&amp;lt;tt&amp;gt;#!/bin/bash&amp;lt;/tt&amp;gt;&amp;quot; (a so-called &amp;quot;[[shebang]]&amp;quot; line), and then make the file executable with the &amp;lt;tt&amp;gt;[[chmod]]&amp;lt;/tt&amp;gt; command, you've just created a shell script.&lt;br /&gt;
&lt;br /&gt;
Here's an example shell script:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# Any line that starts with a hash, besides the shebang line, is a comment.&lt;br /&gt;
echo &amp;quot;Hello world!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You run the [[shell script]] just like any other [[executable]]. Some folks create a &amp;lt;tt&amp;gt;bin&amp;lt;/tt&amp;gt; directory in their home directory within which to place their scripts. Others drop them in &amp;lt;tt&amp;gt;/usr/local/bin&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Some key points to keep in mind about shell scripts:&lt;br /&gt;
* They execute their commands, line by line, just as if you'd typed them in yourself at the command line.&lt;br /&gt;
* The commands in the script run in a [[subshell]] of the shell from which you executed the script.&lt;br /&gt;
* If you want the script to affect your [[pwd|present working directory]] or [[environment variables]], source it with &amp;lt;tt&amp;gt;.&amp;amp;nbsp;scriptname&amp;lt;/tt&amp;gt;.&lt;br /&gt;
* Don't put spaces around equal signs.&lt;br /&gt;
&lt;br /&gt;
You could check out the [[bash]] page and you'll also find lots of info in the [http://www.tldp.org/LDP/abs/html Advanced Bash-Scripting Guide].&lt;br /&gt;
&lt;br /&gt;
Enjoy!&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
====Using quotes====&lt;br /&gt;
&lt;br /&gt;
Quotation marks, either double quotes (&amp;quot;) or single quotes ('), are often needed in shell scripts to pass arguments that have spaces or other special characters.  The two quotes have slightly different meanings.  Single quotes protect the exact text they enclose.&lt;br /&gt;
&lt;br /&gt;
Inside double quotes, the dollar sign ($) is still special, so shell variables and other $ expressions are interpreted, as is the backquote (`) used for command substitution.  Lastly, the backslash (\) is special in double quotes, so be cautious.  Some examples and the shell output of each:&lt;br /&gt;
&lt;br /&gt;
 $ echo 'The location of the shell is stored in $BASH'&lt;br /&gt;
 The location of the shell is stored in $BASH&lt;br /&gt;
 $ echo &amp;quot;The location of the shell is $BASH&amp;quot;&lt;br /&gt;
 The location of the shell is /bin/bash&lt;br /&gt;
 $ echo '\'&lt;br /&gt;
 \\&lt;br /&gt;
 $ echo &amp;quot;\\&amp;quot;&lt;br /&gt;
 \&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
==== Get your IP address====&lt;br /&gt;
&lt;br /&gt;
A [[bash]] example to get your IP address using http://www.whatismyip.com:&amp;lt;br /&amp;gt;&lt;br /&gt;
 lynx -dump http://www.whatismyip.com | awk '/^Your IP is/ { print $4; }' &lt;br /&gt;
&lt;br /&gt;
Or use this:&amp;lt;br&amp;gt;&lt;br /&gt;
 /sbin/ifconfig ppp0 | awk '/inet/{ printf(&amp;quot;%s\n&amp;quot;, substr($2,index($2,&amp;quot;:&amp;quot;)+1)) }'&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that ppp0 stands for the first point-to-point-protocol device which is usually a modem. If you are using an ethernet adapter instead, replace ppp0 with eth0. You can also leave it out all together to list all the addresses associated with your computer.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
====Some counting examples====&lt;br /&gt;
 x=0; ((x++))&lt;br /&gt;
 x=0; x=$((x+1))&lt;br /&gt;
 x=0; let x=$x+1&lt;br /&gt;
 for (( x=0; x&amp;lt;10; x++ )) ; do echo $x ; done&lt;br /&gt;
&lt;br /&gt;
 for x in `seq 0 9`; do echo $x; done &lt;br /&gt;
 x=0; x=$(expr $x + 1) &lt;br /&gt;
 x=0; x=$(echo $x + 1|bc)&lt;br /&gt;
 x=4; x=$(echo scale=5\; $x / 3.14|bc)&lt;br /&gt;
&lt;br /&gt;
The first four demonstrate Bash' internal counting mechanisms, these will not use external programs and are thus safe (and fast).&lt;br /&gt;
The last four use external programs. [[bc]], as used in the last two examples, is the only one that supports numbers with decimals. For adding, subtracting and multiplying, you don't have to do anything special, but for division you need to specify the number of digits to keep (default is none) using the 'scale=n' line. &lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
====Combining multiple conditions of if statements====&lt;br /&gt;
AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if(a==1 &amp;amp;&amp;amp; b==2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
OR:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if(( a==1|2|3 ))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
====Renaming a set of files====&lt;br /&gt;
&lt;br /&gt;
 $ for f in ''filelist'' ... ; do mv $f ${f/''oldname''/''newname''} ; done&lt;br /&gt;
&lt;br /&gt;
Double quotes should be used around &amp;lt;tt&amp;gt;$f&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;${f...}&amp;lt;/tt&amp;gt; constructions if any of the filenames contain spaces.  [[mmv]] is a really nifty tool for doing this sort of thing more flexibly too.  The [[rename]] command also provides similar functionality, depending on your linux [[distribution]].&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
====Extracting addresses from a mailbox file====&lt;br /&gt;
This statement will pull out everything that looks like an e-mail address from a mailbox file  (here called ''foo''), and sort them into alphabetical order.&lt;br /&gt;
  awk '!/essage-[iI][dD]/ &amp;amp;amp;&amp;amp;amp; !/MAILER-DAEMON/ {&lt;br /&gt;
    if (match($0, /([A-Za-z][A-Za-z0-9._-]*@[A-Za-z0-9._-]+)/))&lt;br /&gt;
      print substr($0, RSTART, RLENGTH); }' ''foo'' |sort |uniq&lt;br /&gt;
The &amp;lt;tt&amp;gt;awk&amp;lt;/tt&amp;gt; script works as follows.  If the line is not a message-id header, does not mention &amp;quot;MAILER-DAEMON&amp;quot;, and has something in it that looks like an email address, then the address-like portion is extracted and printed.&lt;br /&gt;
The output from &amp;lt;tt&amp;gt;awk&amp;lt;/tt&amp;gt; is sorted alphabetically by &amp;lt;tt&amp;gt;sort&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;uniq&amp;lt;/tt&amp;gt; deletes repetitions.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
====Converting several wav files to mp3====&lt;br /&gt;
This statement will convert all .wav files in a directory to mp3  (assuming you already have the [[http://lame.sourceforge.net/ lame]] package installed):&lt;br /&gt;
:&amp;lt;tt&amp;gt;for i in *.wav; do lame -h $i &amp;amp;amp;&amp;amp;amp; rm $i; done&amp;lt;/tt&amp;gt;&lt;br /&gt;
The double ampersand prevents rm from deleting files that weren't successfully converted.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
====Full file name====&lt;br /&gt;
Prints the full filename removing ./ and ../ and adding `pwd` if necessary. I keep this in a script called &amp;lt;tt&amp;gt;fqn&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# return the full filename, removing ./ ../ adding `pwd` if necessary&lt;br /&gt;
&lt;br /&gt;
FILE=&amp;quot;$1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# file		dot relative&lt;br /&gt;
# ./file	dot relative&lt;br /&gt;
# ../file	parent relative&lt;br /&gt;
# /file		absolute&lt;br /&gt;
while true; do&lt;br /&gt;
	case &amp;quot;$FILE&amp;quot; in&lt;br /&gt;
		( /* ) 		&lt;br /&gt;
		# Remove /./ inside filename:&lt;br /&gt;
		while echo &amp;quot;$FILE&amp;quot; |fgrep &amp;quot;/./&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; do&lt;br /&gt;
			FILE=`echo &amp;quot;$FILE&amp;quot; | sed &amp;quot;s/\\/\\.\\//\\//&amp;quot;`&lt;br /&gt;
		done&lt;br /&gt;
		# Remove /../ inside filename:&lt;br /&gt;
		while echo &amp;quot;$FILE&amp;quot; |grep &amp;quot;/[^/][^/]*/\\.\\./&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; do&lt;br /&gt;
			FILE=`echo &amp;quot;$FILE&amp;quot; | sed &amp;quot;s/\\/[^/][^/]*\\/\\.\\.\\//\\//&amp;quot;`&lt;br /&gt;
		done&lt;br /&gt;
		echo &amp;quot;$FILE&amp;quot;&lt;br /&gt;
		exit 0&lt;br /&gt;
		;;&lt;br /&gt;
		&lt;br /&gt;
		(*)&lt;br /&gt;
		FILE=`pwd`/&amp;quot;$FILE&amp;quot;&lt;br /&gt;
		;;&lt;br /&gt;
	esac&lt;br /&gt;
&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
====Resolving a link====&lt;br /&gt;
This little script follows symbolic links wherever they may lead and prints the ultimate filename (if it exists!) (note - it uses the previous script accessed as &amp;lt;tt&amp;gt;fqn&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# prints the real file pointed to by a link&lt;br /&gt;
# usage: $0 link&lt;br /&gt;
&lt;br /&gt;
ORIG_LINK=&amp;quot;$1&amp;quot;&lt;br /&gt;
LINK=`fqn &amp;quot;$1&amp;quot;`&lt;br /&gt;
while [ -h &amp;quot;$LINK&amp;quot; ]; do&lt;br /&gt;
	DIR=`dirname &amp;quot;$LINK&amp;quot;`&lt;br /&gt;
&lt;br /&gt;
	# next link is everything from &amp;quot;-&amp;gt; &amp;quot;&lt;br /&gt;
	LINK=`ls -l &amp;quot;$LINK&amp;quot; |sed &amp;quot;s/^.*-&amp;gt; //&amp;quot;`&lt;br /&gt;
&lt;br /&gt;
	LINK=`cd &amp;quot;$DIR&amp;quot;; fqn &amp;quot;$LINK&amp;quot;`&lt;br /&gt;
	if [ ! -e &amp;quot;$LINK&amp;quot; ]; then&lt;br /&gt;
		echo &amp;quot;\&amp;quot;$ORIG_LINK\&amp;quot; is a broken link: \&amp;quot;$LINK\&amp;quot; does not exist&amp;quot; &amp;gt;&amp;amp;2&lt;br /&gt;
		exit 1&lt;br /&gt;
	fi&lt;br /&gt;
done&lt;br /&gt;
echo &amp;quot;$LINK&amp;quot;&lt;br /&gt;
exit 0&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
====Viewing a file according to its type====&lt;br /&gt;
I save this as a script called &amp;lt;tt&amp;gt;v&amp;lt;/tt&amp;gt; and it is my universal viewing script - it can be extended to any kind of file and to use your favourite tools for each type of file. It uses the &amp;lt;tt&amp;gt;file&amp;lt;/tt&amp;gt; utility to determine what sort of file it is and then invokes the correct tool. It automatically adapts to being used on the system console or under X.&lt;br /&gt;
&lt;br /&gt;
(note - this uses a prior script &amp;lt;tt&amp;gt;fqn&amp;lt;/tt&amp;gt;)&lt;br /&gt;
&amp;lt;tt&amp;gt;&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
# View files based on the type of the first one:&lt;br /&gt;
# Relies partly on 'less' to invoke an appropriate viewer.&lt;br /&gt;
# Make sure than you have this set:&lt;br /&gt;
# LESSOPEN=&amp;quot;|lesspipe.sh %s&amp;quot;&lt;br /&gt;
&lt;br /&gt;
FIRST=&amp;quot;$1&amp;quot;&lt;br /&gt;
FULL=`fqn $FIRST`&lt;br /&gt;
&lt;br /&gt;
# if we are being piped to, just run less&lt;br /&gt;
[ -z &amp;quot;$FIRST&amp;quot; -o ! -r &amp;quot;$FIRST&amp;quot; ] &amp;amp;&amp;amp; exec less &amp;quot;$@&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# some file types beyond what /usr/bin/lesspipe.sh handles:&lt;br /&gt;
case &amp;quot;$FIRST&amp;quot; in&lt;br /&gt;
  *.cpio.bz2) bunzip2 -c $1 | cpio -ctv 2&amp;gt;/dev/null |less; exit ;;&lt;br /&gt;
  *.cpio) cpio -ctv $1 2&amp;gt;/dev/null |less; exit;;&lt;br /&gt;
esac&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
TYPE=`file -L -i &amp;quot;$FIRST&amp;quot;  2&amp;gt;/dev/null | \&lt;br /&gt;
  awk '{len=length(&amp;quot;'&amp;quot;$FIRST&amp;quot;'&amp;quot;)+ 2; $0=substr($0, len); print $1;}'`&lt;br /&gt;
echo &amp;quot;Type=\&amp;quot;$TYPE\&amp;quot;&amp;quot;&lt;br /&gt;
case &amp;quot;$TYPE&amp;quot; in&lt;br /&gt;
    image/jpeg | image/tiff | image/gif | image/x-xpm | image/*)&lt;br /&gt;
        xzgv &amp;quot;$@&amp;quot; ;;&lt;br /&gt;
    application/pdf) &lt;br /&gt;
	XPDFGEOM=`xdpyinfo |awk '/dimensions/ {print $2}'| \&lt;br /&gt;
          awk -Fx '{printf(&amp;quot;%dx%d+0+0&amp;quot;, 0.60*$1, $2-35)}'`&lt;br /&gt;
	xpdf -geometry $XPDFGEOM -z width &amp;quot;$@&amp;quot; &lt;br /&gt;
	;;&lt;br /&gt;
    application/postscript)&lt;br /&gt;
        gv &amp;quot;$@&amp;quot; ;;&lt;br /&gt;
    application/msword)&lt;br /&gt;
        if [ -z &amp;quot;$DISPLAY&amp;quot; ] ; then antiword &amp;quot;$@&amp;quot; | \&lt;br /&gt;
          less; else soffice &amp;quot;$@&amp;quot; &amp;amp; fi ;;&lt;br /&gt;
    text/html)&lt;br /&gt;
        if [ -z &amp;quot;$DISPLAY&amp;quot; ] ; then lynx &amp;quot;$@&amp;quot;; else dillo &amp;quot;$FULL&amp;quot; &amp;amp; fi ;;&lt;br /&gt;
    audio/mpeg)&lt;br /&gt;
        mpg123 &amp;quot;$FIRST&amp;quot; ;;&lt;br /&gt;
    *)&lt;br /&gt;
        less &amp;quot;$@&amp;quot; ;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
====Finding the 50 largest directories====&lt;br /&gt;
&lt;br /&gt;
 du -S / | sort -nr | head -n50&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
====Auto-generating a shebang line====&lt;br /&gt;
:&amp;lt;tt&amp;gt;(echo -n '#!'; which perl; tail -n+2 foo) &amp;gt; bar&amp;lt;/tt&amp;gt;&lt;br /&gt;
This will print &amp;quot;#!&amp;quot; and the path to &amp;lt;tt&amp;gt;perl&amp;lt;/tt&amp;gt;, then everything except the first line (the original shebang) of the file &amp;lt;tt&amp;gt;foo&amp;lt;/tt&amp;gt;; and redirect all that to go into a file &amp;lt;tt&amp;gt;bar&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This is really meant for use in install scripts; obviously you know where perl is on your system, but not necessarily on anybody else's system  (though &amp;lt;tt&amp;gt;/usr/bin/perl&amp;lt;/tt&amp;gt; is a safe guess).  But you know bash is always at &amp;lt;tt&amp;gt;/bin/sh&amp;lt;/tt&amp;gt;.  So, instead of just saying in the documentation &amp;quot;change the first line .....&amp;quot;, you can write a little shell script that puts the correct shebang line in the file and copies it to &amp;lt;tt&amp;gt;/usr/local/bin&amp;lt;/tt&amp;gt;.  Then, put this script in a .tar.gz file with your perl script and any documentation.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
====Creating an audio CD from .mp3 files====&lt;br /&gt;
This little script requires the mpg123 and [[http://cdrdao.sourceforge.net/ cdrdao]] packages.  It uses mpg123 to create a .wav file from each mp3 in the current directory, and builds up a &amp;quot;TOC&amp;quot; file (Table Of Contents) as it goes along, using the &amp;amp;amp;&amp;amp;amp; notation to be sure only to include successfully-converted files.  Finally, it starts writing the CD.&lt;br /&gt;
&lt;br /&gt;
The TOC file is given a name based on the PID, and is placed in the current directory.  Neither it nor the .wav files will be deleted at the end of the script, so you can always burn another copy of the CD if you want.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;#!/bin/sh&lt;br /&gt;
tocfile=&amp;quot;cd_$$.toc&amp;quot;&lt;br /&gt;
echo &amp;quot;CD_DA&amp;quot; &amp;gt; $tocfile&lt;br /&gt;
for i in *mp3&lt;br /&gt;
 do wav=&amp;quot;`basename $i .mp3`.wav&amp;quot;&lt;br /&gt;
    mpg123 -w$wav $i\&lt;br /&gt;
    &amp;amp;&amp;amp; echo -en &amp;gt;&amp;gt;$tocfile &amp;quot;TRACK AUDIO\nFILE \&amp;quot;$wav\&amp;quot; 0\n&amp;quot;&lt;br /&gt;
done&lt;br /&gt;
echo -e &amp;quot;TOC file still available at $tocfile&amp;quot;&lt;br /&gt;
cdrdao write $tocfile&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: in the &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; statement, you might think at first sight that&lt;br /&gt;
it should be &amp;lt;tt&amp;gt;for i in *.mp3&amp;lt;/tt&amp;gt;; but Linux doesn't care about&lt;br /&gt;
filename extensions at all.  * will match a . character; therefore, *mp3&lt;br /&gt;
will match everything ending in mp3 or .mp3.  Those characters are unlikely&lt;br /&gt;
to be found on the end of anything but an mp3 file.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
==== Portable Indirection ====&lt;br /&gt;
Sometimes you need to use the value of a variable whose name is held in another variable. This is indirection. For example:&lt;br /&gt;
  for V in PATH LD_LIBRARY_PATH; do echo ${!V}; done&lt;br /&gt;
but that isn't portable to older shells, eg. the old Bourne shell. A portable way is to use the following instead of &amp;lt;tt&amp;gt;${!V}&amp;lt;/tt&amp;gt;:&lt;br /&gt;
  `eval echo \\$&amp;quot;$V&amp;quot;`&lt;br /&gt;
It's not pretty but at least it works on nearly all Unixes. &lt;br /&gt;
&lt;br /&gt;
[ someone said - &amp;quot;It does require that the variable be exported.&amp;quot; Actually no. It works without exporting V on bash and on Solaris sh ]&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
==== Matching Curly Brackets ====&lt;br /&gt;
''I'm not really sure whether this belongs under ''bash'' or ''awk'' - so move this if you think it's in the wrong place.''&lt;br /&gt;
&lt;br /&gt;
If you indent your C, Perl or PHP code in what is commonly called &amp;quot;K&amp;amp;R style&amp;quot;, which is to say something like this&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;# nested loop example&lt;br /&gt;
for ($i = 0; $i &amp;lt;= 6; ++$i) {&lt;br /&gt;
    for ($j = 0; $j &amp;lt;= $i; ++$j) {&lt;br /&gt;
        print &amp;quot;$i : $j &amp;quot;;&lt;br /&gt;
    };&lt;br /&gt;
    print &amp;quot;\n&amp;quot;;&lt;br /&gt;
};&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
i.e.  where the opening curly bracket appears on the same line as the flow-control keyword  (if, while &amp;amp;c.)  and everything up to, but not including, the closing curly bracket is indented, then you may find this useful.  I came up with it out of necessity, and thought it was just too important not to share.  All it does is display the lines with a { but no following }  (in Perl, these denote associative array indexes)  or a } with no preceding {.  In other words, just the opening and closing lines of loops, not the content.  This can help you to spot those annoying missing-bracket errors.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;tt&amp;gt;awk '/({[^}]*$)|(^[^{]*})/{print}' ''foo''&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace ''foo'' with the filename to be examined.  Or, of course, you can omit the filename and use the command in a [[pipeline]].&lt;br /&gt;
&lt;br /&gt;
The above example would appear as&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;for ($i = 0; $i &amp;lt;= 6; ++$i) {&lt;br /&gt;
    for ($j = 0; $j &amp;lt;= $i; ++$j) {&lt;br /&gt;
    };&lt;br /&gt;
};&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
==== rpminfo ====&lt;br /&gt;
&lt;br /&gt;
This is a small script that prints useful info about an [[rpm]] package.  It was inspired by the ability of [[less]] to give almost useful info about an rpm file through &amp;lt;tt&amp;gt;lesspipe.sh&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
&lt;br /&gt;
 echo INFORMATION: ; rpm -qi $* ; echo&lt;br /&gt;
 echo REQUIRES: ; rpm -qR $* ; echo&lt;br /&gt;
 echo PROVIDES: ; rpm -q --provides $* ; echo&lt;br /&gt;
 echo FILELIST: ; rpm -qlv $*&lt;br /&gt;
&lt;br /&gt;
Save it to a file called &amp;lt;tt&amp;gt;rpminfo&amp;lt;/tt&amp;gt; in your [[path]] and [[chmod]] it so it's executable.  It is often useful to [[pipe]] the output to [[less]], as in the examples below.&lt;br /&gt;
&lt;br /&gt;
To get info on an installed package, you can just give the package name like:&lt;br /&gt;
 rpminfo XFree86 |less&lt;br /&gt;
For a package file that you have just downloaded, give the &amp;lt;tt&amp;gt;-p&amp;lt;/tt&amp;gt; [[command options|command option]], just like &amp;lt;tt&amp;gt;rpm&amp;lt;/tt&amp;gt;:&lt;br /&gt;
 rpminfo -p XFree86-4.1.0-25.i386.rpm |less&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Bash&amp;diff=11360</id>
		<title>Bash</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Bash&amp;diff=11360"/>
		<updated>2004-05-04T13:44:04Z</updated>

		<summary type="html">&lt;p&gt;Snags: Link bash tips&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''bash''' (the '''b'''ourne-'''a'''gain '''sh'''ell) - is the default [[shell]] for Linux users.  It is compatible with the traditional Bourne shell ([[sh]]) in that Bourne shell scripts will work in bash, though there are some bash-specific features that will not work on older Bourne shells.&lt;br /&gt;
&lt;br /&gt;
== Shell initialization ==&lt;br /&gt;
The place to put [[alias]]es and simple [[environment variable]] settings that you want every time you open a shell is in &amp;lt;tt&amp;gt;.bashrc&amp;lt;/tt&amp;gt; in your home directory.  Example &amp;lt;tt&amp;gt;.bashrc&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
 if [ -f /etc/bashrc ]; then . /etc/bashrc ; fi # Load system-wide bashrc&lt;br /&gt;
 export PAGER=less&lt;br /&gt;
 alias md='mkdir'&lt;br /&gt;
 alias rd='rmdir'&lt;br /&gt;
&lt;br /&gt;
Appending text to environment variables like your [[PATH]] should not be done in the &amp;lt;tt&amp;gt;.bashrc&amp;lt;/tt&amp;gt;, because it gets run often when subshells are started.  Place lines like this in your &amp;lt;tt&amp;gt;~/.bash_profile&amp;lt;/tt&amp;gt;:&lt;br /&gt;
 PATH=$HOME/bin:$PATH  # Adds to path, only in .bash_profile&lt;br /&gt;
&lt;br /&gt;
When started as a login shell, bash first reads &amp;lt;tt&amp;gt;/etc/profile&amp;lt;/tt&amp;gt;, then the first of &amp;lt;tt&amp;gt;~/.bash_profile&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;~/.bash_login&amp;lt;/tt&amp;gt;, or &amp;lt;tt&amp;gt;~/.profile&amp;lt;/tt&amp;gt; that it finds.  It doesn't automatically read the  &amp;lt;tt&amp;gt;~/.bashrc&amp;lt;/tt&amp;gt; file in login shells.  For consistency, the following line shold probably be in your &amp;lt;tt&amp;gt;.bash_profile&amp;lt;/tt&amp;gt;:&lt;br /&gt;
 if [ -f ~/.bashrc ]; then . ~/.bashrc ; fi&lt;br /&gt;
&lt;br /&gt;
== Bash-specific features ==&lt;br /&gt;
&lt;br /&gt;
=== User features ===&lt;br /&gt;
* Tab filename completion - Type the beginning of a [[commands|command]], variable, or file, press TAB, and bash will attempt to fill in the rest.&lt;br /&gt;
&lt;br /&gt;
* Typing &amp;lt;Esc&amp;gt;. repeats the last argument of the previous command.&lt;br /&gt;
&lt;br /&gt;
* Typing &amp;lt;Esc&amp;gt;&amp;lt;BackSpace&amp;gt; backspaces a whole &amp;quot;word&amp;quot; at a time.&lt;br /&gt;
&lt;br /&gt;
* Readline - a [[GNU]]-created [[library]] for line-by-line text input.  It allows a searchable command history and easy editing of the current command line, among other things.&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;ctrl&amp;gt; + &amp;lt;r&amp;gt; invokes reverse-i-search for the [[command buffer]] (history of what you've typed). Then just type a part, any part, not necessarily from the begining, of a command you've typed in before and it'll give you the chronologically closest match &lt;br /&gt;
&lt;br /&gt;
=== Language features ===&lt;br /&gt;
* The use of &amp;lt;tt&amp;gt;$( command )&amp;lt;/tt&amp;gt; for command substitution (backquotes are traditional)&lt;br /&gt;
&lt;br /&gt;
* Numerical for loops&lt;br /&gt;
     for (( i=0; i&amp;lt;10; i++ )) ; do echo $i ; done&lt;br /&gt;
&lt;br /&gt;
* Substitution in variable expansions (not [[regex]])&lt;br /&gt;
     TEXT=&amp;quot;I like dogs.&amp;quot;&lt;br /&gt;
     echo ${TEXT/dogs/bats}   # Prints:   I like bats.&lt;br /&gt;
&lt;br /&gt;
Be sure to check out the [http://www.tldp.org/LDP/abs/html Advanced Bash Scripting Guide], which has (most of) the info you need to start with bash scripting.&lt;br /&gt;
&lt;br /&gt;
=== Custom Prompt ===&lt;br /&gt;
The PS1 variable stores the command-line prompt that &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt; prints.  For a colorful bash prompt that looks like:&lt;br /&gt;
 &amp;lt;b&amp;gt;&amp;lt;font style=&amp;quot;color: #00d000;&amp;quot;&amp;gt;username@hostname/&amp;lt;/font&amp;gt;&amp;lt;font style=&amp;quot;color: #ff0000&amp;quot;&amp;gt;pwd&amp;lt;/font&amp;gt; &amp;lt;font style=&amp;quot;color: #0000ff&amp;quot;&amp;gt;$&amp;lt;/font&amp;gt;&amp;lt;/B&amp;gt;&lt;br /&gt;
use the following:&lt;br /&gt;
 export PS1='\[\e[32m\]\u@\h/\[\e[1;31m\]\w\[\e[1;34m\]\$\[\e[0m\] '&lt;br /&gt;
&lt;br /&gt;
For one without colors:&lt;br /&gt;
 &amp;lt;B&amp;gt;username@hostname:pwd$&amp;lt;/B&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 export PS1='\u@\h:\w\$ '         # Single quotes with single backslashes&lt;br /&gt;
&lt;br /&gt;
Some PS1 options:&lt;br /&gt;
&lt;br /&gt;
*\d Displays the [[date]] in &amp;quot;Weekday Month Date&amp;quot;.&lt;br /&gt;
*\e [[ASCII]] escape (See the [http://man.linuxquestions.org/index.php?query=console_codes&amp;amp;section=0&amp;amp;type=2 console_codes man page] for what you can do).&lt;br /&gt;
*\h Displays the [[hostname]] (up to the first '.').&lt;br /&gt;
*\t Displays current time in 24-hour HH:MM:SS format.&lt;br /&gt;
*\u Displays the name of your [[user]].&lt;br /&gt;
*\w Displays the name of the [[cwd|current directory]].&lt;br /&gt;
*\W Displays only the [[basename]] of the current directory.&lt;br /&gt;
*\$ Displays '$' if you're not [[root]], '#' if you are.&lt;br /&gt;
*\[ and \] Surround non-printing characters&lt;br /&gt;
&lt;br /&gt;
In addition, the PROMPT_COMMAND variable is run every time the shell prompt is printed.  Many use this to change the [[xterm]] title bar:&lt;br /&gt;
&lt;br /&gt;
 export PROMPT_COMMAND='echo -ne &amp;quot;\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007&amp;quot;'&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[[Programming#Scripting languages|Scripting languages section]]&lt;br /&gt;
*[[Bash tips]]&lt;br /&gt;
&lt;br /&gt;
==External links ==&lt;br /&gt;
* [http://man.linuxquestions.org/index.php?query=bash&amp;amp;section=0&amp;amp;type=2 bash man page]&lt;br /&gt;
* [http://www.linuxcommand.org/ LinuxCommand tutorials]&lt;br /&gt;
* [http://www.tldp.org/LDP/abs/html Advanced Bash Scripting Guide]&lt;br /&gt;
* [http://www-106.ibm.com/developerworks/linux/library/l-tip-prompt/ Prompt magic]&lt;br /&gt;
&lt;br /&gt;
''This article is a [[LinuxQuestions.org_Wiki:stub_articles|stub]] and needs to be finished. [[LinuxQuestions.org_Wiki:plunging_forward|Plunge forward]] and [[LinuxQuestions.org_Wiki:How_to_edit_a_page|help it grow]] !''&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Sed&amp;diff=15165</id>
		<title>Sed</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Sed&amp;diff=15165"/>
		<updated>2004-05-03T13:26:10Z</updated>

		<summary type="html">&lt;p&gt;Snags: Alternative way to do this. (Examples)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''sed''' ('''s'''tream '''ed'''itor) is an editor used, not interactively on text files (like [[vi]] or [[emacs]]), but on [[stream]]s. This allows it to transform text input from a pipe or the command line or a file (if it is piped to sed or given as an argument to sed).&lt;br /&gt;
&lt;br /&gt;
sed supports [[regular expression]]s which gives it great control over what it can do to the input stream. Common applications of sed include parsing log files, replacing specific words/typos in a stream, and reading [[CSV]] files.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
One of the most common uses of &amp;lt;tt&amp;gt;sed&amp;lt;/tt&amp;gt; is to make a quick substitution in a file or data stream.  This is done with the following:&lt;br /&gt;
 $ ''command'' | sed 's/''regexp''/''replacement''/g'&lt;br /&gt;
Here, &amp;lt;tt&amp;gt;''command''&amp;lt;/tt&amp;gt; generates the input data, &amp;lt;tt&amp;gt;''regexp''&amp;lt;/tt&amp;gt; is the text to search for and remove, and &amp;lt;tt&amp;gt;''replacement''&amp;lt;/tt&amp;gt; is the new text to insert.  The &amp;lt;tt&amp;gt;g&amp;lt;/tt&amp;gt; suffix causes &amp;lt;tt&amp;gt;sed&amp;lt;/tt&amp;gt; to make more than one replacement per input line as is usually intended.&lt;br /&gt;
&lt;br /&gt;
A specific example of this handy use of sed is to rename all files that have the extension .jpg to be files with the extention .jpeg:&lt;br /&gt;
&lt;br /&gt;
 $ for each in *.jpg; do mv &amp;quot;${each}&amp;quot; &amp;quot;$(echo &amp;quot;${each}&amp;quot; | sed -e &amp;quot;s,\.jpg$,.jpeg,&amp;quot;)&amp;quot;; done&lt;br /&gt;
&lt;br /&gt;
Of course, if regular expressions aren't needed, the [[Bash_tips#Renaming_a_set_of_files|shell can be used]].&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
&lt;br /&gt;
*[http://man.linuxquestions.org/index.php?query=sed&amp;amp;section=0&amp;amp;type=2 sed man page]&lt;br /&gt;
*[http://www.gnu.org/software/sed/manual/sed.html GNU sed online manual]&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Bash_tips&amp;diff=8505</id>
		<title>Bash tips</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Bash_tips&amp;diff=8505"/>
		<updated>2004-05-03T13:25:32Z</updated>

		<summary type="html">&lt;p&gt;Snags: Quotes sometimes needed (Renaming a set of files)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==== Some General Comments ====&lt;br /&gt;
If you type in a rather long and complex [[command]] at the [[command line]], you might want to save that command in a [[text file]], so you can execute it later without having to type the whole long thing in again. If you add a line to the beginning of that file, like &amp;quot;&amp;lt;tt&amp;gt;#!/bin/bash&amp;lt;/tt&amp;gt;&amp;quot; (a so-called &amp;quot;[[shebang]]&amp;quot; line), and then make the file executable with the &amp;lt;tt&amp;gt;[[chmod]]&amp;lt;/tt&amp;gt; command, you've just created a shell script.&lt;br /&gt;
&lt;br /&gt;
Here's an example shell script:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# Any line that starts with a hash, besides the shebang line, is a comment.&lt;br /&gt;
echo &amp;quot;Hello world!&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You run the [[shell script]] just like any other [[executable]]. Some folks create a &amp;lt;tt&amp;gt;bin&amp;lt;/tt&amp;gt; directory in their home directory within which to place their scripts. Others drop them in &amp;lt;tt&amp;gt;/usr/local/bin&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Some key points to keep in mind about shell scripts:&lt;br /&gt;
* They execute their commands, line by line, just as if you'd typed them in yourself at the command line.&lt;br /&gt;
* The commands in the script run in a [[subshell]] of the shell from which you executed the script.&lt;br /&gt;
* If you want the script to affect your [[pwd|present working directory]] or [[environment variables]], source it with &amp;lt;tt&amp;gt;.&amp;amp;nbsp;scriptname&amp;lt;/tt&amp;gt;.&lt;br /&gt;
* Don't put spaces around equal signs.&lt;br /&gt;
&lt;br /&gt;
You could check out the [[bash]] page and you'll also find lots of info in the [http://www.tldp.org/LDP/abs/html Advanced Bash-Scripting Guide].&lt;br /&gt;
&lt;br /&gt;
Enjoy!&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
==== Get your IP address====&lt;br /&gt;
&lt;br /&gt;
A [[bash]] example to get your IP address using http://www.whatismyip.com:&amp;lt;br /&amp;gt;&lt;br /&gt;
 lynx -dump http://www.whatismyip.com | awk '/^Your IP is/ { print $4; }' &lt;br /&gt;
&lt;br /&gt;
Or use this:&amp;lt;br&amp;gt;&lt;br /&gt;
 /sbin/ifconfig ppp0 | awk '/inet/{ printf(&amp;quot;%s\n&amp;quot;, substr($2,index($2,&amp;quot;:&amp;quot;)+1)) }'&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that ppp0 stands for the first point-to-point-protocol device which is usually a modem. If you are using an ethernet adapter instead, replace ppp0 with eth0. You can also leave it out all together to list all the addresses associated with your computer.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
====Some counting examples====&lt;br /&gt;
 x=0; ((x++))&lt;br /&gt;
 x=0; x=$((x+1))&lt;br /&gt;
 x=0; let x=$x+1&lt;br /&gt;
 for (( x=0; x&amp;lt;10; x++ )) ; do echo $x ; done&lt;br /&gt;
&lt;br /&gt;
 for x in `seq 0 9`; do echo $x; done &lt;br /&gt;
 x=0; x=$(expr $x + 1) &lt;br /&gt;
 x=0; x=$(echo $x + 1|bc)&lt;br /&gt;
 x=4; x=$(echo scale=5\; $x / 3.14|bc)&lt;br /&gt;
&lt;br /&gt;
The first four demonstrate Bash' internal counting mechanisms, these will not use external programs and are thus safe (and fast).&lt;br /&gt;
The last four use external programs. [[bc]], as used in the last two examples, is the only one that supports numbers with decimals. For adding, subtracting and multiplying, you don't have to do anything special, but for division you need to specify the number of digits to keep (default is none) using the 'scale=n' line. &lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
====Combining multiple conditions of if statements====&lt;br /&gt;
AND:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if(a==1 &amp;amp;&amp;amp; b==2)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
OR:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if(( a==1|2|3 ))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
====Renaming a set of files====&lt;br /&gt;
&lt;br /&gt;
 $ for f in ''filelist'' ... ; do mv $f ${f/''oldname''/''newname''} ; done&lt;br /&gt;
&lt;br /&gt;
Double quotes should be used around &amp;lt;tt&amp;gt;$f&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;${f...}&amp;lt;/tt&amp;gt; constructions if any of the filenames contain spaces.  [[mmv]] is a really nifty tool for doing this sort of thing more flexibly too.  The [[rename]] command also provides similar functionality, depending on your linux [[distribution]].&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
====Extracting addresses from a mailbox file====&lt;br /&gt;
This statement will pull out everything that looks like an e-mail address from a mailbox file  (here called ''foo''), and sort them into alphabetical order.&lt;br /&gt;
  awk '!/essage-[iI][dD]/ &amp;amp;amp;&amp;amp;amp; !/MAILER-DAEMON/ {&lt;br /&gt;
    if (match($0, /([A-Za-z][A-Za-z0-9._-]*@[A-Za-z0-9._-]+)/))&lt;br /&gt;
      print substr($0, RSTART, RLENGTH); }' ''foo'' |sort |uniq&lt;br /&gt;
The &amp;lt;tt&amp;gt;awk&amp;lt;/tt&amp;gt; script works as follows.  If the line is not a message-id header, does not mention &amp;quot;MAILER-DAEMON&amp;quot;, and has something in it that looks like an email address, then the address-like portion is extracted and printed.&lt;br /&gt;
The output from &amp;lt;tt&amp;gt;awk&amp;lt;/tt&amp;gt; is sorted alphabetically by &amp;lt;tt&amp;gt;sort&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;uniq&amp;lt;/tt&amp;gt; deletes repetitions.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
====Converting several wav files to mp3====&lt;br /&gt;
This statement will convert all .wav files in a directory to mp3  (assuming you already have the [[http://lame.sourceforge.net/ lame]] package installed):&lt;br /&gt;
:&amp;lt;tt&amp;gt;for i in *.wav; do lame -h $i &amp;amp;amp;&amp;amp;amp; rm $i; done&amp;lt;/tt&amp;gt;&lt;br /&gt;
The double ampersand prevents rm from deleting files that weren't successfully converted.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
====Full file name====&lt;br /&gt;
Prints the full filename removing ./ and ../ and adding `pwd` if necessary. I keep this in a script called &amp;lt;tt&amp;gt;fqn&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# return the full filename, removing ./ ../ adding `pwd` if necessary&lt;br /&gt;
&lt;br /&gt;
FILE=&amp;quot;$1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# file		dot relative&lt;br /&gt;
# ./file	dot relative&lt;br /&gt;
# ../file	parent relative&lt;br /&gt;
# /file		absolute&lt;br /&gt;
while true; do&lt;br /&gt;
	case &amp;quot;$FILE&amp;quot; in&lt;br /&gt;
		( /* ) 		&lt;br /&gt;
		# Remove /./ inside filename:&lt;br /&gt;
		while echo &amp;quot;$FILE&amp;quot; |fgrep &amp;quot;/./&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; do&lt;br /&gt;
			FILE=`echo &amp;quot;$FILE&amp;quot; | sed &amp;quot;s/\\/\\.\\//\\//&amp;quot;`&lt;br /&gt;
		done&lt;br /&gt;
		# Remove /../ inside filename:&lt;br /&gt;
		while echo &amp;quot;$FILE&amp;quot; |grep &amp;quot;/[^/][^/]*/\\.\\./&amp;quot; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; do&lt;br /&gt;
			FILE=`echo &amp;quot;$FILE&amp;quot; | sed &amp;quot;s/\\/[^/][^/]*\\/\\.\\.\\//\\//&amp;quot;`&lt;br /&gt;
		done&lt;br /&gt;
		echo &amp;quot;$FILE&amp;quot;&lt;br /&gt;
		exit 0&lt;br /&gt;
		;;&lt;br /&gt;
		&lt;br /&gt;
		(*)&lt;br /&gt;
		FILE=`pwd`/&amp;quot;$FILE&amp;quot;&lt;br /&gt;
		;;&lt;br /&gt;
	esac&lt;br /&gt;
&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
====Resolving a link====&lt;br /&gt;
This little script follows symbolic links wherever they may lead and prints the ultimate filename (if it exists!) (note - it uses the previous script accessed as &amp;lt;tt&amp;gt;fqn&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
# prints the real file pointed to by a link&lt;br /&gt;
# usage: $0 link&lt;br /&gt;
&lt;br /&gt;
ORIG_LINK=&amp;quot;$1&amp;quot;&lt;br /&gt;
LINK=`fqn &amp;quot;$1&amp;quot;`&lt;br /&gt;
while [ -h &amp;quot;$LINK&amp;quot; ]; do&lt;br /&gt;
	DIR=`dirname &amp;quot;$LINK&amp;quot;`&lt;br /&gt;
&lt;br /&gt;
	# next link is everything from &amp;quot;-&amp;gt; &amp;quot;&lt;br /&gt;
	LINK=`ls -l &amp;quot;$LINK&amp;quot; |sed &amp;quot;s/^.*-&amp;gt; //&amp;quot;`&lt;br /&gt;
&lt;br /&gt;
	LINK=`cd &amp;quot;$DIR&amp;quot;; fqn &amp;quot;$LINK&amp;quot;`&lt;br /&gt;
	if [ ! -e &amp;quot;$LINK&amp;quot; ]; then&lt;br /&gt;
		echo &amp;quot;\&amp;quot;$ORIG_LINK\&amp;quot; is a broken link: \&amp;quot;$LINK\&amp;quot; does not exist&amp;quot; &amp;gt;&amp;amp;2&lt;br /&gt;
		exit 1&lt;br /&gt;
	fi&lt;br /&gt;
done&lt;br /&gt;
echo &amp;quot;$LINK&amp;quot;&lt;br /&gt;
exit 0&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
====Viewing a file according to its type====&lt;br /&gt;
I save this as a script called &amp;lt;tt&amp;gt;v&amp;lt;/tt&amp;gt; and it is my universal viewing script - it can be extended to any kind of file and to use your favourite tools for each type of file. It uses the &amp;lt;tt&amp;gt;file&amp;lt;/tt&amp;gt; utility to determine what sort of file it is and then invokes the correct tool. It automatically adapts to being used on the system console or under X.&lt;br /&gt;
&lt;br /&gt;
(note - this uses a prior script &amp;lt;tt&amp;gt;fqn&amp;lt;/tt&amp;gt;)&lt;br /&gt;
&amp;lt;tt&amp;gt;&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;&lt;br /&gt;
#! /bin/sh&lt;br /&gt;
# View files based on the type of the first one:&lt;br /&gt;
# Relies partly on 'less' to invoke an appropriate viewer.&lt;br /&gt;
# Make sure than you have this set:&lt;br /&gt;
# LESSOPEN=&amp;quot;|lesspipe.sh %s&amp;quot;&lt;br /&gt;
&lt;br /&gt;
FIRST=&amp;quot;$1&amp;quot;&lt;br /&gt;
FULL=`fqn $FIRST`&lt;br /&gt;
&lt;br /&gt;
# if we are being piped to, just run less&lt;br /&gt;
[ -z &amp;quot;$FIRST&amp;quot; -o ! -r &amp;quot;$FIRST&amp;quot; ] &amp;amp;&amp;amp; exec less &amp;quot;$@&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# some file types beyond what /usr/bin/lesspipe.sh handles:&lt;br /&gt;
case &amp;quot;$FIRST&amp;quot; in&lt;br /&gt;
  *.cpio.bz2) bunzip2 -c $1 | cpio -ctv 2&amp;gt;/dev/null |less; exit ;;&lt;br /&gt;
  *.cpio) cpio -ctv $1 2&amp;gt;/dev/null |less; exit;;&lt;br /&gt;
esac&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
TYPE=`file -L -i &amp;quot;$FIRST&amp;quot;  2&amp;gt;/dev/null | \&lt;br /&gt;
  awk '{len=length(&amp;quot;'&amp;quot;$FIRST&amp;quot;'&amp;quot;)+ 2; $0=substr($0, len); print $1;}'`&lt;br /&gt;
echo &amp;quot;Type=\&amp;quot;$TYPE\&amp;quot;&amp;quot;&lt;br /&gt;
case &amp;quot;$TYPE&amp;quot; in&lt;br /&gt;
    image/jpeg | image/tiff | image/gif | image/x-xpm | image/*)&lt;br /&gt;
        xzgv &amp;quot;$@&amp;quot; ;;&lt;br /&gt;
    application/pdf) &lt;br /&gt;
	XPDFGEOM=`xdpyinfo |awk '/dimensions/ {print $2}'| \&lt;br /&gt;
          awk -Fx '{printf(&amp;quot;%dx%d+0+0&amp;quot;, 0.60*$1, $2-35)}'`&lt;br /&gt;
	xpdf -geometry $XPDFGEOM -z width &amp;quot;$@&amp;quot; &lt;br /&gt;
	;;&lt;br /&gt;
    application/postscript)&lt;br /&gt;
        gv &amp;quot;$@&amp;quot; ;;&lt;br /&gt;
    application/msword)&lt;br /&gt;
        if [ -z &amp;quot;$DISPLAY&amp;quot; ] ; then antiword &amp;quot;$@&amp;quot; | \&lt;br /&gt;
          less; else soffice &amp;quot;$@&amp;quot; &amp;amp; fi ;;&lt;br /&gt;
    text/html)&lt;br /&gt;
        if [ -z &amp;quot;$DISPLAY&amp;quot; ] ; then lynx &amp;quot;$@&amp;quot;; else dillo &amp;quot;$FULL&amp;quot; &amp;amp; fi ;;&lt;br /&gt;
    audio/mpeg)&lt;br /&gt;
        mpg123 &amp;quot;$FIRST&amp;quot; ;;&lt;br /&gt;
    *)&lt;br /&gt;
        less &amp;quot;$@&amp;quot; ;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
====Finding the 50 largest directories====&lt;br /&gt;
&lt;br /&gt;
 du -S / | sort -nr | head -n50&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
====Auto-generating a shebang line====&lt;br /&gt;
:&amp;lt;tt&amp;gt;(echo -n '#!'; which perl; tail -n+2 foo) &amp;gt; bar&amp;lt;/tt&amp;gt;&lt;br /&gt;
This will print &amp;quot;#!&amp;quot; and the path to &amp;lt;tt&amp;gt;perl&amp;lt;/tt&amp;gt;, then everything except the first line (the original shebang) of the file &amp;lt;tt&amp;gt;foo&amp;lt;/tt&amp;gt;; and redirect all that to go into a file &amp;lt;tt&amp;gt;bar&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This is really meant for use in install scripts; obviously you know where perl is on your system, but not necessarily on anybody else's system  (though &amp;lt;tt&amp;gt;/usr/bin/perl&amp;lt;/tt&amp;gt; is a safe guess).  But you know bash is always at &amp;lt;tt&amp;gt;/bin/sh&amp;lt;/tt&amp;gt;.  So, instead of just saying in the documentation &amp;quot;change the first line .....&amp;quot;, you can write a little shell script that puts the correct shebang line in the file and copies it to &amp;lt;tt&amp;gt;/usr/local/bin&amp;lt;/tt&amp;gt;.  Then, put this script in a .tar.gz file with your perl script and any documentation.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
====Creating an audio CD from .mp3 files====&lt;br /&gt;
This little script requires the mpg123 and [[http://cdrdao.sourceforge.net/ cdrdao]] packages.  It uses mpg123 to create a .wav file from each mp3 in the current directory, and builds up a &amp;quot;TOC&amp;quot; file (Table Of Contents) as it goes along, using the &amp;amp;amp;&amp;amp;amp; notation to be sure only to include successfully-converted files.  Finally, it starts writing the CD.&lt;br /&gt;
&lt;br /&gt;
The TOC file is given a name based on the PID, and is placed in the current directory.  Neither it nor the .wav files will be deleted at the end of the script, so you can always burn another copy of the CD if you want.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;#!/bin/sh&lt;br /&gt;
tocfile=&amp;quot;cd_$$.toc&amp;quot;&lt;br /&gt;
echo &amp;quot;CD_DA&amp;quot; &amp;gt; $tocfile&lt;br /&gt;
for i in *mp3&lt;br /&gt;
 do wav=&amp;quot;`basename $i .mp3`.wav&amp;quot;&lt;br /&gt;
    mpg123 -w$wav $i\&lt;br /&gt;
    &amp;amp;&amp;amp; echo -en &amp;gt;&amp;gt;$tocfile &amp;quot;TRACK AUDIO\nFILE \&amp;quot;$wav\&amp;quot; 0\n&amp;quot;&lt;br /&gt;
done&lt;br /&gt;
echo -e &amp;quot;TOC file still available at $tocfile&amp;quot;&lt;br /&gt;
cdrdao write $tocfile&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: in the &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; statement, you might think at first sight that&lt;br /&gt;
it should be &amp;lt;tt&amp;gt;for i in *.mp3&amp;lt;/tt&amp;gt;; but Linux doesn't care about&lt;br /&gt;
filename extensions at all.  * will match a . character; therefore, *mp3&lt;br /&gt;
will match everything ending in mp3 or .mp3.  Those characters are unlikely&lt;br /&gt;
to be found on the end of anything but an mp3 file.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
==== Portable Indirection ====&lt;br /&gt;
Sometimes you need to use the value of a variable whose name is held in another variable. This is indirection. For example:&lt;br /&gt;
  for V in PATH LD_LIBRARY_PATH; do echo ${!V}; done&lt;br /&gt;
but that isn't portable to older shells, eg. the old Bourne shell. A portable way is to use the following instead of &amp;lt;tt&amp;gt;${!V}&amp;lt;/tt&amp;gt;:&lt;br /&gt;
  `eval echo \\$&amp;quot;$V&amp;quot;`&lt;br /&gt;
It's not pretty but at least it works on nearly all Unixes. &lt;br /&gt;
&lt;br /&gt;
[ someone said - &amp;quot;It does require that the variable be exported.&amp;quot; Actually no. It works without exporting V on bash and on Solaris sh ]&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
==== Matching Curly Brackets ====&lt;br /&gt;
''I'm not really sure whether this belongs under ''bash'' or ''awk'' - so move this if you think it's in the wrong place.''&lt;br /&gt;
&lt;br /&gt;
If you indent your C, Perl or PHP code in what is commonly called &amp;quot;K&amp;amp;R style&amp;quot;, which is to say something like this&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;# nested loop example&lt;br /&gt;
for ($i = 0; $i &amp;lt;= 6; ++$i) {&lt;br /&gt;
    for ($j = 0; $j &amp;lt;= $i; ++$j) {&lt;br /&gt;
        print &amp;quot;$i : $j &amp;quot;;&lt;br /&gt;
    };&lt;br /&gt;
    print &amp;quot;\n&amp;quot;;&lt;br /&gt;
};&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
i.e.  where the opening curly bracket appears on the same line as the flow-control keyword  (if, while &amp;amp;c.)  and everything up to, but not including, the closing curly bracket is indented, then you may find this useful.  I came up with it out of necessity, and thought it was just too important not to share.  All it does is display the lines with a { but no following }  (in Perl, these denote associative array indexes)  or a } with no preceding {.  In other words, just the opening and closing lines of loops, not the content.  This can help you to spot those annoying missing-bracket errors.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;tt&amp;gt;awk '/({[^}]*$)|(^[^{]*})/{print}' ''foo''&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace ''foo'' with the filename to be examined.  Or, of course, you can omit the filename and use the command in a [[pipeline]].&lt;br /&gt;
&lt;br /&gt;
The above example would appear as&lt;br /&gt;
&amp;lt;CODE&amp;gt;&amp;lt;PRE&amp;gt;for ($i = 0; $i &amp;lt;= 6; ++$i) {&lt;br /&gt;
    for ($j = 0; $j &amp;lt;= $i; ++$j) {&lt;br /&gt;
    };&lt;br /&gt;
};&amp;lt;/PRE&amp;gt;&amp;lt;/CODE&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
==== rpminfo ====&lt;br /&gt;
&lt;br /&gt;
This is a small script that prints useful info about an [[rpm]] package.  It was inspired by the ability of [[less]] to give almost useful info about an rpm file through &amp;lt;tt&amp;gt;lesspipe.sh&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
&lt;br /&gt;
 echo INFORMATION: ; rpm -qi $* ; echo&lt;br /&gt;
 echo REQUIRES: ; rpm -qR $* ; echo&lt;br /&gt;
 echo PROVIDES: ; rpm -q --provides $* ; echo&lt;br /&gt;
 echo FILELIST: ; rpm -qlv $*&lt;br /&gt;
&lt;br /&gt;
Save it to a file called &amp;lt;tt&amp;gt;rpminfo&amp;lt;/tt&amp;gt; in your [[path]] and [[chmod]] it so it's executable.  It is often useful to [[pipe]] the output to [[less]], as in the examples below.&lt;br /&gt;
&lt;br /&gt;
To get info on an installed package, you can just give the package name like:&lt;br /&gt;
 rpminfo XFree86 |less&lt;br /&gt;
For a package file that you have just downloaded, give the &amp;lt;tt&amp;gt;-p&amp;lt;/tt&amp;gt; [[command options|command option]], just like &amp;lt;tt&amp;gt;rpm&amp;lt;/tt&amp;gt;:&lt;br /&gt;
 rpminfo -p XFree86-4.1.0-25.i386.rpm |less&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Fdisk&amp;diff=12143</id>
		<title>Fdisk</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Fdisk&amp;diff=12143"/>
		<updated>2004-05-03T13:17:50Z</updated>

		<summary type="html">&lt;p&gt;Snags: Another hint.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''fdisk''' is a tool for allowing you to repartition the harddrives on a computer. This is a tool for advanced users, since it can potentionally destroy all your data on the hard drive and make a system un-bootable from it.&lt;br /&gt;
&lt;br /&gt;
==Example usage==&lt;br /&gt;
Just list the partition table of the first harddisk:&amp;lt;br&amp;gt;&lt;br /&gt;
 # fdisk -l /dev/hda&lt;br /&gt;
&lt;br /&gt;
Lists the partitions on all available hard disks (handy for troubleshooting and remembering which partition is where):&lt;br /&gt;
 # fdisk -l&lt;br /&gt;
&lt;br /&gt;
==Helpful Hints==&lt;br /&gt;
&lt;br /&gt;
* When you create a new partition table to install linux on a drive, remember to make one of the partitions active before you write the partition table.&lt;br /&gt;
&lt;br /&gt;
* If you create a FAT partition that you intend to format in DOS or Windows, zero the first block of the partition so that the M$ product doesn't misinterpret the parameters.  If you just created &amp;lt;tt&amp;gt;/dev/hda1&amp;lt;/tt&amp;gt;, do this:&lt;br /&gt;
       $ dd if=/dev/zero bs=1k count=1 of=/dev/hda1&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[[cfdisk]]&lt;br /&gt;
*[[Partition]]&lt;br /&gt;
*[[Partitioning guidelines]]&lt;br /&gt;
*[[parted]]&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
&lt;br /&gt;
*[http://man.linuxquestions.org/index.php?query=fdisk&amp;amp;section=0&amp;amp;type=2 fdisk man page]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
''This article is a [[LinuxQuestions.org_Wiki:stub_articles|stub]] and needs to be finished. [[LinuxQuestions.org_Wiki:plunging_forward|Plunge forward]] and [[LinuxQuestions.org_Wiki:How_to_edit_a_page|help it grow]]!''&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Tcsh&amp;diff=22053</id>
		<title>Tcsh</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Tcsh&amp;diff=22053"/>
		<updated>2004-04-28T13:28:51Z</updated>

		<summary type="html">&lt;p&gt;Snags: Shell initialization.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''tcsh''' is an updated version of the C shell, [[csh]]. tcsh offers a wider range of control in the interactive shell, with its scripting capabilities are nearly identical to that of [[csh]].&lt;br /&gt;
&lt;br /&gt;
One of the nicest of these features is the ability to interactively edit the command line with either [[emacs]] (the default) or [[vi]] (activate with &amp;lt;tt&amp;gt;bindkey -v&amp;lt;/tt&amp;gt;) keybindings.&lt;br /&gt;
&lt;br /&gt;
To see the shell's filename completion in action simply start typing the first few letters of a command or filename, and hit the 'Tab' key (or 'Esc' key twice). The ability to report possible completions is possible by setting the &amp;quot;autolist&amp;quot; variable (by &amp;lt;tt&amp;gt;set autolist&amp;lt;/tt&amp;gt;) - which can be added to the shells configuration file (~/.tcshrc).&lt;br /&gt;
&lt;br /&gt;
==Shell initialization==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;tcsh&amp;lt;/tt&amp;gt; reads several files upon startup.  It always reads &amp;lt;tt&amp;gt;/etc/csh.cshrc&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;~/.tcshrc&amp;lt;/tt&amp;gt;.  Login shells also read &amp;lt;tt&amp;gt;/etc/csh.login&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;~/.login&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The place to put aliases and simple environment variable settings that you want every time you open a shell is in &amp;lt;tt&amp;gt;.tcshrc&amp;lt;/tt&amp;gt; in your home directory. Example &amp;lt;tt&amp;gt;.tcshrc&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
 setenv PAGER less&lt;br /&gt;
 alias md mkdir&lt;br /&gt;
 alias rd rmdir&lt;br /&gt;
&lt;br /&gt;
Adding a directory to your PATH should '''not''' be done in your &amp;lt;tt&amp;gt;.tcshrc&amp;lt;/tt&amp;gt; because it can get run multiple times.  It should be in your &amp;lt;tt&amp;gt;.login&amp;lt;/tt&amp;gt; file like this:&lt;br /&gt;
&lt;br /&gt;
 setenv PATH ~/bin:$PATH&lt;br /&gt;
&lt;br /&gt;
Unlike [[bash]], there is no need to call the &amp;lt;tt&amp;gt;.tcshrc&amp;lt;/tt&amp;gt; file from the &amp;lt;tt&amp;gt;.login&amp;lt;/tt&amp;gt; file, as &amp;lt;tt&amp;gt;tcsh&amp;lt;/tt&amp;gt; reads the &amp;lt;tt&amp;gt;.tcshrc&amp;lt;/tt&amp;gt; file even in login shells.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[[shells]]&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
* [http://www.tcsh.org tcsh wiki]&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Alias&amp;diff=23424</id>
		<title>Alias</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Alias&amp;diff=23424"/>
		<updated>2004-04-28T01:29:46Z</updated>

		<summary type="html">&lt;p&gt;Snags: Reword a bit&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;An '''alias''' is simply that - another name with which to refer to a command.  Aliases allow you to create shorter or more familiar names for commonly used commands.  Another benefit lies in being able to not only alias the command, but the first few arguments, as well.  Aliases were introduced by [[csh]] and later incorporated in [[bash]] and others.  &lt;br /&gt;
&lt;br /&gt;
The exact syntax used to set an alias depends on your [[shell]].  For Bourne-type shells ([[ksh]], [[bash]], etc., though not [[sh]]), the syntax is:&lt;br /&gt;
 $ alias ''name''=''command''&lt;br /&gt;
If the command has arguments, then quotes (single or double) must be used:&lt;br /&gt;
 $ alias ''name''=&amp;quot;''command'' ''argument'' ...&amp;quot;&lt;br /&gt;
For csh-type shells ([[csh]], [[tcsh]], etc.), quotes aren't needed:&lt;br /&gt;
 $ alias ''name'' ''command'' [''arguments'' ...]&lt;br /&gt;
As you can see, the main differences are the equals sign after the &amp;lt;tt&amp;gt;name&amp;lt;/tt&amp;gt; of the alias and whether quotes are needed.  When issued without arguments, &amp;lt;tt&amp;gt;alias&amp;lt;/tt&amp;gt; prints a list of the currently defined aliases.&lt;br /&gt;
&lt;br /&gt;
When issued at the command line an alias only takes effect for that shell.  To make it permanant, the alias must be saved in one of the shell configuration files.  For &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt;, they are ordinarily placed in the &amp;lt;tt&amp;gt;~/.bashrc&amp;lt;/tt&amp;gt; file for per-user configuration, or in &amp;lt;tt&amp;gt;/etc/profile&amp;lt;/tt&amp;gt; for all users.  For &amp;lt;tt&amp;gt;tcsh&amp;lt;/tt&amp;gt;, the file &amp;lt;tt&amp;gt;~/.tcshrc&amp;lt;/tt&amp;gt; is the right place, or &amp;lt;tt&amp;gt;/etc/login&amp;lt;/tt&amp;gt; for all users.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
A simple alias for [[DOS]] users:&lt;br /&gt;
 $ alias dir=&amp;quot;ls -l&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Here is an example of a complicated alias:&lt;br /&gt;
 $ alias topcom='sort ~/.bash_history | uniq -ci | sort -r | less'&lt;br /&gt;
This alias makes it is easy to look for frequently used commands that might merit being turned into yet more aliases.&lt;br /&gt;
&lt;br /&gt;
[[Shell]] [[function]]s can accomplish the same effect as aliases, but the latter are simpler.  Unlike functions, they do not permit variable substitution.&lt;br /&gt;
&lt;br /&gt;
For instance even something as simple as:&lt;br /&gt;
 $ bak () { cp -a $1 $1.bak }&lt;br /&gt;
cannot be defined as an alias due to the variable &amp;quot;$1&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* Shell pages: [[ksh]], [[bash]], [[csh]], [[tcsh]]&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Rmdir&amp;diff=23892</id>
		<title>Rmdir</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Rmdir&amp;diff=23892"/>
		<updated>2004-04-28T01:12:34Z</updated>

		<summary type="html">&lt;p&gt;Snags: Slight reword, alias, manpage&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''rmdir''' is a [[command]] used to remove empty directories.  Non-empty directories need to be emptied first.  Another approach to removing non-empty directories is using the &amp;quot;&amp;lt;tt&amp;gt;[[rm]] -r&amp;lt;/tt&amp;gt;&amp;quot; command.&lt;br /&gt;
&lt;br /&gt;
Many people choose to [[alias]] the &amp;lt;tt&amp;gt;rmdir&amp;lt;/tt&amp;gt; command to &amp;lt;tt&amp;gt;rd&amp;lt;/tt&amp;gt; because that's what it was called in [[DOS]].  This is done differently depending on your [[shell]]:&lt;br /&gt;
 $ alias rd=rmdir     # For sh, ksh, bash, etc.&lt;br /&gt;
 $ alias rd rmdir     # For csh, tcsh, etc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[[rm]]&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
&lt;br /&gt;
*[http://man.linuxquestions.org/index.php?query=rmdir&amp;amp;section=0&amp;amp;type=2 rmdir man page]&lt;br /&gt;
&lt;br /&gt;
{{msg:stub}}&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=C&amp;diff=8491</id>
		<title>C</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=C&amp;diff=8491"/>
		<updated>2004-04-27T19:58:07Z</updated>

		<summary type="html">&lt;p&gt;Snags: (Functions) Mention standard library&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The '''C''' programming language is certainly the most influential in the world of the programming. Created at first by Brian W. Kernighan and Dennis M. Ritchie in 1978, this language is characterized by his closeness to the hardware without being architecture dependent. Not that it is complicated (like Assembly), but you can move generally as you want in the memory for example, but may crash if you are not permitted to read or write to that memory.&lt;br /&gt;
&lt;br /&gt;
The C language is often associated with UNIX, maybe because it has been developed on and written with it. But it is not linked with any system nor architecture. You can use C in many applications with this language. It, however, has come under criticism for being insecure, when it is not used correctly (for example, bounds overflow checking is not done by default - allowing the chance for buffer overflow attacks in poorly written software).&lt;br /&gt;
&lt;br /&gt;
Note that even if it is still the most used, the C language has gradually become an old language. Having been written in 1978 means it was created before many modern studies on programming language theory. These studies provide huge advances in the creation of a language, especially in the precision and speed with which it's compiled. For example, you don't have a real range of lines and columns when there is an error or a warning in C; recent languages do.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- ==History==&lt;br /&gt;
''(Feed me)''&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Language Features==&lt;br /&gt;
&lt;br /&gt;
===Types===&lt;br /&gt;
&lt;br /&gt;
====Basic Types====&lt;br /&gt;
'''int''': integer&amp;lt;br/&amp;gt;&lt;br /&gt;
'''char''': character&amp;lt;br/&amp;gt;&lt;br /&gt;
'''float''': float&amp;lt;br/&amp;gt;&lt;br /&gt;
'''double''': double float&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''short''': shorter type&amp;lt;br/&amp;gt;&lt;br /&gt;
'''long''': longer type&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
'''signed''': signed type&amp;lt;br/&amp;gt;&lt;br /&gt;
'''unsigned''': unsigned type&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- ===Array and pointers===&lt;br /&gt;
(Feed me)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- ===Structures===&lt;br /&gt;
(Feed me)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- ===User-defined Types=== --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--====Constants====&lt;br /&gt;
(Feed me)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Expressions===&lt;br /&gt;
&lt;br /&gt;
An expression is a series of operators and quantities to be operated on (operands) that returns a result.  This result can be used as the operand of a larger expression or assigned into a variable.  Expressions are used throughout the language: in &amp;lt;tt&amp;gt;if&amp;lt;/tt&amp;gt; statements, loops, function calls, and they can even be statements by themselves.&lt;br /&gt;
&lt;br /&gt;
This last use is interesting.  Just &amp;lt;tt&amp;gt;1;&amp;lt;/tt&amp;gt; is a valid C statement.  Of course, a statement is only interesting if it has side-effects.  Saying &amp;lt;tt&amp;gt;a=1;&amp;lt;/tt&amp;gt; has the side-effect of assigning the value 1 to the variable &amp;lt;tt&amp;gt;a&amp;lt;/tt&amp;gt;.  Side-effects are especially important with the logical operations and the tertiary if-then operator.&lt;br /&gt;
&lt;br /&gt;
====Operators====&lt;br /&gt;
&lt;br /&gt;
There are tons of operators in C.  Mathematical, bitwise logical, logical, comparison, and a few others.  Operators have precedence, meaning that some take effect before others.  Parentheses can be used to do things in the order you want.&lt;br /&gt;
&amp;lt;!-- Maybe these should be in order of precedence? --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Mathematical=====&lt;br /&gt;
&lt;br /&gt;
The most familiar operators for most people are &amp;lt;tt&amp;gt;+&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;-&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;*&amp;lt;/tt&amp;gt; (multiplication) and &amp;lt;tt&amp;gt;&amp;amp;divide;&amp;lt;/tt&amp;gt;.  Division uses a slash &amp;lt;tt&amp;gt;/&amp;lt;/tt&amp;gt;, and there's also the remainder operator &amp;lt;tt&amp;gt;%&amp;lt;/tt&amp;gt; for integers.  I think of the unary operators &amp;lt;tt&amp;gt;+&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;-&amp;lt;/tt&amp;gt; (negative) as mathematical as well.&lt;br /&gt;
&lt;br /&gt;
=====Assignment=====&lt;br /&gt;
&lt;br /&gt;
Assignment operators have the side-effect of setting a variable's value.  In addition to the typical &amp;lt;tt&amp;gt;=&amp;lt;/tt&amp;gt;, there are several operators like &amp;lt;tt&amp;gt;+=&amp;lt;/tt&amp;gt; which means, &amp;quot;Add this to the variable.&amp;quot;  The assignment operators are &amp;lt;tt&amp;gt;=, +=, -=, *=, /=, %=, &amp;amp;=, ^=, |=, &amp;lt;&amp;lt;=,&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;&amp;gt;&amp;gt;=&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 a += b; // equivalent to a = a + b&lt;br /&gt;
 a -= b; // equivalent to a = a - b&lt;br /&gt;
&lt;br /&gt;
=====Comparison=====&lt;br /&gt;
&lt;br /&gt;
These operators compare two values, returning 1 for true or 0 for false.  The test to see if two values are equal is &amp;lt;tt&amp;gt;(a == b)&amp;lt;/tt&amp;gt; with a double equals sign.  The comparison operators are &amp;lt;tt&amp;gt;==, !=&amp;lt;/tt&amp;gt; (not equal), &amp;lt;tt&amp;gt;&amp;amp;lt;, &amp;amp;gt;,  &amp;amp;lt;=,&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;&amp;amp;gt;=&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
A common mistake is the use of something like&lt;br /&gt;
&lt;br /&gt;
 if (a = b) { // WRONG!&lt;br /&gt;
&lt;br /&gt;
when it should have been&lt;br /&gt;
&lt;br /&gt;
 if (a == b) {&lt;br /&gt;
&lt;br /&gt;
The former will redefine ''a'' equal to ''b'', and use the new value of ''a'' as the condition for the IF statement; so for any non-zero value of ''b'', this will succeed  (and mess up ''a'' in the meantime).  Watch out for this trap!  It's ''one'' = for telling, ''two'' == for asking.&lt;br /&gt;
&lt;br /&gt;
=====Logical=====&lt;br /&gt;
&lt;br /&gt;
Logical operators combine values that are true or false.  The key concept is that is not 0 is true, and 0 is false.  Each of these operators returns 1 for true.&lt;br /&gt;
&lt;br /&gt;
 a &amp;amp;&amp;amp; b // test if a AND b are true&lt;br /&gt;
 a || b // test if a OR  b are true &lt;br /&gt;
 !a     // test if the negation of a is true&lt;br /&gt;
 a ^ b  // exclusive-OR; (a || b) &amp;amp;&amp;amp; !(a &amp;amp;&amp;amp; b)&lt;br /&gt;
&lt;br /&gt;
It is important to realise that '''C''' stops processing an expression as soon as the answer is known for sure -- ''not every sub-expression in a compound expression will necessarily be evaluated''.  The expressions a and b can have side-effects like assigning the values of variables.  Because of the difficulty in debugging such expressions, the use of function calls and operators with side-effects within logical expressions is discouraged.  It is common in [[shell]] scripts to use logical operators as quick-and-dirty if statements.&lt;br /&gt;
&lt;br /&gt;
As an example, if we have an expression such as&lt;br /&gt;
&lt;br /&gt;
 if ((a &amp;amp;&amp;amp; b) || c) {&lt;br /&gt;
&lt;br /&gt;
if ''a'' is false, ''b'' will not be evaluated  (because a &amp;amp;&amp;amp; b cannot possibly be true if ''a'' is false).  But ''c'' will have to be evaluated, because we do not know the result in advance.  If ''a'' is true, ''b'' will be evaluated; and if ''b'' is also true, then ''c'' will ''not'' be evaluated, since we know that the result of the OR operation will be true.&lt;br /&gt;
&lt;br /&gt;
=====Tertiary if-then operator=====&lt;br /&gt;
&lt;br /&gt;
This operator is unique in that it takes three operands.  The form is &amp;lt;tt&amp;gt;(a)?(b):(c)&amp;lt;/tt&amp;gt;.  (Parentheses are recommended because this operator has low precedence.)  The operator evaluates &amp;lt;tt&amp;gt;a&amp;lt;/tt&amp;gt;, and if it is true, then it returns &amp;lt;tt&amp;gt;b&amp;lt;/tt&amp;gt;.  Otherwise it returns &amp;lt;tt&amp;gt;c&amp;lt;/tt&amp;gt;.  If there are side-effects, a regular &amp;lt;tt&amp;gt;if&amp;lt;/tt&amp;gt; statement is recommended.&lt;br /&gt;
&lt;br /&gt;
Being an operator, ?: ''does'' return a value.  So&lt;br /&gt;
 d = ((a) ? (b) : (c));&lt;br /&gt;
sets ''d'' = ''b''  (and does not evaluate ''c'')  if ''a'' is true  (i.e.  anything but zero), or ''d'' = ''c''  (and does not evaluate ''b'')  if ''a'' is false  (zero).&lt;br /&gt;
&lt;br /&gt;
=====Bitwise Operators=====&lt;br /&gt;
Bitwise operators, as the name suggests, operate on binary numbers on a bit-by-bit basis.&lt;br /&gt;
&lt;br /&gt;
 a &amp;amp; b = bitwise AND&lt;br /&gt;
 a | b = bitwise OR&lt;br /&gt;
 a ^ c = bitwise XOR (exclusive OR)&lt;br /&gt;
&lt;br /&gt;
Each bit of ''a'' is ANDed, ORred or XORred  with the corresponding bit of ''b'' and the answer is inserted in the corresponding bit position in the result.  For example,  ''(I'm using hexadecimal numbers here to make it a little more obvious -- but this obviously works with any numeric values)''&lt;br /&gt;
&lt;br /&gt;
 0xe8 &amp;amp; 0x1f = 0x08&lt;br /&gt;
 0x51 | 0x60 = 0x71&lt;br /&gt;
 0xaa ^ 0xff = 0x55&lt;br /&gt;
&lt;br /&gt;
These operators are very useful when storing several boolean values in an integer or char.  Also, you can somtimes make use of the fact that -- in ASCII codes -- bit 5 (i.e.  the 32's) is ''set'' (1) in the lower case letters, but ''cleared'' (0) in the corresponding capital letter.&lt;br /&gt;
&lt;br /&gt;
=====Bit Shift Operators=====&lt;br /&gt;
These operators shift the bits of a binary number to the left or the right.  Bits that &amp;quot;fall off the end&amp;quot; are lost for all time, and zeros are shifted into the opposite end.&lt;br /&gt;
&lt;br /&gt;
 x = a &amp;lt;&amp;lt; b; // bits of a, left hand shifted b times&lt;br /&gt;
 y = a &amp;gt;&amp;gt; b; // bits of a, right hand shifted b times&lt;br /&gt;
&lt;br /&gt;
These operators are meant to be combined with the bitwise operators above.  Suppose we wished to store a day of the week ''day''  (between 0 and 6), a date within the month ''date''  (between 1 and 31), and a month ''month''  (between 1 and 12)  in an ''int'' variable ''ddm''.  We need 3 bits to store ''day'', 5 bits to store ''date'' and 4 bits to store ''month'', and we could build up an expression like this:&lt;br /&gt;
&lt;br /&gt;
 ddm = (day &amp;lt;&amp;lt; 9) | (date &amp;lt;&amp;lt; 4) | month;&lt;br /&gt;
&lt;br /&gt;
and then the reverse would be&lt;br /&gt;
&lt;br /&gt;
 day = ((ddm &amp;amp; 7&amp;lt;&amp;lt;9) &amp;gt;&amp;gt;9);&lt;br /&gt;
 date = ((ddm &amp;amp; 31&amp;lt;&amp;lt;4) &amp;gt;&amp;gt;4);&lt;br /&gt;
 month = (ddm &amp;amp; 15);&lt;br /&gt;
&lt;br /&gt;
We use the AND operator to select just the bits we are interested in, the two shift operators to position them where we want, and the OR operator to assemble the groups of bits together.&lt;br /&gt;
&lt;br /&gt;
=====Increment and Decrement=====&lt;br /&gt;
The '''++''' and '''--''' operators -- a shorthand notation for adding and subtracting one from a variable -- can each be used in two different ways.  If the operator comes ''after'' the variable name, then the variable is incremented or decremented ''after'' its value is read and passed on.  If the operator comes ''before'' the variable name, then the variable is modified ''before'' its value is read.&lt;br /&gt;
&lt;br /&gt;
 a = b++; // equivalent to a = b; b += 1&lt;br /&gt;
 a = b--; // equivalent to a = b; b -= 1&lt;br /&gt;
 a = ++b; // equivalent to b += 1; a = b&lt;br /&gt;
 a = --b; // equivalent to b -= 1; a = b&lt;br /&gt;
&lt;br /&gt;
=====Other=====&lt;br /&gt;
&lt;br /&gt;
The comma, pointer/structure/array operators, type casts.&lt;br /&gt;
&lt;br /&gt;
===Control structures===&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
====Instruction chunks====&lt;br /&gt;
(Feed me)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
====''if (else)'' instruction====&lt;br /&gt;
The general look of a C if-then-else statement is something like&amp;lt;br&amp;gt;&lt;br /&gt;
 if(&amp;lt;i&amp;gt;expression&amp;lt;/i&amp;gt;){&lt;br /&gt;
    &amp;lt;i&amp;gt;A&amp;lt;/i&amp;gt;&lt;br /&gt;
 } else {&lt;br /&gt;
    &amp;lt;i&amp;gt;B&amp;lt;/i&amp;gt;&lt;br /&gt;
 }&lt;br /&gt;
If &amp;lt;i&amp;gt;expression&amp;lt;/i&amp;gt; is different from 0 then &amp;lt;i&amp;gt;A&amp;lt;/i&amp;gt; (whatever that might be) is executed, otherwise, that is &amp;lt;i&amp;gt;expression&amp;lt;/i&amp;gt; is 0, &amp;lt;i&amp;gt;B&amp;lt;/i&amp;gt; is executed. &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The real issue here is of course; what is &amp;lt;i&amp;gt;expression&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;A&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;B&amp;lt;/i&amp;gt;. &amp;lt;i&amp;gt;expression&amp;lt;/i&amp;gt; is from the compilers point of view any value that can be interpreted as a number, that's almost anything in C. For instance the value 2 would be syntactically correct. The key issue is that 2 is different from 0, thus &amp;lt;i&amp;gt;A&amp;lt;/i&amp;gt; would be executed. &amp;lt;i&amp;gt;A&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;B&amp;lt;/i&amp;gt; is any piece of code actually, for example &amp;lt;tt&amp;gt;printf(&amp;quot;Hello World!&amp;quot;);&amp;lt;/tt&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Here's an example of an if statement: &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 if(customers &amp;gt; 0){&lt;br /&gt;
     printf(&amp;quot;There are people in the shop&amp;quot;); // state the obvious &lt;br /&gt;
     getHelp(); // call some functions that gets more personnel&lt;br /&gt;
 } else {&lt;br /&gt;
     drinkMoreCoffee(); // do what you're trained to do&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The tertiary operator (above) can be used as a quick form of the if statement.&lt;br /&gt;
&lt;br /&gt;
====''while (do)'' instruction====&lt;br /&gt;
The general look of while statement: &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 while(&amp;lt;i&amp;gt;expression&amp;lt;/i&amp;gt;){&lt;br /&gt;
     do something&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;expression&amp;lt;/i&amp;gt; is the same thing as with if statements, i.e. something that can be evaluated either true (different from zero) or false (that is zero). What's happening here is that we first test if &amp;lt;i&amp;gt;expression&amp;lt;/i&amp;gt; is true, if so the body of the while statement is executed as long as &amp;lt;i&amp;gt;expression&amp;lt;/i&amp;gt; is true. For example:&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 int a = 0; &lt;br /&gt;
 while(a &amp;lt; 5){&lt;br /&gt;
     a++; &lt;br /&gt;
     printf(&amp;quot;%d, &amp;quot;, a); &lt;br /&gt;
 }&lt;br /&gt;
 printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
This would produce the output:&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 1, 2, 3, 4, 5,&lt;br /&gt;
&lt;br /&gt;
Key note is that weather a is less than 5 or not is just tested in the beginning of the while loop, so it's possible to write the number 5. Then of course the loop is terminated. &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The brother while loop is the so called do-while-loop&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 do {&lt;br /&gt;
     do something &lt;br /&gt;
 } while(&amp;lt;i&amp;gt;expression&amp;lt;/i&amp;gt;); &lt;br /&gt;
&lt;br /&gt;
The key note here is that weather &amp;lt;i&amp;gt;expression&amp;lt;/i&amp;gt; is true or not is tested at the end of the loop, that means that the body of the loop is executed at least once. &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
It's of cource possible to construct a loop that runs forever. For example: &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 int a = 0; &lt;br /&gt;
 while(a &amp;lt; 3){&lt;br /&gt;
    printf(&amp;quot;I'm a fruitcake\n&amp;quot;); &lt;br /&gt;
 } &lt;br /&gt;
&lt;br /&gt;
====''for'' instruction====&lt;br /&gt;
The general look of a for-loop is:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 for(A;B;C){&lt;br /&gt;
     fo something&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Here A is executed just once when we enter the for-loop, typically to initialize some variables. B is a truth conditional like the ones in the while loop, if B is true then we continue looping. C is executed every time at the end of the loop. For example:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 for(i = 0; i &amp;lt; 5; i++){&lt;br /&gt;
     printf(&amp;quot;%d, &amp;quot;, i); &lt;br /&gt;
 }&lt;br /&gt;
 printf(&amp;quot;\n&amp;quot;); &lt;br /&gt;
&lt;br /&gt;
This would produce the output: &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 0, 1, 2, 3, 4,&lt;br /&gt;
&lt;br /&gt;
to guide you through it: First i is set to 0, this happens just once. Then we test if i is less than 5, clearly, it's 0. Now we enter the for-loop and print the value of, i. At the end of the loop i is incremented by 1. Then test again weather i is less than 5, print it's values, and so on. &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Please note that A, B and C can all be omitted, This is valid syntax: &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 for(;;){&lt;br /&gt;
     printf(&amp;quot;I'm looping forever and I'm happy with it.\n&amp;quot;); &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
It's not too common to introduce loops like this, but it works. The idea is that you can do something like: &lt;br /&gt;
&lt;br /&gt;
 int i = 0; &lt;br /&gt;
 for(;i &amp;lt; 10; printf(&amp;quot;Hello&amp;quot;)){&lt;br /&gt;
     i++; &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Also you can do more things in A and C, For example you want to initialize variables i to 0 and j to 5 at the beginning of the loop. &lt;br /&gt;
&lt;br /&gt;
 for(i = 1, j = 5; (i*j) &amp;gt; 0; j++, j--){&lt;br /&gt;
     printf(&amp;quot;%d, &amp;quot;, i*j); &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The , between i = 0 and j = 5 is the separator here. Same style goes at the end where j is incremented and j decremented.&lt;br /&gt;
&lt;br /&gt;
===Functions===&lt;br /&gt;
&lt;br /&gt;
Fisrt of all a function can be thought of as a way to store a procedure. This procedure contains some instructions that you want to carry out many times. Also it's a way to structure your program. It can also be regarded as a function in a more mathematical sense.  A wide variety of functions are available in the [[standard library]], [[glibc]] (Some of these are actually in the math library, accessed by linking the program with &amp;lt;tt&amp;gt;-lm&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Here is the general outfit of a C function: &lt;br /&gt;
&lt;br /&gt;
 return_type function_name(argument_1, argeument_2, ..., argument_n){&lt;br /&gt;
     function_body&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
A simple example of a function: &lt;br /&gt;
&lt;br /&gt;
 int max_i(int a, int b){&lt;br /&gt;
     if(a &amp;gt; b){&lt;br /&gt;
         return a;&lt;br /&gt;
     }&lt;br /&gt;
     return b; &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Functions can of course call other functions, for example: &lt;br /&gt;
&lt;br /&gt;
 int find_max(int *nums, int len){&lt;br /&gt;
     int max = 0, i; &lt;br /&gt;
     for(i = 0; i &amp;lt; len; i++){&lt;br /&gt;
         max = max_i(nums[i], max); &lt;br /&gt;
     }&lt;br /&gt;
     return max; &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Further functions can call themselves, this example calculates n!. &lt;br /&gt;
&lt;br /&gt;
 int fac(int n){&lt;br /&gt;
     if(n == 1){&lt;br /&gt;
         return 1; &lt;br /&gt;
     }&lt;br /&gt;
     return n*fac(n - 1); &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Functions can return all basic types such as, int, float, double, char, etc. They can also return pointers to all these. They can return pointers to structs and void. If a function is declared to return void it simply returns nothing. Don't confuse this with functions that returns pointers to void, that is void*. returning void* is simply returning a general pointer to something we don't the type of. &lt;br /&gt;
&lt;br /&gt;
An example of a function that 'returns' void. &lt;br /&gt;
&lt;br /&gt;
 void printObvious(){&lt;br /&gt;
     pritnf(&amp;quot;I'm a function that returns nothing.\n&amp;quot;); &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
As we can see we can omitt the return statement since this function do not return anything. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- ==Further Reading== --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- ===Wiki pages=== --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Books==&lt;br /&gt;
*''C Programming Language'', Brian W. Kernighan, [[Dennis Ritchie]]&lt;br /&gt;
*''C: A Reference Manual'', Samuel P. Harbison, Guy L. Steele&lt;br /&gt;
&lt;br /&gt;
==Tutorial Material==&lt;br /&gt;
Since this page serves as something of lanaguage overview more lengthy examples would fit better on it's own page. Check out [[CProgrammingExamples]] for some examples, that might help you getting started with C programming. &lt;br /&gt;
&lt;br /&gt;
''This article is a [[LinuxQuestions.org_Wiki:stub_articles|stub]] and needs to be finished. [[LinuxQuestions.org_Wiki:plunging_forward|Plunge forward]] and [[LinuxQuestions.org_Wiki:How_to_edit_a_page|help it grow]] !''&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Chsh&amp;diff=8315</id>
		<title>Chsh</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Chsh&amp;diff=8315"/>
		<updated>2004-04-27T13:51:32Z</updated>

		<summary type="html">&lt;p&gt;Snags: How to do chsh without using chsh.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''chsh''' is a command to change your login [[shell]].&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
 $ chsh [''-s shell''] [''user'']&lt;br /&gt;
&lt;br /&gt;
One important thing to keep in mind is that the full path to the shell must be listed in the file &amp;lt;tt&amp;gt;/etc/shells&amp;lt;/tt&amp;gt; in order to be recognized as valid, so you may need to become [[root]] in order to add it. Then, under either the [[user]] or root [[User account|account]], issue the &amp;lt;tt&amp;gt;chsh&amp;lt;/tt&amp;gt; command. (Root can change anyone's shell, but users can only change their own.)&lt;br /&gt;
&lt;br /&gt;
The full path to the desired shell must be specified as in this example:&lt;br /&gt;
&lt;br /&gt;
 $ chsh -s /usr/local/bin/zsh&lt;br /&gt;
&lt;br /&gt;
You will be asked for your [[password]] after the command, in the event you left yourself logged in and walked away from your keyboard.&lt;br /&gt;
&lt;br /&gt;
After &amp;lt;tt&amp;gt;chsh&amp;lt;/tt&amp;gt; finishes, you are returned to your original shell and must logout and login again (or use [[exec]] to change shells).  On your next [[login]], you will be running your new shell.&lt;br /&gt;
&lt;br /&gt;
Called without arguments, &amp;lt;tt&amp;gt;chsh&amp;lt;/tt&amp;gt; presents one of the following dialogs:&lt;br /&gt;
&lt;br /&gt;
 $ chsh&lt;br /&gt;
 Password: &lt;br /&gt;
 Changing the login shell for ''user''&lt;br /&gt;
 Enter the new value, or press return for the default&lt;br /&gt;
         Login Shell [''/path/to/shell'']: &lt;br /&gt;
&lt;br /&gt;
 $ chsh&lt;br /&gt;
 Changing shell for ''user''.&lt;br /&gt;
 Password:&lt;br /&gt;
 New shell [''/path/to/old/shell'']:&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;-l&amp;lt;/tt&amp;gt; option lists the valid shells (same as &amp;lt;tt&amp;gt;cat /etc/shells&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
On systems where you don't have permission to use &amp;lt;tt&amp;gt;chsh&amp;lt;/tt&amp;gt;, you can place an [[exec]] command in your &amp;lt;tt&amp;gt;.profile&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;.login&amp;lt;/tt&amp;gt; file to change your shell every time you log in.&lt;br /&gt;
&lt;br /&gt;
Last tip - don't &amp;lt;tt&amp;gt;chsh&amp;lt;/tt&amp;gt; to a restricted shell or you won't be able to change out again without root privileges.&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
&lt;br /&gt;
*[http://man.linuxquestions.org/index.php?query=chsh&amp;amp;section=0&amp;amp;type=2 chsh man page]&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Exec&amp;diff=19428</id>
		<title>Exec</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Exec&amp;diff=19428"/>
		<updated>2004-04-27T13:50:31Z</updated>

		<summary type="html">&lt;p&gt;Snags: Create article.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The '''exec''' command is a [[builtin]] command of most [[shell]]s.  It is used to run another command, but after the command is run, you will '''not return''' to your shell.  The new command replaces your shell in memory.  When the command ends, the effect will be the same as if you had exited the shell.  &amp;lt;tt&amp;gt;exec&amp;lt;/tt&amp;gt; is most useful for running other shells or connecting to another computer with [[ssh]].  In these cases, it prevents you from having to &amp;lt;tt&amp;gt;exit&amp;lt;/tt&amp;gt; twice when you want to log out.&lt;br /&gt;
&lt;br /&gt;
The '''exec()''' function is a standard [[library]] function that achieves the same effect described above.  It is typically used in conjunction with [[fork]].&lt;br /&gt;
&lt;br /&gt;
On systems where you don't have permission to use [[chsh]], you can place an &amp;lt;tt&amp;gt;exec&amp;lt;/tt&amp;gt; command in your &amp;lt;tt&amp;gt;.profile&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;.login&amp;lt;/tt&amp;gt; file to change your shell every time you log in.&lt;br /&gt;
&lt;br /&gt;
==Usage and Examples==&lt;br /&gt;
&lt;br /&gt;
 $ exec ''command'' ''options''&lt;br /&gt;
&lt;br /&gt;
 $ exec tcsh&lt;br /&gt;
&lt;br /&gt;
 $ exec ssh ''user@otherhost''&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[bash]]&lt;br /&gt;
* [[tcsh]]&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
&lt;br /&gt;
*[http://man.linuxquestions.org/index.php?query=exec&amp;amp;section=3&amp;amp;type=2 exec() function man page]&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Chsh&amp;diff=8313</id>
		<title>Chsh</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Chsh&amp;diff=8313"/>
		<updated>2004-04-27T13:39:10Z</updated>

		<summary type="html">&lt;p&gt;Snags: Minor formatting, wording changes, link manpage.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''chsh''' is a command to change your login [[shell]].&lt;br /&gt;
&lt;br /&gt;
Usage:&lt;br /&gt;
 $ chsh [''-s shell''] [''user'']&lt;br /&gt;
&lt;br /&gt;
One important thing to keep in mind is that the full path to the shell must be listed in the file &amp;lt;tt&amp;gt;/etc/shells&amp;lt;/tt&amp;gt; in order to be recognized as valid, so you may need to become [[root]] in order to add it. Then, under either the [[user]] or root [[User account|account]], issue the &amp;lt;tt&amp;gt;chsh&amp;lt;/tt&amp;gt; command. (Root can change anyone's shell, but users can only change their own.)&lt;br /&gt;
&lt;br /&gt;
The full path to the desired shell must be specified as in this example:&lt;br /&gt;
&lt;br /&gt;
 $ chsh -s /usr/local/bin/zsh&lt;br /&gt;
&lt;br /&gt;
You will be asked for your [[password]] after the command, in the event you left yourself logged in and walked away from your keyboard.&lt;br /&gt;
&lt;br /&gt;
After &amp;lt;tt&amp;gt;chsh&amp;lt;/tt&amp;gt; finishes, you are returned to your original shell and must logout and login again (or use [[exec]] to change shells).  On your next [[login]], you will be running your new shell.&lt;br /&gt;
&lt;br /&gt;
Called without arguments, &amp;lt;tt&amp;gt;chsh&amp;lt;/tt&amp;gt; presents one of the following dialogs:&lt;br /&gt;
&lt;br /&gt;
 $ chsh&lt;br /&gt;
 Password: &lt;br /&gt;
 Changing the login shell for ''user''&lt;br /&gt;
 Enter the new value, or press return for the default&lt;br /&gt;
         Login Shell [''/path/to/shell'']: &lt;br /&gt;
&lt;br /&gt;
 $ chsh&lt;br /&gt;
 Changing shell for ''user''.&lt;br /&gt;
 Password:&lt;br /&gt;
 New shell [''/path/to/old/shell'']:&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;-l&amp;lt;/tt&amp;gt; option lists the valid shells (same as &amp;lt;tt&amp;gt;cat /etc/shells&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Last tip - don't &amp;lt;tt&amp;gt;chsh&amp;lt;/tt&amp;gt; to a restricted shell or you won't be able to change out again without root privileges.&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
&lt;br /&gt;
*[http://man.linuxquestions.org/index.php?query=chsh&amp;amp;section=0&amp;amp;type=2 chsh man page]&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Awk&amp;diff=8483</id>
		<title>Awk</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Awk&amp;diff=8483"/>
		<updated>2004-04-25T23:05:47Z</updated>

		<summary type="html">&lt;p&gt;Snags: Not really a stub any more.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''awk''' is a C-like text processing scripting language originally created in 1977 at AT&amp;amp;T Bell Laboratories by Alfred V. Aho, Peter J. Weinberger, and Brian W. Kernighan.  In its modern [[GNU]] incarnation, it implements regular expressions, redirection (including bidirectional communication with coprocesses), user-defined functions, arrays, TCP/IP networking, and floating point math, among other things.  [[Awk tips]] provides some quick-and-dirty awk scripts.&lt;br /&gt;
&lt;br /&gt;
==Usage==&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;tt&amp;gt;awk&amp;lt;/tt&amp;gt; is run, it is given two forms of input, the ''program'' and the ''data''.  The program can be typed directly on the [[command line]] or stored in a file and accessed with the &amp;lt;tt&amp;gt;-f&amp;lt;/tt&amp;gt; option.  The data comes from [[file]]s listed on the command line or from [[stdin]] if none are listed.  The first example has the script on the command line with input from a file, while the second example uses an external program to create the input data and pipes into &amp;lt;tt&amp;gt;awk&amp;lt;/tt&amp;gt;, which uses an external script as the program.&lt;br /&gt;
&lt;br /&gt;
 $ awk '{ print $1; }' ''datafile''&lt;br /&gt;
&lt;br /&gt;
 $ ''makedata'' | awk -f ''myscript.awk''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;awk&amp;lt;/tt&amp;gt; scripts that are saved in files can be executed directly by placing the proper [[shebang]] line at the beginning:&lt;br /&gt;
 #!/bin/awk -f&lt;br /&gt;
'''Important note:''' use the exact path of your awk (available from typing &amp;quot;&amp;lt;tt&amp;gt;[[which]] awk&amp;lt;/tt&amp;gt;&amp;quot;) if it is not named &amp;lt;tt&amp;gt;/bin/awk&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Language structure==&lt;br /&gt;
&lt;br /&gt;
An awk program consists of a series of statements each consisting of a  ''pattern'' and an ''action''.  Awk reads the input (whether [[file]]s or data [[pipe]]d from [[stdin]]) line-by-line automatically.  For each line of data, if the ''pattern'' is true, the ''action'' is executed.  There are a few special patterns.  The &amp;lt;tt&amp;gt;BEGIN&amp;lt;/tt&amp;gt; rule is executed first, before any input is read, and the &amp;lt;tt&amp;gt;END&amp;lt;/tt&amp;gt; rule is executed last, after the end of all input.  Some complicated awk scripts consist of only a &amp;lt;tt&amp;gt;BEGIN&amp;lt;/tt&amp;gt; rule and use &amp;lt;tt&amp;gt;getline&amp;lt;/tt&amp;gt; to read the input data.  If ''pattern'' is empty, the ''action'' is always executed.  If ''action'' is empty, awk echos the line.&lt;br /&gt;
&lt;br /&gt;
The pattern can be a [[regular expression]] enclosed in slashes ('/'), in which case it is considered true if the input line matches (i.e. contains matching text) the pattern.  The expression &amp;lt;tt&amp;gt;/^[^#]/&amp;lt;/tt&amp;gt; would select all lines not beginning with a pound sign.  The pattern could also be an awk expression, e.g. &amp;lt;tt&amp;gt;(NF&amp;amp;gt;5)&amp;lt;/tt&amp;gt; to select all lines with more than 5 words.&lt;br /&gt;
&lt;br /&gt;
Whenever a line of input is read (whether automatically or with &amp;lt;tt&amp;gt;getline&amp;lt;/tt&amp;gt; [http://www.gnu.org/software/gawk/manual/html_node/Getline.html]), the line is split into words.  The first word is assigned to &amp;lt;tt&amp;gt;$1&amp;lt;/tt&amp;gt;, the second &amp;lt;tt&amp;gt;$2&amp;lt;/tt&amp;gt;, etc.  This makes it easy for awk to deal with columns of data.  The variable &amp;lt;tt&amp;gt;NF&amp;lt;/tt&amp;gt; is set to the number of words.  &amp;lt;tt&amp;gt;$&amp;lt;/tt&amp;gt; is an awk operator, so the &amp;quot;number&amp;quot; can be the result of any expression.  &amp;lt;tt&amp;gt;$NF&amp;lt;/tt&amp;gt; is the last word on the line.&lt;br /&gt;
&lt;br /&gt;
For a complete description of the language, see the GNU awk manual [http://www.gnu.org/software/gawk/manual/html_node/index.html].&lt;br /&gt;
&lt;br /&gt;
==GNU Awk extensions==&lt;br /&gt;
&lt;br /&gt;
Things to be careful about when using a &amp;lt;tt&amp;gt;gawk&amp;lt;/tt&amp;gt; script in a non-GNU awk include:&lt;br /&gt;
* Special files like &amp;lt;tt&amp;gt;/dev/stderr&amp;lt;/tt&amp;gt;, useful for printing error messages.&lt;br /&gt;
* The &amp;lt;tt&amp;gt;systime()&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;strftime()&amp;lt;/tt&amp;gt; functions.&lt;br /&gt;
* The &amp;lt;tt&amp;gt;nextfile&amp;lt;/tt&amp;gt; statement.&lt;br /&gt;
* &amp;lt;tt&amp;gt;delete ARRA&amp;lt;/tt&amp;gt; to delete an entire array.&lt;br /&gt;
* The &amp;lt;tt&amp;gt;gensub()&amp;lt;/tt&amp;gt; function.&lt;br /&gt;
* Bidirectional pipes to coprocesses.&lt;br /&gt;
This list is not comprehensive; the gawk manual (below) has more info.&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
&lt;br /&gt;
* [http://www.gnu.org/software/gawk/manual/html_node/index.html gawk manual] - Excellent reference, especially the sections on Reading Files, Expressions, and Functions.&lt;br /&gt;
*[http://man.linuxquestions.org/index.php?query=gawk&amp;amp;section=0&amp;amp;type=2 gawk man page]&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Awk&amp;diff=8274</id>
		<title>Awk</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Awk&amp;diff=8274"/>
		<updated>2004-04-25T23:04:49Z</updated>

		<summary type="html">&lt;p&gt;Snags: Brief usage&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''awk''' is a C-like text processing scripting language originally created in 1977 at AT&amp;amp;T Bell Laboratories by Alfred V. Aho, Peter J. Weinberger, and Brian W. Kernighan.  In its modern [[GNU]] incarnation, it implements regular expressions, redirection (including bidirectional communication with coprocesses), user-defined functions, arrays, TCP/IP networking, and floating point math, among other things.  [[Awk tips]] provides some quick-and-dirty awk scripts.&lt;br /&gt;
&lt;br /&gt;
==Usage==&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;tt&amp;gt;awk&amp;lt;/tt&amp;gt; is run, it is given two forms of input, the ''program'' and the ''data''.  The program can be typed directly on the [[command line]] or stored in a file and accessed with the &amp;lt;tt&amp;gt;-f&amp;lt;/tt&amp;gt; option.  The data comes from [[file]]s listed on the command line or from [[stdin]] if none are listed.  The first example has the script on the command line with input from a file, while the second example uses an external program to create the input data and pipes into &amp;lt;tt&amp;gt;awk&amp;lt;/tt&amp;gt;, which uses an external script as the program.&lt;br /&gt;
&lt;br /&gt;
 $ awk '{ print $1; }' ''datafile''&lt;br /&gt;
&lt;br /&gt;
 $ ''makedata'' | awk -f ''myscript.awk''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;awk&amp;lt;/tt&amp;gt; scripts that are saved in files can be executed directly by placing the proper [[shebang]] line at the beginning:&lt;br /&gt;
 #!/bin/awk -f&lt;br /&gt;
'''Important note:''' use the exact path of your awk (available from typing &amp;quot;&amp;lt;tt&amp;gt;[[which]] awk&amp;lt;/tt&amp;gt;&amp;quot;) if it is not named &amp;lt;tt&amp;gt;/bin/awk&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Language structure==&lt;br /&gt;
&lt;br /&gt;
An awk program consists of a series of statements each consisting of a  ''pattern'' and an ''action''.  Awk reads the input (whether [[file]]s or data [[pipe]]d from [[stdin]]) line-by-line automatically.  For each line of data, if the ''pattern'' is true, the ''action'' is executed.  There are a few special patterns.  The &amp;lt;tt&amp;gt;BEGIN&amp;lt;/tt&amp;gt; rule is executed first, before any input is read, and the &amp;lt;tt&amp;gt;END&amp;lt;/tt&amp;gt; rule is executed last, after the end of all input.  Some complicated awk scripts consist of only a &amp;lt;tt&amp;gt;BEGIN&amp;lt;/tt&amp;gt; rule and use &amp;lt;tt&amp;gt;getline&amp;lt;/tt&amp;gt; to read the input data.  If ''pattern'' is empty, the ''action'' is always executed.  If ''action'' is empty, awk echos the line.&lt;br /&gt;
&lt;br /&gt;
The pattern can be a [[regular expression]] enclosed in slashes ('/'), in which case it is considered true if the input line matches (i.e. contains matching text) the pattern.  The expression &amp;lt;tt&amp;gt;/^[^#]/&amp;lt;/tt&amp;gt; would select all lines not beginning with a pound sign.  The pattern could also be an awk expression, e.g. &amp;lt;tt&amp;gt;(NF&amp;amp;gt;5)&amp;lt;/tt&amp;gt; to select all lines with more than 5 words.&lt;br /&gt;
&lt;br /&gt;
Whenever a line of input is read (whether automatically or with &amp;lt;tt&amp;gt;getline&amp;lt;/tt&amp;gt; [http://www.gnu.org/software/gawk/manual/html_node/Getline.html]), the line is split into words.  The first word is assigned to &amp;lt;tt&amp;gt;$1&amp;lt;/tt&amp;gt;, the second &amp;lt;tt&amp;gt;$2&amp;lt;/tt&amp;gt;, etc.  This makes it easy for awk to deal with columns of data.  The variable &amp;lt;tt&amp;gt;NF&amp;lt;/tt&amp;gt; is set to the number of words.  &amp;lt;tt&amp;gt;$&amp;lt;/tt&amp;gt; is an awk operator, so the &amp;quot;number&amp;quot; can be the result of any expression.  &amp;lt;tt&amp;gt;$NF&amp;lt;/tt&amp;gt; is the last word on the line.&lt;br /&gt;
&lt;br /&gt;
For a complete description of the language, see the GNU awk manual [http://www.gnu.org/software/gawk/manual/html_node/index.html].&lt;br /&gt;
&lt;br /&gt;
==GNU Awk extensions==&lt;br /&gt;
&lt;br /&gt;
Things to be careful about when using a &amp;lt;tt&amp;gt;gawk&amp;lt;/tt&amp;gt; script in a non-GNU awk include:&lt;br /&gt;
* Special files like &amp;lt;tt&amp;gt;/dev/stderr&amp;lt;/tt&amp;gt;, useful for printing error messages.&lt;br /&gt;
* The &amp;lt;tt&amp;gt;systime()&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;strftime()&amp;lt;/tt&amp;gt; functions.&lt;br /&gt;
* The &amp;lt;tt&amp;gt;nextfile&amp;lt;/tt&amp;gt; statement.&lt;br /&gt;
* &amp;lt;tt&amp;gt;delete ARRA&amp;lt;/tt&amp;gt; to delete an entire array.&lt;br /&gt;
* The &amp;lt;tt&amp;gt;gensub()&amp;lt;/tt&amp;gt; function.&lt;br /&gt;
* Bidirectional pipes to coprocesses.&lt;br /&gt;
This list is not comprehensive; the gawk manual (below) has more info.&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
&lt;br /&gt;
* [http://www.gnu.org/software/gawk/manual/html_node/index.html gawk manual] - Excellent reference, especially the sections on Reading Files, Expressions, and Functions.&lt;br /&gt;
*[http://man.linuxquestions.org/index.php?query=gawk&amp;amp;section=0&amp;amp;type=2 gawk man page]&lt;br /&gt;
&lt;br /&gt;
''This article is a [[LinuxQuestions.org_Wiki:stub_articles|stub]] and needs to be finished. [[LinuxQuestions.org_Wiki:plunging_forward|Plunge forward]] and [[LinuxQuestions.org_Wiki:How_to_edit_a_page|help it grow]] !''&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Shebang&amp;diff=15798</id>
		<title>Shebang</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Shebang&amp;diff=15798"/>
		<updated>2004-04-25T23:00:30Z</updated>

		<summary type="html">&lt;p&gt;Snags: Add awk to shebang list.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Snags</name></author>
	</entry>
</feed>