Click here for ObjectSpace: Business- to- Business Integration Company
home account info subscribe login search My ITKnowledge FAQ/help site map contact us


 
Brief Full
 Advanced
      Search
 Search Tips
To access the contents, click the chapter and section titles.

Complete Idiot's Guide to Linux
(Publisher: Macmillan Computer Publishing)
Author(s): Manuel Ricart
ISBN: 078971826x
Publication Date: 12/22/98

Bookmark It

Search this book:
 
Previous Table of Contents Next


Splitting Files into Smaller Files: split


Check This Out:  
Compression is discussed in Chapter 20, “Installing Programs and Applications,” in the section “UNIX Compressed Archives: Gzip and Compress.”

Say you wanted to copy a file to a floppy disk, but the file was much larger (even compressed) than could fit on a single disk. How do you deal with this? One way is to use the split command. The split command has this syntax:

     split [option] size file outfilename

The options are -l for splitting text files by line count and -b for splitting a file by byte count. After the option, you specify the size. When using the byte option, you can add a b for bytes, k for kilobytes, or m for megabytes. File is the name of the file you want to split, and outfilename is the base name the command will use to name all the chunks. Different filenames are generated by appending an extension to the file.

To split a large file into 1395K chunks so that each chunk will fit onto a standard floppy disk:

     [alberto@digital splitter]$ ls -l
     total 5801
     -rw-r--r--   1 alberto  alberto   5915554 Sep 20 11:51 book.zip
     [alberto@digital splitter]$ split -b 1395k book.zip book.zip.
     [alberto@digital splitter]$ ls -l
     total 11607
     -rw-r--r--   1 alberto  alberto   5915554 Sep 20 11:51 book.zip
     -rw-rw-r--   1 alberto  alberto   1428480 Sep 20 18:39 book.zip.aa
     -rw-rw-r--   1 alberto  alberto   1428480 Sep 20 18:39 book.zip.ab
     -rw-rw-r--   1 alberto  alberto   1428480 Sep 20 18:39 book.zip.ac
     -rw-rw-r--   1 alberto  alberto   1428480 Sep 20 18:39 book.zip.ad
     -rw-rw-r--   1 alberto  alberto    201634 Sep 20 18:39 book.zip.ae

There’s no join command, so to join the file into one large file, use a command you already know, cat:

     cat book.zip.?? > book.zip

The files will be catenated (copied) together into one big file. The expression ?? matches any two characters (aa through ae in the previous example). This works because the shell orders the files alphabetically, so ab is guaranteed to follow aa.

Accessing a Computer Through the Network: telnet

The telnet command allows you to log in to a remote computer using a shell. For all practical purposes, you are working on a console on the remote computer, and you can use any command just as though you were physically at the keyboard of the computer in question. The telnet command is very easy to use: Just type telnet followed by the host name of the system with which you want to work. This will present you with a login prompt much the same as the ones you have been using in the past few sections.

One thing with telnet sessions is that sometimes your keyboard won’t behave the way that it ought to. To fix this problem, see the sidebar discussion on the stty command in Chapter 13, “Text Editing Under a Shell.”

To exit from a telnet session, type exit or press Ctrl+D at your prompt.

Working on the Console: setfont

If you are working using a text interface on a EGA/VGA console, you might wonder why you cannot see more than 24 lines of text. Well, there’s a way of fixing that: the setfont command.

The setfont command changes the font used by the console to a different size. Changing the size of the font also changes the maximum line width and the number of lines you can see; therefore, the font you select will determine your visible working space.

A number of fonts are installed in the /usr/lib/kbd/consolefonts directory. The font files are named using a type; typically, you’ll want to pick one whose name starts with default (as the type of characters will change depending on the fonts) and a size. Standard VGA font size is 16 (16 pixels tall), so using a smaller font will make a huge difference. The font type/size combination also affects readability quite a bit, and different fonts of the same size will look very different on the screen. Some font files contain all three sizes: 8, 14, and 16. To specify the correct size, just provide a dash (-) followed by the size (setfont will prompt you when it’s needed). If your screen goes nuts, just enter setfont again to return to your default setting.

To change a font, specify the name of the font file (you don’t need to give the full path):

     setfont fontname

One of the more popular fonts which will increase your display size considerably is selected using:

     Setfont /usr/lib/kbd/consolefonts/alt-8x8

Experiment with different types and sizes until you find one that feels most readable to you.


Previous Table of Contents Next


Products |  Contact Us |  About Us |  Privacy  |  Ad Info  |  Home

Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.