<?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=HadroLepton</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=HadroLepton"/>
	<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/wiki/Special:Contributions/HadroLepton"/>
	<updated>2026-04-17T13:30:30Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.37.0</generator>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Dd&amp;diff=34123</id>
		<title>Dd</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Dd&amp;diff=34123"/>
		<updated>2007-06-19T10:08:02Z</updated>

		<summary type="html">&lt;p&gt;HadroLepton: revert&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The '''&amp;lt;tt&amp;gt;dd&amp;lt;/tt&amp;gt;''' 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;
&amp;lt;tt&amp;gt;dd&amp;lt;/tt&amp;gt; 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;
&amp;lt;tt&amp;gt;dd&amp;lt;/tt&amp;gt; may also be used to extract data from or insert data into arbitrary positions in a file.  This can be useful as a way of working with binary files from the command line.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
The main options to be concerned about are if= (input file) and of= (output file). By default, &amp;lt;tt&amp;gt;dd&amp;lt;/tt&amp;gt; reads from [[stdin]] and writes to [[stdout]]. Here are some examples of how dd may be used:&lt;br /&gt;
&lt;br /&gt;
===Creating a hard drive backup directly to another hard drive ===&lt;br /&gt;
&lt;br /&gt;
 # dd if=/dev/hda of=/dev/sda conv=noerror,sync bs=4k&lt;br /&gt;
&lt;br /&gt;
This command is used often to create a backup of a drive (/dev/hda) directly to another hard drive (/dev/sda). (The device name /dev/hda is typical of an IDE hard drive, the device /dev/sda is typical of a USB disk.) This works only if the hard drive has enough storage to accommodate the source drive's filesystem. The advantage of this is that you do not have to mount the hard drive to make a backup and the only reference to hda is in /dev and in the command which is usually in a script in cron.&lt;br /&gt;
&lt;br /&gt;
The option &amp;quot;bs=4k&amp;quot; is used to specify the block size used in the copy.  The default for the dd command is 512 bytes: use of this small block size can result in significantly slower copying.  However, the tradeoff with larger block sizes is that when an error is encountered, the remainder of  the block is filled with zero-bytes.  So if you increase your block size when copying a failing device, you'll lose more data but also spend less time trying to read broken sectors.  Tools like [[dd_rescue]] and [[dd_rhelp]] can provide a more flexible solution in such cases, combining the speed of a large block size for the regions without errors with finer-grained block-copies for regions with errors.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Creating a hard drive backup image===&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 &amp;lt;tt&amp;gt;dd&amp;lt;/tt&amp;gt; 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;
===Copy floppy===&lt;br /&gt;
 # dd if=/dev/fd0 of=/tmp/floppy.img bs=10240&lt;br /&gt;
&lt;br /&gt;
That will copy the contents of the floppy to a file. Then, to put the image onto a new floppy, swap &amp;quot;if&amp;quot; and &amp;quot;of&amp;quot; params.&lt;br /&gt;
&lt;br /&gt;
 # dd if=/tmp/floppy.img of=/dev/fd0 bs=10240&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;
Obviously, if you have a [[GPT]] system (like the intel mac for instance) this will need some adjustment.&lt;br /&gt;
&lt;br /&gt;
see: http://forum.onmac.net/showthread.php?t=136&lt;br /&gt;
&lt;br /&gt;
You can backup only the MBR and exclude the partition table with the command:&lt;br /&gt;
&lt;br /&gt;
  # dd if=/dev/hda of=/root/hda.mbr.noparttab bs=446 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 various file size limitations. One way to work around a given file size limitation 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;
===Creating empty disk images===&lt;br /&gt;
&lt;br /&gt;
To create an empty disk image, to be used as the disk for an emulator for example, one can get data from /dev/zero. To create a 10mb image: &lt;br /&gt;
&lt;br /&gt;
 $ dd if=/dev/zero of=myimage bs=1024 count=10240&lt;br /&gt;
&lt;br /&gt;
A clever alternative is:&lt;br /&gt;
&lt;br /&gt;
 $ dd of=myimage bs=1024 count=0 seek=10240&lt;br /&gt;
&lt;br /&gt;
Here we don't write anything, not even zeroes, we just seek 10mb into the file and close it. The result is a sparse file that is implicitly full of 10mb of zeroes, but that takes no disk space. &amp;lt;tt&amp;gt;[[ls]] -l&amp;lt;/tt&amp;gt; will report 10mb, while &amp;lt;tt&amp;gt;[[du]]&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;[[df]]&amp;lt;/tt&amp;gt; will report 0. When the file is written to, either as an emulator disk or a loopback device, Linux will allocate disk space for the data. &amp;lt;tt&amp;gt;ls&amp;lt;/tt&amp;gt; will still show 10mb, while &amp;lt;tt&amp;gt;du&amp;lt;/tt&amp;gt; will gradually approach 10mb. &lt;br /&gt;
&lt;br /&gt;
For swap images, where it's more important to reserve the data than to save disk space, a non-sparse file is better.&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;
&amp;lt;!--&lt;br /&gt;
''Though how one would deprecate such a useful tool without providing a replacement is beyond me.'' [[User:Crazyeddie|Crazyeddie]] 04:20, Jul 28, 2004 (EDT)--&amp;gt;&lt;br /&gt;
Although deprecated, &amp;lt;tt&amp;gt;dd&amp;lt;/tt&amp;gt; is still widely in use on many systems.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[image]]&lt;br /&gt;
* [[Blanking a hard drive]]&lt;br /&gt;
* [[rawrite]]&lt;br /&gt;
* [[dd_rescue]] recover media with errors on it.&lt;br /&gt;
* [[Cloning]]&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] (''man.linuxquestions.org'')&lt;br /&gt;
* [http://www.debianhelp.co.uk/ddcommand.htm Taking Backup With dd Command] (''www.debianhelp.co.uk'')&lt;br /&gt;
&lt;br /&gt;
* [http://www.linuxquestions.org/linux/answers/Applications_GUI_Multimedia/How_To_Do_Eveything_With_DD How To Do Eveything With DD] (''www.linuxquestions.org'')&lt;br /&gt;
&lt;br /&gt;
* [http://www.linuxquestions.org/questions/showthread.php?s=&amp;amp;postid=1848006 LQ Thread] (''www.linuxquestions.org'')&lt;br /&gt;
This is the most comprehensive documentation and example sheet for one of the most useful, and least understood linux commands, called &amp;quot;dd&amp;quot;. This command has been part of UNIX since the 1970's. It is a bitstream duplicator for copying data, but can use input or output pipes to another command.&lt;br /&gt;
&lt;br /&gt;
:{{Jargon File/Attribution}}&lt;/div&gt;</summary>
		<author><name>HadroLepton</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Dos2Unix&amp;diff=25255</id>
		<title>Dos2Unix</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Dos2Unix&amp;diff=25255"/>
		<updated>2004-11-08T02:15:38Z</updated>

		<summary type="html">&lt;p&gt;HadroLepton: redirect redirect&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Unix2dos]]&lt;/div&gt;</summary>
		<author><name>HadroLepton</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Unix2dos&amp;diff=24963</id>
		<title>Unix2dos</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Unix2dos&amp;diff=24963"/>
		<updated>2004-11-08T02:14:20Z</updated>

		<summary type="html">&lt;p&gt;HadroLepton: wiki linked line seperator&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Unix2dos and its partner, [[Dos2unix]] are two text processor applications which convert [[Line separator|line endings]] of plaintext files.&lt;br /&gt;
&lt;br /&gt;
Unix2dos converts standard UNIX line endings (\n) to DOS/Mac line endings (\n\r). Dos2unix is the reverse of this operation.&lt;br /&gt;
&lt;br /&gt;
These utilities are fairly standard in most GNU-based distributions, but they do not appear to have their own home page.&lt;/div&gt;</summary>
		<author><name>HadroLepton</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Dos2unix&amp;diff=24964</id>
		<title>Dos2unix</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Dos2unix&amp;diff=24964"/>
		<updated>2004-11-08T02:11:40Z</updated>

		<summary type="html">&lt;p&gt;HadroLepton: redirect&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Unix2dos]]&lt;/div&gt;</summary>
		<author><name>HadroLepton</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Dos2Unix&amp;diff=13781</id>
		<title>Dos2Unix</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Dos2Unix&amp;diff=13781"/>
		<updated>2004-11-08T02:10:38Z</updated>

		<summary type="html">&lt;p&gt;HadroLepton: redirect&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Dos2unix]]&lt;/div&gt;</summary>
		<author><name>HadroLepton</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Unix2Dos&amp;diff=25254</id>
		<title>Unix2Dos</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Unix2Dos&amp;diff=25254"/>
		<updated>2004-11-08T02:09:50Z</updated>

		<summary type="html">&lt;p&gt;HadroLepton: redirect&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Unix2dos]]&lt;/div&gt;</summary>
		<author><name>HadroLepton</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=File_extension&amp;diff=10414</id>
		<title>File extension</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=File_extension&amp;diff=10414"/>
		<updated>2004-06-05T23:25:15Z</updated>

		<summary type="html">&lt;p&gt;HadroLepton: wiki linked shebang&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A '''file extension''' is a more or less arbitrary component of a filename, used to identify the type. Due to DOS and Windows' widespread and fairly consistent use of them, they have become widely known and there is wide consensus on them, with subtle variations. A failing of file extensions is that any extension can be applied to any file, so the extension is no guarantee of contents. The extension takes the form of a 'dot' and various letters, usually three, appended to the filename. For a list of commonly used file extensions, see [[List of file extensions]].&lt;br /&gt;
&lt;br /&gt;
==DOS==&lt;br /&gt;
&lt;br /&gt;
DOS filenames supported a maximum of eight characters and, optionally, an extension up to three letters separated by a dot. The most familiar example would probably be 'AUTOEXEC.BAT' (DOS was all uppercase.) This extension had the rare feature of being meaningful to the operating system. Since DOS did not have an executable permission bit, this was the how the system knew to execute a non-binary executable. Rename foo.bat to foo.baz and it would not run. Most extensions were made up by the user (MYLETTER.LTR) or generated by the application on a per-application basis (MYDATA.DBF). Since DOS was a command line system, the extension didn't matter for many things but, with text interface shells (file managers), extensions could be 'associated' with applications, such that hitting 'enter' on a .TXT file would open that file in EDIT, for instance.&lt;br /&gt;
&lt;br /&gt;
==Windows==&lt;br /&gt;
&lt;br /&gt;
With the introducton of DOS7/Windows4 (Windows 95) the 8.3 restriction was removed and filenames like 'ReallyLongFilename.html' were possible. If a DOS user downloaded a set of webpages full of links to 'html' pages while his system could only save them as .HTM, the links would be broken. However, as the file format is actually called 'HyperText Markup Language' and HML somehow escaped people, '.html' has become the dominant extension. The same applies to .JPG --&amp;gt; .jpeg, except that .jpg seems to have remained standard.&lt;br /&gt;
&lt;br /&gt;
==Linux==&lt;br /&gt;
&lt;br /&gt;
Given Unix's &amp;quot;Everything Is A File&amp;quot; philosophy, file extensions are a late comer to the Unix/Linux world. Restricting a file to only be used with only a certain program (or type of program), or even suggesting that a file be used with a certain program, would go against that philosophy. However, over time file extensions, or at least file [[naming conventions]], have been introduced without quite elaborating it into a logical, consistent, and useful semi-standard. Examples include:&lt;br /&gt;
&lt;br /&gt;
* Many configuration files such as 'bashrc' end in 'rc' without a dot and many configuration files don't. &lt;br /&gt;
&lt;br /&gt;
* ~ - Not strictly an extension, as it's appended to a file with or without an extension (letter~, letter.txt~) usually indicates a backup file.&lt;br /&gt;
&lt;br /&gt;
* Gcc expects a C source file to end in dot-C (mysource.c). &lt;br /&gt;
&lt;br /&gt;
* The shell has the capacity to execute a shell script whatever its name, due to its executable bit, but some text editors implement syntax highlighting on a simplistic check for a '.sh' extension, rather than looking to the [[shebang]] magic number (the characteristic sequence of #!). So some shell scripts may have the .sh extension and some may not. &lt;br /&gt;
&lt;br /&gt;
* Many non-Microsoft formats such as X pixmaps have long been known by the '.xpm' extension. &lt;br /&gt;
&lt;br /&gt;
Overall, Unix/Linux file extension development has been fairly random.&lt;br /&gt;
&lt;br /&gt;
Since extensions are so useful and indicative, and as Unix/Linux has become increasingly graphically oriented (thus needing to execute applications and load files indirectly), extensions have become more prevalent and naturalized.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[file prefixes]]&lt;br /&gt;
&lt;br /&gt;
* [[MIME]]&lt;/div&gt;</summary>
		<author><name>HadroLepton</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Bash&amp;diff=8484</id>
		<title>Bash</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Bash&amp;diff=8484"/>
		<updated>2004-04-18T22:20:45Z</updated>

		<summary type="html">&lt;p&gt;HadroLepton: added external link: prompt magic&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;
&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;
&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;
&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;
&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;
==External links ==&lt;br /&gt;
&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>HadroLepton</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Talk:Etc_files&amp;diff=22423</id>
		<title>Talk:Etc files</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Talk:Etc_files&amp;diff=22423"/>
		<updated>2004-04-14T13:58:10Z</updated>

		<summary type="html">&lt;p&gt;HadroLepton: suggestion to reduce ambiguity&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;shouldn't this page be called 'Etc_files'?&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Yeah, I think so. &lt;br /&gt;
&lt;br /&gt;
BTW, please sign your name to talks (not to articles) with three/four tildes. :)&lt;br /&gt;
&lt;br /&gt;
[[User:Digiot|Digiot]] 17:21, Mar 16, 2004 (EST)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I just reverted the page. I think the overall look and the introductory paragraph was definitely better. And we need to think about linking these things. Including slashes in link names kinda gunks up the works but *not* doing will lead to ambiguity, like with 'hosts', I'd imagine. And how would subdirectories be treated? In a way, it seems better not to link the files, themselves, but provide side links to relevant commands. Like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;lilo.conf (See [[LILO]])&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thoughts, ideas, opinions, wild flights of fancy?&lt;br /&gt;
&lt;br /&gt;
[[User:Digiot|Digiot]] 17:31, Mar 16, 2004 (EST)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
how about '''file:hosts''' as page name. like this [[file:hosts|/etc/hosts]]. that would keep the files in the etc folder separate from the more general topics with same name.&lt;br /&gt;
&lt;br /&gt;
i think a dedicated page for each of the files is warranted. because it is often required to edit these files by hand and then it would be nice if there is a reference for the syntax and keywords required for the file.&lt;br /&gt;
&lt;br /&gt;
[[User:HadroLepton|HadroLepton]] 09:58, Apr 14, 2004 (EDT)&lt;/div&gt;</summary>
		<author><name>HadroLepton</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Line_separator&amp;diff=22944</id>
		<title>Line separator</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Line_separator&amp;diff=22944"/>
		<updated>2004-04-13T21:03:48Z</updated>

		<summary type="html">&lt;p&gt;HadroLepton: made some corrections, added mac carriage return&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Linux, like Unix, uses a single line feed character (LF, \n, [[ASCII]] 0x0A) to indicate End of Line. &lt;br /&gt;
&lt;br /&gt;
[[DOS]] and [[Windows]] uses a carriage return followed by a line feed (CRLF, \r\n, 0x0D 0x0A), which is generally accepted as the standard (with no lobbying on Microsoft's part). &lt;br /&gt;
&lt;br /&gt;
[[Mac]] uses only a carriage return (CR, \r, 0x0D) for an end of line.&lt;br /&gt;
&lt;br /&gt;
Conversion between the different formats are handled transparently in most editors, and can be done manually using the [[Unix2Dos]] and [[Dos2Unix]] utilities.&lt;br /&gt;
&lt;br /&gt;
Technically, carriage return is an [[ASCII]] code to make the carriage (a [[dot-matrix]] printer's head) return to the beginning of the line, while line feed tells it to scroll one step down to the next line.&lt;/div&gt;</summary>
		<author><name>HadroLepton</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=User:HadroLepton&amp;diff=23760</id>
		<title>User:HadroLepton</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=User:HadroLepton&amp;diff=23760"/>
		<updated>2004-04-11T01:07:34Z</updated>

		<summary type="html">&lt;p&gt;HadroLepton: me the linux n00b&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;i am still linux n00b but i am learning&lt;/div&gt;</summary>
		<author><name>HadroLepton</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Shadow_file&amp;diff=23733</id>
		<title>Shadow file</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Shadow_file&amp;diff=23733"/>
		<updated>2004-04-08T23:50:58Z</updated>

		<summary type="html">&lt;p&gt;HadroLepton: redirect to shadow&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Shadow]]&lt;/div&gt;</summary>
		<author><name>HadroLepton</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Shadow&amp;diff=7813</id>
		<title>Shadow</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Shadow&amp;diff=7813"/>
		<updated>2004-04-08T23:49:58Z</updated>

		<summary type="html">&lt;p&gt;HadroLepton: ported from shadow file&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The '''shadow''' file (/etc/shadow) stores passwords and expiry dates in encrypted form in a colon-delimited text file akin to /etc/passwd - which formerly held unencrypted passwords and now contains all kinds of information about users ''except'' the password.&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
This should '''not''' be readable by a regular user. If a user can see this file, they can copy your password hashes, and attempt a [[brute force crack]]. Permissions should be something like:&lt;br /&gt;
&lt;br /&gt;
 -rw-r-----    1 root     shadow        size date /etc/shadow&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 -rw-------    1 root     root          size date /etc/shadow&lt;br /&gt;
&lt;br /&gt;
==See also== &lt;br /&gt;
* [[Security]]&lt;br /&gt;
* [[User Commands]]&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>HadroLepton</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Etc_files&amp;diff=7814</id>
		<title>Etc files</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Etc_files&amp;diff=7814"/>
		<updated>2004-04-08T23:49:05Z</updated>

		<summary type="html">&lt;p&gt;HadroLepton: added shadow, minor restructuring&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &amp;lt;tt&amp;gt;/etc&amp;lt;/tt&amp;gt; directory is the location on a UNIX system where system-wide configuration files and scripts are stored. Some common files in the &amp;lt;tt&amp;gt;/etc&amp;lt;/tt&amp;gt; directory are:&lt;br /&gt;
&lt;br /&gt;
==/etc==&lt;br /&gt;
&lt;br /&gt;
; [[fstab|/etc/fstab]] : Contains filesystem configuration information.&lt;br /&gt;
&lt;br /&gt;
; [[hosts|/etc/hosts]] : Configures names and aliases of IP-addresses. Fields should be separated with Tab or white space. The functionality of this file has been almost entirely replaced by the [[DNS]] protocol so a hosts file is rarely used.&lt;br /&gt;
&lt;br /&gt;
; [[inittab|/etc/inittab]] : Controls process dispatching. Basically ''the'' key system initialization file, since it's used by process 1, init.&lt;br /&gt;
&lt;br /&gt;
; [[lilo.conf|/etc/lilo.conf]] : Is the configuration file used by the Linux Loader while booting.&lt;br /&gt;
&lt;br /&gt;
; [[modules.conf|/etc/modules.conf]] : Loads modules specific options at startup.&lt;br /&gt;
&lt;br /&gt;
; [[nologin|/etc/nologin]] : Is a text file that, if it exists in /etc/, will prevent non-root users from logging in. If a user attempts to login, it will be shown the contents of the file, and then be disconnected.&lt;br /&gt;
&lt;br /&gt;
; [[nsswitch.conf|/etc/nsswitch.conf]] : Specifies how the lookup for different databases are performed and in what order. Lookups are done left to right.&lt;br /&gt;
&lt;br /&gt;
; [[printcap|/etc/printcap]] : Describes printers and allows dynamic addition and deletion of printers by the spooling system.&lt;br /&gt;
&lt;br /&gt;
; [[resolv.conf|/etc/resolv.conf]] : Configures DNS name servers to use for hostname lookups.&lt;br /&gt;
&lt;br /&gt;
; [[xinetd.conf|/etc/xinetd.conf]] : Contains the configuration for the extended internet services started by the xinetd command.&lt;br /&gt;
&lt;br /&gt;
; [[shadow|/etc/shadow]] : stores passwords and expiry dates in encrypted form.&lt;br /&gt;
&lt;br /&gt;
==/etc/sysconfig==&lt;br /&gt;
&lt;br /&gt;
; /etc/sysconfig/network : Configures the system's network. Specifies hostname and gateway.&lt;br /&gt;
&lt;br /&gt;
''Descriptions of all of these files are in Chapter 9 of the Universal Command Guide for Operating Systems but are not found in all [[Distributions|distributions]].''&lt;/div&gt;</summary>
		<author><name>HadroLepton</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Talk:Shebang&amp;diff=23696</id>
		<title>Talk:Shebang</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Talk:Shebang&amp;diff=23696"/>
		<updated>2004-04-06T02:21:19Z</updated>

		<summary type="html">&lt;p&gt;HadroLepton: what is shebang?&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;the page is titled shebang but the text doesn't really explain what a shebang is. i asume the whole #!... thing is the shebang, true? [[User:HadroLepton|HadroLepton]] 22:21, Apr 5, 2004 (EDT)&lt;/div&gt;</summary>
		<author><name>HadroLepton</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Ext2&amp;diff=8610</id>
		<title>Ext2</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Ext2&amp;diff=8610"/>
		<updated>2004-04-05T09:41:13Z</updated>

		<summary type="html">&lt;p&gt;HadroLepton: minor restructuring&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Ext2''', also called '''ext2fs''', standing for '''Second Extended Filesystem''', is a [[filesystem]] widely used as a default option by many Linux distributions. It provides standard Unix file semantics such as [[File permissions|file permissions]] and [[symbolic link|symbolic links]].&lt;br /&gt;
&lt;br /&gt;
'''[[Ext3]]''' is an enhancement to the ext2 filesystem that adds [[journalling]] support to avoid having to perform a filesystem check after a power failure or system crash.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Details=&lt;br /&gt;
*Max filename length is 255 characters. Extendable to 1012 if needed.&lt;br /&gt;
*Percentage of disk reserved for root to prevent users filling drive.&lt;br /&gt;
*Large partition support.&lt;br /&gt;
*Filesystem checks can be forced by administrator on boot, plus after a set number of boots.&lt;br /&gt;
*Advanced disk check monitoring so known when there may be problems with disk.&lt;br /&gt;
&lt;br /&gt;
=Pros=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Cons=&lt;/div&gt;</summary>
		<author><name>HadroLepton</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Mount&amp;diff=8000</id>
		<title>Mount</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Mount&amp;diff=8000"/>
		<updated>2004-04-02T11:34:53Z</updated>

		<summary type="html">&lt;p&gt;HadroLepton: made some terms to wiki links&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;mount - Attach a volume to the filesystem&lt;br /&gt;
&lt;br /&gt;
You can call mount directly from the command line, using the following general syntax:&lt;br /&gt;
&lt;br /&gt;
mount [options] [device] [dir]&lt;br /&gt;
&lt;br /&gt;
For example, you might use this command to mount a CD-ROM disc:&lt;br /&gt;
&lt;br /&gt;
mount -t iso9660 /dev/cdrom /mnt/cdrom&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt;-t iso9660&amp;lt;/b&amp;gt; option tells the system that you are mounting an iso9660 format CD-ROM.  Type &amp;lt;b&amp;gt;man fs&amp;lt;/b&amp;gt; in a shell for more information on the various [[filesystem|filesystems]].&lt;br /&gt;
&lt;br /&gt;
During the installation process, most linux distributions create a file called [[fstab|/etc/fstab]].  This file contains mount settings for the [[volume|volumes]] installed in your system.  This can make mounting drives easier.  For example, you could add a line in your /etc/fstab file for your cdrom drive:&lt;br /&gt;
&lt;br /&gt;
/dev/cdrom    /cdrom    iso9660   ro,user,noauto   0 0&lt;br /&gt;
&lt;br /&gt;
Then, when you want to mount a new CD, you would just type &amp;lt;b&amp;gt;mount cdrom&amp;lt;/b&amp;gt;.  &lt;br /&gt;
&lt;br /&gt;
By default, many linux distributions will require you to [[go root]] to mount and unmount volumes.&lt;br /&gt;
&lt;br /&gt;
For more information on the mount command, type &amp;lt;b&amp;gt;man mount&amp;lt;/b&amp;gt; at any shell prompt.&lt;br /&gt;
&lt;br /&gt;
=== Mounting an ISO image ===&lt;br /&gt;
&lt;br /&gt;
Sometimes it is useful to mount an ISO image that you made or have downloaded to be able to access or check the contents. This is possible with the following invocation:&lt;br /&gt;
&lt;br /&gt;
mount -t iso9660 -o ro,loop=/dev/loop0 NameOfISOFile MountPoint&lt;br /&gt;
&lt;br /&gt;
The MountPoint has to be a directory, as described above. You can also [[Making_an_ISO_from_CDROM|make an ISO of an existing CDROM]].&lt;/div&gt;</summary>
		<author><name>HadroLepton</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Etc_files&amp;diff=7022</id>
		<title>Etc files</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Etc_files&amp;diff=7022"/>
		<updated>2004-03-30T20:49:38Z</updated>

		<summary type="html">&lt;p&gt;HadroLepton: made filenames to wiki links&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &amp;lt;tt&amp;gt;/etc&amp;lt;/tt&amp;gt; directory is the location on a UNIX system where system-wide configuration files and scripts are stored. Some common files in the &amp;lt;tt&amp;gt;/etc&amp;lt;/tt&amp;gt; directory are:&lt;br /&gt;
&lt;br /&gt;
; [[fstab|/etc/fstab]] : Contains filesystem configuration information.&lt;br /&gt;
&lt;br /&gt;
; [[hosts|/etc/hosts]] : Configures names and aliases of IP-addresses. Fields should be separated with Tab or white space.&lt;br /&gt;
&lt;br /&gt;
; [[inittab|/etc/inittab]] : Controls process dispatching. Basically ''the'' key system initialization file, since it's used by process 1, init.&lt;br /&gt;
&lt;br /&gt;
; [[lilo.conf|/etc/lilo.conf]] : Is the configuration file used by the Linux Loader while booting.&lt;br /&gt;
&lt;br /&gt;
; [[modules.conf|/etc/modules.conf]] : Loads modules specific options at startup.&lt;br /&gt;
&lt;br /&gt;
; [[nologin|/etc/nologin]] : Is a text file that, if it exists in /etc/, will prevent non-root users from logging in. If a user attempts to login, it will be shown the contents of the file, and then be disconnected.&lt;br /&gt;
&lt;br /&gt;
; [[nsswitch.conf|/etc/nsswitch.conf]] : Specifies how the lookup for different databases are performed and in what order. Lookups are done left to right.&lt;br /&gt;
&lt;br /&gt;
; [[printcap|/etc/printcap]] : Describes printers and allows dynamic addition and deletion of printers by the spooling system.&lt;br /&gt;
&lt;br /&gt;
; [[resolv.conf|/etc/resolv.conf]] : Configures DNS name servers to use for hostname lookups.&lt;br /&gt;
&lt;br /&gt;
; /etc/sysconfig/network : Configures the system's network. Specifies hostname and gateway.&lt;br /&gt;
&lt;br /&gt;
; [[xinetd.conf|/etc/xinetd.conf]] : Contains the configuration for the extended internet services started by the xinetd command.&lt;br /&gt;
&lt;br /&gt;
''Descriptions of all of these files are in Chapter 9 of the Universal Command Guide for Operating Systems but are not found in all [[Distributions|distributions]].''&lt;/div&gt;</summary>
		<author><name>HadroLepton</name></author>
	</entry>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Cfdisk&amp;diff=7612</id>
		<title>Cfdisk</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Cfdisk&amp;diff=7612"/>
		<updated>2004-03-30T19:16:01Z</updated>

		<summary type="html">&lt;p&gt;HadroLepton: made CLI to wiki link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''cfdisk''' is an [[ncurses]]-based disk partitioning tool similar to the [[CLI]] [[fdisk]] program.  It offers a slightly more user-friendly interface than the former. Actions are perfomed by arrowing through menu options rather than typing command letters at a prompt.&lt;/div&gt;</summary>
		<author><name>HadroLepton</name></author>
	</entry>
</feed>