Archive for the ‘UNIX’ Category

h1

Adding a NTFS partition to fstab

October 3, 2007

Fstab it’s located in “/etc/fstab”, and it’s a plain text file which contains the information about our disks, and the how they should be mounted in the system.

If you want to add a NTFS partition you must type this:

/dev/hda[X] /mnt/[folder_name] ntfs ro,user,auto,noexec,umask=0 0 0

Where:

  • ro = Read Only
  • user = Allow to mount the partition if you’re a limited user
  • auto = This means that the partition will be mounted at the system bootup
  • noexec = You’ll not be able to execute binaries (Highly recommended to Win partitions)
  • “umask=0″  = Means everybody can do everything with the files on the disk [See more]
  • 0(first) = The partition will not be backed up
  • 0 (second) = Put 1 if you want to check that partition with fcsk at the bootup (No necessary to Win)

NOTE: Put to the directory read only permissions with chmod*
Sources: http://www.tuxfiles.org/linuxhelp/fstab.html

http://ubuntuforums.org/showthread.php?t=283131

h1

How many size must have our Swap partition?

September 28, 2007

Hey, i’m back of holidays!

The size of the Swap partition has always been reason of many discussions in the Linux users. Some people says that the properly size it’s twice of our RAM size.

In this link http://etbe.coker.com.au/2007/09/28/swap-space/ , a guy wrote that the properly Swap size partitions should be:

  • Equal the size of RAM, if your RAM is less than 1G
  • Half the size of RAM for RAM sizes from 2G to 4G.
  • More than 4G of RAM, you need 2G of Swap.

Source:  http://etbe.coker.com.au/2007/09/28/swap-space/
http://barrapunto.com/articles/07/09/28/0947220.shtml

h1

Recovering Unix files in Windows

July 14, 2007

If we’ve a hard drive with some windows and Linux partitions, and we’re running on Windows OS, perhaps we want accede to one Linux partition to recover some data. Don’t worry, that it’s very easy.

Depending on the type of partition we’ve, we must use one of this programs.

  •   Partition: EXT2: R-Linux
  •   Partition: ReiserFS : RSTools
  •   Partition: EXT2, EXT3, ReiserFS: LSTools

Obvious, the last supports all usual Linux partitions. To use this, you can manage it from
a command terminal, but if you hate that,  you could use a GUI, based on Java or .NET. Just install one and follow the user manual.

Also you could manage it from your web browse, probably, the quick and effective form.

h1

Linux file permissions

July 11, 2007

To show the file permissions type:

ls --color -l

This, shows something like this

-rw-r–r– 1 root root 817 2006-06-05 13:20 script
-rw-r–r– 1 peter usuarios 143360 2007-07-11 23:29 typescript

The “-rw-r–r–” line part, shows the file permissions to the OWNER, GROUP and OTHERS. In this example, the OWNER can “read” and “write”, the GROUP can “read”, and OTHERS can “read”. If the first character it’s a”d”, this means, that it’s a directory.

To change permissions, we use “chmod” command. The chmod sintaxis it’s, “chmod [number]“, the number represents the permissions we want to apply. To obtain this, we can use google :P or this calculator http://wsabstract.com/script/script2/chmodcal.shtml

Maybe you can use this simple table:

Value Permission
0
1 –x
2 -w-
3 -wx
4 r–
5 r-x
6 rw-
7 rwx

For example, if we apply a file the command “chmod 777″, that means, ALL users, can READ, WRITE and EXECUTE the file. If we apply “chmod 600″, Only the OWNER can READ and WRITE, the rest of users cannot use the file.

h1

Compressing/Decompressing files in Linux

July 7, 2007

The first thing that we must know, it’s to Compress/Decompress we need some applications, like “unzip” or “unrar”. All of them can be installed using “apt-get” or downloading it from their respective project pages. To find them, can use google :P .

But, to compress/decompress we’ll use some commands. I did this table with any (the most important, i think) u/d commands.

.tar.gz (Tar + Gzip)

Pack and compress tar czvf file.tar.gz /folder1/subfolder/*
Unpack and decompress tar xzvf file.tar.gz
To view data tar tzvf file.tar.gz

.tar (Tar)

Pack and compress tar cvf file.tar / folder1/ subfolder /*
Unpack and decompress tar xvf file.tar
To view data ttar tvf file.tar

.bz2 (Bzip2)

Compress bzip2 file
Decompress bzip2 -d file.bz2

.zip (Zip)

Compress zip file.zip /folder1/subfolder
Decompress unzip file.zip
To view data unzip -v file.zip

.rar (Rar)

Compress rar -a file.rar /folder1/subfolder
Decompress rar -x file.rar
To view data rar -v file.rar
h1

How To: Compile Kernel

July 5, 2007

Hey!. Sometimes, we need to compile our Kernel to update drivers or other somethings. Some people thinks that it is a hard task, but not!. It’s simply. In a few steps we can compile our own Kernel in any Linux distribution.

1) We must have installed the following packages:

 

  • kernel-package
  • libncurses5-dev
  • fakeroot
  • wget
  • bzip2
  • build-essential

If not, try to use apt-get [package name] after a apt-get update

 

2) Move to /usr/src/ path. To do this, use cd /usr/src

3) Get the Kernel. To this, open your browser and go to http://www.kernel.org and download the latest, or you needed.

You can use “wget” to this. For example if we want to use the 2-6-25 Kernel, we type this in the console wget http://www.eu.kernel.org/pub/linux/kernel/v2.6/linux-2.6.21.5.tar.gz

4) When the kernel have been downloaded. Unpack the ‘tar.gz’, using tar xvf [tar.gz package name]

5) Make a simbolic link to the original folder which contains the (Just unpacked) Kernel. Type ln -s [Kernel folder name] linux.

Why we do this? The folder we created with “ln -s” it’s a simply link to the original folder. This folder it’s only to facilitate the work.

6) Move to the symnolic link folder “linux”. Just type cd linux

7) Make sure you’re in /usr/src/linux folder, and now type make clean && make mrproper

8 ) Now, type make menuconfig NOTE: There’s other kinds of compile, but i ever use this. It’s the most easy and secure, i think.

A screen like that will be loaded

In this, you must select the things you need to run your system and the modules you want.

Before this, you must save a configuration file with the settings you’ve selected.

9) Then, you must type the following:

make all
make modules_install
make install

10) We’ve installed out Kernel, but now we should say the system where’s the new Kernel.

To this, type:

depmod [number of kernel] Example -> depmod 2.6.21.5

apt-get install yaird

mkinitrd.yaird -o /boot/initrd.img-[Number of kernel] [Number of kernel]

update-grub

 

After all, we’ve compiled our own Kernel :) . To load it, just reboot the computer.

 Sources : HowToForge , Frikis.org

h1

Changing the date in linux

July 4, 2007

We must type this commands:

If we want to set this date: 05-27-2007, 23:50

date --set "2007-05-27 23:50"

With this, we just set the system date. Now we will set the BIOS date.

hwclock --set --date="2007-06-27 23:50"

To see the system/BIOS hour, just type date/hwclock.

Have a nice day ;)

h1

Burning CD from Linux console

June 26, 2007

I founded this great link about making CD images, burning images, etc. The text use APT to install some applications, but you can install it manually.

http://ftp.cl.debian.org/man-es/…

h1

How to install XFCE4 on Debian

June 25, 2007

I installed using a 3.1 version (Sarge), but i upgraded to 4.0 Etch. Then, i needed to install a light window manager in my old computer (Athlon 1GHZ). XFCE is one of the most important and i have wanted to try it for a long time!.

Then, lets play :D . The first, you will need some packages to install it. You can obtain it using APT.

First, make sure you’ve the following:

  • GCC (GNU C/C++ compiler, 4.2.0 is the last version at this time)
  • bzip2 data compressor
  • libgtk2.0-dev (GTK+ runtime libraries)
  • libxpm-dev
  • libsm-dev
  • libice-dev
  • pkg-config (It’s a tool to manage and compile libraries)

Before you install (or not!) this packages, download the last version of the XFCE installer from a mirror (Like SourceForge.net -> XFCE on SF). You can use “wget” to download to your hard drive. At the time of this writing, the last version is 4.4.1, and the installer file have this name -> xfce4-4.4.1-installer.run.

The final step its too easy. Simply, log with “root” or use “sudo” command, and type this:

./xfce4-4.4RC2-installer.run

Before this, the package will be uncompressed (Showing dots in the screen..), and will show a screen with a welcome message, like a typical assistant.

At this point, you only must follow the instructions and XFCE will be installed on your system :) .

I had some issues during the installation. One of them, shows something like this error.

(installer-gui:3721): Gtk-WARNING **: cannot open display:

To solve this, make sure your GTK+ runtime libraries, are > 2.0 version. Try this command “apt-get install-f libgtk2.0-dev”

I’d other error, which shows this message after much more “warnings” about fonts.

could not open default fontfixed

To solve this, type “apt-get install xfonts-base”.

Before this, you can start XFCE typing “startxfce4″.

Enjoy your new desktop :P !

 

h1

How to: Installing GRUB

June 24, 2007

GRUB is one of the most important OS loader. I think it’s very simply and useful, but we must know some tricks to install and configure in our hard drive.

In GRUB the drives are called hd0, hd1, hd2, … For example, if have a single disk, their name will be “hd0″.

To install it, first, we go to GRUB 2 download page and download it (In a floppy disk or pendrive, for example). After this, and our directory /boot its on a independent partition, we type this (With root rights):

/sbin/grub-install –root-directory=/boot /dev/hda 

If we’ve all directories in / (Or something like / and /home partitions), we must type:

/sbin/grub-install /dev/hda

It’s very simply! :D

If we want configure our GRUB, we need edit the file “/boot/grub/menu.lst”. In this file we’ve some examples of GRUB configuration. Usally, we can use something like this:

title           Debian GNU/Linux, kernel 2.4.27-2-386
root            (hd0,1)
kernel          /boot/vmlinuz-2.4.27-2-386 root=/dev/hda2 ro
initrd          /boot/initrd.img-2.4.27-2-386
savedefault
boot

Title = Only a title to know the OS which will load in that option.

root = Show the partition wich is installed. In this example, Debian are installed in the first drive of the system (hd0), and the second partition (1).

kernel = Have the path of the kernel of the OS.  The first parameter have the path of the kernel file in the disk. The second parameter have the partition disk which is installed the kernel, and the third (“ro”)  means,”read only”.

initrd = Shows the kernel image path. Usally have the same path than the kernel line.

boot = When GRUB read this, it launch the OS according the kernel path and parameters we put.

On more thing. To load a Windows system we must type this in  “/boot/grub/menu.lst”:

title           Microsoft Windows OS
root            (hd0,0)
savedefault
makeactive
chainloader     +1

Supposing you’ve the Windows partition in the first drive (hd0), and the first partition (0).

See you.