Explore

Loading

Friday, February 10, 2012

Converting Text Files between DOS and Linux

In all versions of DOS (and all subsequent versions of Microsoft Windows), text files are normally written
with both a linefeed character and a newline, both "invisible" control characters, to signify the end of each
line. In Linux and other unices, text files have only the newline character.
In either of these operating systems, text files that originated from the other may display irregularly−−in DOS
and Windows, the lines of a Linux text file may appear to run together; in Linux, a DOS or Windows text file
may have `^M' newline characters at the end of each line.
To convert a text file from DOS to Linux, removing the `^M' newline characters in the file, use
`fromdos'. It converts the file you give as an argument, removing the newline characters from the ends of
all its lines.
To convert a text file from Linux to the convention used by DOS and Windows, use todos. It adds newline
characters to the ends of all lines in the file you give as an argument.
· To remove the newline characters from the text file `autoexec.bat', type:
$ fromdos autoexec.bat RET
· To add newline characters to all of the text files with a `.tex' extension in the current directory,
type:
$ todos *.tex RET
NOTE: Both commands directly write to the files you specify. To make a backup of the original file, use the
`−b' option; before the conversion, this writes a copy of each specified file with a `.bak' file name
extension.
The Linux Cookbook: Tips and Techniques for Everyday Use:
27.

Boot Loader


In order for the BIOS to load an OS it looks for instructions on the first sector of a hard drive.
On the first sector of the hard drive resides the master boot record (MBR), and is where a boot loader is initialized.
Depending on the boot loader, additional files may be stored and read from a partition on the hard drive.
After this step the boot loader begins to start the operating system, and is not used again until the next boot.

How Linux Disk Partition?

IDE Disk Partitions
/dev/hda (Primary Master Disk)
/dev/hda1 (First Primary Partition)
/dev/hda2 (Second Primary Partition)
/dev/hdb (Primary Slave Partition)
/dev/hdb1
/dev/hdc (Secondary Master/Slave Partition)
/dev/hdc1
SCSI Disk Partitions
/dev/sda1, /dev/sda2
/dev/sdb1, /dev/sdb2
/dev/sdc1, /dev/sdc2

Linux Partitioning Scheme

  • Unless you have a reason for doing otherwise, it is recommended that you create the following partitions:
  • /boot partition – contains kernel images  and grub configuration and commands
  • / partition
  • /var partition
  • /home partition
  • Any other partition based on application (e.g /usr/local for squid)
  • swap partition — swap partitions are used to support virtual memory. In other words, data is written to a swap partition when there is not enough RAM to store the data your system is processing. The size of your swap partition should be equal to twice your computer's RAM