Docsity
Docsity

Prepare-se para as provas
Prepare-se para as provas

Estude fácil! Tem muito documento disponível na Docsity


Ganhe pontos para baixar
Ganhe pontos para baixar

Ganhe pontos ajudando outros esrudantes ou compre um plano Premium


Guias e Dicas
Guias e Dicas


100 Linux Tips And Tricks, Notas de estudo de Engenharia Química

100 Linux Tips And Tricks

Tipologia: Notas de estudo

Antes de 2010

Compartilhado em 23/08/2009

diego-xavier-pereira-https-diegoxp-
diego-xavier-pereira-https-diegoxp- 🇧🇷

4.7

(111)

224 documentos

1 / 116

Toggle sidebar

Esta página não é visível na pré-visualização

Não perca as partes importantes!

bg1
100 Linux Tips and Tricks
by Patrick Lambert
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Pré-visualização parcial do texto

Baixe 100 Linux Tips And Tricks e outras Notas de estudo em PDF para Engenharia Química, somente na Docsity!

by Patrick Lambert

Table of Contents

  • Introduction.........................................................................................................................................................
    • Copyright.................................................................................................................................................
    • About the author......................................................................................................................................
    • Aknowledgements....................................................................................................................................
    • Audience..................................................................................................................................................
    • Organization.............................................................................................................................................
    • Web resources..........................................................................................................................................
  • Installation...........................................................................................................................................................
    • What this chapter covers..........................................................................................................................
      • Tip 1: Which distribution is good for you..................................................................................
      • Tip 2: How to find a Linux CD-ROM at low cost......................................................................
      • Tip 3: Multiple operating systems..............................................................................................
      • Tip 4: Installing with no CD-ROM drive or modem..................................................................
      • Tip 5: Swap and memory............................................................................................................
      • Tip 6: More swap with a swap file...........................................................................................
      • Tip 7: Kernel size and modules................................................................................................
      • Tip 8: The boot prompt.............................................................................................................
      • Tip 9: Wrong memory size found.............................................................................................
      • Tip 10: Master boot record and LILO......................................................................................
      • Tip 11: LILO can't find a kernel on a big drive.......................................................................
      • Tip 12: X Window configuration options.................................................................................
      • Tip 13: Allowing users to mount drives...................................................................................
      • Tip 14: Allowing users to run root programs...........................................................................
      • Tip 15: Linux and NT booting..................................................................................................
      • Tip 16: Annoying boot messages..............................................................................................
      • Tip 17: Programs on CD-ROM................................................................................................
      • Tip 18: International console....................................................................................................
      • Tip 19: Multiple kernels choices..............................................................................................
      • Tip 20: Default file permissions...............................................................................................
      • Tip 21: Default boot mode........................................................................................................
      • Tip 22: More information from usenet.....................................................................................
      • Tip 23: Bytes per inodes...........................................................................................................
      • Tip 24: LILO and boot problems..............................................................................................
      • Tip 25: Making CD-ROM images............................................................................................
      • Tip 26: FTP access restrictions.................................................................................................
  • Hardware...........................................................................................................................................................
    • What this chapter covers........................................................................................................................
      • Tip 1: Detecting 2 ethernet cards..............................................................................................
      • Tip 2: Everything on sound cards.............................................................................................
      • Tip 3: Non-PostScript printers..................................................................................................
      • Tip 4: Use Windows special keys in Linux..............................................................................
      • Tip 5: Added processors...........................................................................................................
      • Tip 6: Detecting an ISA device.................................................................................................
      • Tip 7: Find hardware information.............................................................................................
      • Tip 8: Blinking leds on the keyboard........................................................................................
      • Tip 9: Reading a foreign file system......................................................................................... Table of Contents
      • Tip 10: Can't mount root fs......................................................................................................
      • Tip 11: Linux on a 286?............................................................................................................
      • Tip 12: Linux without a hard drive...........................................................................................
      • Tip 13: Shutdown and power off..............................................................................................
      • Tip 14: LPD started but no device found..................................................................................
      • Tip 15: Read files from FAT32 drives......................................................................................
      • Tip 16: TV on Linux.................................................................................................................
      • Tip 17: Device drivers..............................................................................................................
      • Tip 18: Mouse problems...........................................................................................................
      • Tip 19: International keyboards................................................................................................
  • Software.............................................................................................................................................................
    • What this chapter covers........................................................................................................................
      • Tip 1: Background image in X Window...................................................................................
      • Tip 2: Customize Netscape Communicator..............................................................................
      • Tip 3: POP3 in Pine..................................................................................................................
      • Tip 4: Multiple accounts in Pine...............................................................................................
      • Tip 5: Running Java programs..................................................................................................
      • Tip 6: Virtual hosts in Apache..................................................................................................
      • Tip 7: Libc versus Glibc...........................................................................................................
      • Tip 8: Aliases with Qmail.........................................................................................................
      • Tip 9: Samba with Windows 98 or NT 4..................................................................................
      • Tip 10: KDE drag and drop icons.............................................................................................
      • Tip 11: Find files.......................................................................................................................
      • Tip 12: asm or linux include files not found.............................................................................
      • Tip 13: ICQ on Linux...............................................................................................................
      • Tip 14: Reading foreign documents..........................................................................................
      • Tip 15: Scanning with Linux....................................................................................................
      • Tip 16: Real audio and video....................................................................................................
      • Tip 17: Emulation.....................................................................................................................
      • Tip 18: Shared library not found...............................................................................................
      • Tip 19: Hard to erase files.........................................................................................................
      • Tip 20: Files permissions..........................................................................................................
      • Tip 21: Changing file permissions............................................................................................
      • Tip 22: An international background........................................................................................
      • Tip 23: Powerful file transfer system.......................................................................................
      • Tip 24: Editing in text editors...................................................................................................
      • Tip 25: Documentation and manual..........................................................................................
  • Networking........................................................................................................................................................
    • What this chapter covers........................................................................................................................
      • Tip 1: Easy PPP dialup.............................................................................................................
      • Tip 2: Internet for your LAN....................................................................................................
      • Tip 3: Domains to search in......................................................................................................
      • Tip 4: Display IP rather than hostname....................................................................................
      • Tip 5: Is my modem a winmodem?..........................................................................................
      • Tip 6: Sharing files from a Windows system........................................................................... Table of Contents
      • Tip 7: Sorry but this host is not in my list................................................................................
      • Tip 8: Access to various networks............................................................................................
      • Tip 9: Accessing remote file systems.......................................................................................
      • Tip 10: Secure Web server........................................................................................................
      • Tip 11: Secure alternative to telnet...........................................................................................
      • Tip 12: Speed problems on a PPP connection..........................................................................
      • Tip 13: Names and name servers..............................................................................................
      • Tip 14: Who owns this port......................................................................................................
      • Tip 15: Network printers...........................................................................................................
  • Development......................................................................................................................................................
    • What this chapter covers........................................................................................................................
      • Tip 1: Graphical messages to the world....................................................................................
      • Tip 2: Code reuse......................................................................................................................
      • Tip 3: Makefile don't equal C.................................................................................................
      • Tip 4: Parsing the command line in BASH............................................................................
      • Tip 5: Don't grep grep............................................................................................................
      • Tip 6: Move a text into upper case letters...............................................................................
      • Tip 7: Using PASCAL on Linux............................................................................................
      • Tip 8: Segmentation fault.......................................................................................................
      • Tip 9: Who is online?..............................................................................................................
      • Tip 10: Graphical toolkits.......................................................................................................
      • Tip 11: IDE and visual interfaces...........................................................................................
      • Tip 12: Free software and copyleft.........................................................................................
      • Tip 13: Talking to the terminal...............................................................................................
      • Tip 14: Internet technologies..................................................................................................
      • Tip 15: Library types..............................................................................................................

Introduction

Copyright

This book is copyright by Patrick Lambert. It is provided free of charge in the hope that it will be useful. You may copy, distribute and print this book. You may not modify it without prior written consent from the author.

The tips in this book are given AS-IS. This means that I shall not be responsible for any damage that may occur from their use. You use them at your own risks.

Linux is a trademark of Linus Torvalds RedHat is a trademark of RedHat Software Inc. Windows and DOS are trademarks of Microsoft Corp. Sound Blaster is a trademark of Creative Labs PostScript is a trademark of Adobe Other trademarks and copyrights may apply.

About the author

Patrick Lambert is currently a student in Computer Science at the University of Montreal in Quebec, Canada. He is the author of various Web sites for the Linux community, and of various software packages including GXedit

Although he does everything from systems administration to software programming, he spends most of his time working on Web sites for the Linux community. You can contact Patrick at [email protected]

Aknowledgements

I would like to thank Tuomas Kuosmanen for the logo and the images on the Web site.

Audience

This book was written for anyone using Linux, from new users to experts who want to explore this wonderful operating system. The tips and tricks in this book were discovered by myself over years of experience using Linux, and learning about it. Some are very basic tips to make your computing life easier, others are advanced tricks that can save you days of work.

I tried to cover all distributions of Linux in this book. I personaly use Slackware and RedHat on PC systems. If you find any error in the book, feel free to contact me so a future second edition could correct them.

Installation

What this chapter covers

Installation is a very important part of any operating system. This is why I cover this topic first. The next most important thing is installation of programs and software to get your system to do useful tasks. This chapter covers both of these aspects.

Tip 2: How to find a Linux CD-ROM at low cost

The Linux market started from a few distributions available only from FTP servers, to full feature commercial distributions available in stores and online including a printed manual and phone support.

Here are the main choices you have when looking for a Linux distribution:

  • You can download any Linux distribution from its FTP server. To take a few examples, RedHat can be downloaded from ftp://ftp.redhat.com, Slackware from ftp://ftp.cdrom.com and Debian from ftp://ftp.debian.org. That method is free, but requires you to have a fast Internet connection. Downloading a full Linux distribution over a 56Kbps modem will take you quite a few hours.
  • An other way is to buy a full distribution. RedHat, for example, can be bought online for about $50. This will include a box, a CD-ROM, a boot diskette, a manual and support from RedHat.
  • The last way is to buy only the CD-ROM. There are a few places selling CD-ROMs of various distributions for $2. One of them is http://www.cheapbytes.com. You will only get the CD-ROM, but this is all you need to install Linux if you are comfortable with the fact that you don't get a printed manual or free support. You can find the manual and other documentation on the CD-ROM.

Tip 3: Multiple operating systems

A computer only needs one operating system to work. But what if you just want to try out a new system? Do you need to forget about the old one and erase your hard drive? No, you can have as many operating systems on your computer as you wish.

Linux requires 2 partitions to work. Partitions are sections of the hard drive. When you install Linux, it will provide a program called fdisk or disk druid allowing you to create the needed partitions. The main problems people have is that they don't have empty partitions to use for Linux, and they don't want to erase the current Windows or DOS partition. The trick is to resize your current partition to create empty space. Then you will be able to make the partitions needed by Linux to install properly.

Fdisk doesn't allow you to resize a partition. You will need to use another program to do the job, before using fdisk to create the Linux partitions. A very popular commercial product to do this is Partition Magic from http://www.powerquest.com.

Let's see step by step what is needed to resize an existing partition to allow the creation of a new one for Linux:

  • Buy Partition Magic, or get any other tool that can safely resize partitions.
  • Make sure you have at least 150 megs free on your main partition, the required amount for Linux.
  • Resize the partitions so you have at least 150 megs free, outside of any current partition.
  • Reboot and launch the Linux installation.
  • Run fdisk or any partitioning program that comes with the Linux distribution, and follow the installation instructions to make the required Linux partitions.

Tip 5: Swap and memory

One important setting in any protected mode operating system like Linux is the swap space. In the installation, you will need to create a swap partition. A common question is what size should the partition be?

The proper size depends on 2 things: The size of your hard drive and the size of your RAM memory. The less RAM you have, the more swap you will need. Usually you will want to set your swap space size to be twice the RAM size, with a maximum of 128 megs. This of course requires you to have a hard drive with enough free space to create such a partition.

If you have 16 megs of RAM, making the swap space 32 megs or even 64 megs is very important. You will need it. If you have 128 megs of RAM on the other hand, you won't need much swap because the system will already have 128 megs to fill before using swap space. So a swap partition of 128 megs or even 32 megs could be enough.

If you don't select enough swap, you may add more later.

Tip 6: More swap with a swap file

You installed a new Linux system, but forgot to set enough swap space for your needs. Do you need to repartition and reinstall? No, the swap utilities on Linux allow you to make a real file and use it as swap space.

The trick is to make a file and then tell the swapon program to use it. Here's how to create, for example, a 64 megs swap file on your root partition (of course make sure you have at least 64 megs free):

dd if=/dev/zero of=/swapfile bs=1024 count=

This will make a 64 megs (about 67 millions bytes) file on your hard drive. You now need to initialize it:

mkswap /swapfile 65536 sync

And you can then add it to your swap pool:

swapon /swapfile

With that you have 64 megs of swap added. Don't forget to add the swapon command to your startup files so the command will be repeated at each reboot.

Tip 8: The boot prompt

The Linux system uses a program called LILO to boot itself. This is the LInux LOader, and will load a kernel and can pass various parameters. This is what the "boot:" prompt is for.

At the "boot:" prompt, you can enter a lot of parameters. You can send parameters to drivers like the ethernet driver, telling it at which IRQ the ethernet card is located, or you can pass parameters to the kernel, like memory size or what to do in a panic. Reading the LILO manual will tell you all of the nice things LILO can be used for.

Note that for device drivers compiled as modules, you need to pass values when you load these drivers, and not on the "boot:" prompt.

Tip 9: Wrong memory size found

The Linux kernel will detect various settings from your computer configuration. This includes the size of memory you have. In some cases, it will find the wrong size. For example, it could find only 64 megs of memory when in fact you have 128 megs.

The trick here is to specify the amount of RAM memory you have with the "mem=" parameter. Here is what you would type when your system boots if you have 128 megs of memory:

LILO boot: linux mem=128M

This will tell LILO to load the linux kernel with 128 megs of memory.

Tip 11: LILO can't find a kernel on a big drive

On some big hard drives, LILO can have problems loading your kernel. The problem is because the hard drive has more then 1024 cylinders.

The trick is to make sure your kernel is in the first 1024 cylinders so LILO can find it. The way to do this is to make a small /boot partition at the begining of the drive, and make sure the kernel is in the /boot directory. You can set the partitions in fdisk, and select the right path for the kernel in /etc/lilo.conf so LILO knows where it is. When you compile your kernel, simply move the new kernel in that directory so LILO can load it.

Tip 12: X Window configuration options

Each Linux distribution has its own X Window configuration program. XFree86 also has a text-based configuration program which is complex to use. But what if both the distribution program and xf86config, the text-based configuration for XFree86, do not seem to do what you need? XFree86 also comes with a graphical configuration tool.

The name of the graphical program is XF86Setup. This will launch a graphical window and allow you to configure the X Window Server. So if you don't like the console configuration programs, you can use this one: