loadYOURSELF

loadYOURSELF

Browsing Posts in Linux

Major Features:
The following are major features for Fedora 13:
* Automatic print driver installation — refer to Section 4.3, “Printing”
* Automatic language pack installation — refer to Section 4.4, “Internationalization”
* Redesigned user account tool — refer to Section 4.1, “Fedora Desktop”
* Color management to calibrate monitors and scanners — refer to Section 4.1, “Fedora Desktop”
* Experimental 3D support for NVIDIA video cards — refer to Section 4.1, “Fedora Desktop”
Some other features in this release include:

This is the latest version of the Fedora Linux operating system featuring the GNOME desktop.

The following are major features for Fedora 12:

* Improved WebCam support
* Better Video Codec
* Audio Improvements
* Better Power Management

Some other features in this release include:

* Automatic bug reporting tool
* Bluetooth on demand
* Many, many virtualization enhancements
* Still more security improvements

Download Page

Buy me a beer

Some domain’s serve under multiple ip addresses for example google.com

if you want to query this ip addresses then you can use this code block

#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <stdlib.h>
#include <stdio.h>

int main(int argc, char **argv) {
 if (argc < 2) {
   fprintf(stderr,"Usage: ./app www.google.com\n");
   exit(1);
 }

 struct hostent *hp = gethostbyname(argv[1]);

 if (hp == NULL) {
   fprintf(stderr,"query failed\n");
   exit(1);
 } else {
   unsigned int i=0;
   while ( hp -> h_addr_list[i] != NULL) {
     printf( "%d -> %s ",i, inet_ntoa( *( struct in_addr*)( hp -> h_addr_list[i])));
     i++;
   }
   exit(0);
 }
}

Buy me a beer

This script counts one by one every time the user runs the script. “./scriptname reset” reset the counter.


!/bin/bash
if [ "$1" = "reset" ]
then
rm -rf fstore
fi
sayi=0
if [ -f fstore ]
then
sayi=`cat fstore`
fi
let sayi=$sayi+1
echo "INCREMENTING"
echo $sayi > fstore
echo -e -n "CURRENT="
echo $sayi

uses fstore file to remember the previous number.

Buy me a beer

If you have high cpu usage problem for your vmware application which runs on linux and the virtual machine files in NTFS partition,

you have to add:



mainMem.useNamedFile= FALSE"

to your .vmx file of you virtual machine.

this will solve the high cpu usage of mount.ntfs-3g.

Buy me a beer

You can backup your system partition table with sfdisk which you can also inlude extended partitions.

backup partition table

sfdisk -d /dev/sda > my-sda.sf

restore partition table

sfdisk /dev/sda < my-sda.sf --force

you can download the sfdisk source from

ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/v2.15/

and you can compile it for your desktop PC or for your embedded device. (cross compiling)

Buy me a beer

Ext3 is a linux filesystem and used by most of the linux systems. This article shows and example ext3 image usage situation.

we will create and use 20MB ext3 image. 1024×20480 bytes.

first we create an empty file with dd block size 1024

dd if=/dev/zero of=disk1.image bs=1024 count=20480

then we format that image

mkfs.ext3 -F -b 1024 disk1.image 20480

this will give an empty filesystem whose type is ext3.

if [ -f filename ]
then
echo "file exist"
else
echo "Sorry, file does not exist"
fi

if [ -d directory ]
then
echo "directory exist"
else
echo "Sorry, directory does not exist"
fi

Buy me a beer

MBR is the master boot record of your disks. It includes also partition table. If you want to create one to one partition table and don’t want to copy all your disk you can use the commands below

to backup your mbr

dd if=/dev/sdX of=mbr.bin bs=512 count=1

to restore back your mbr

dd if=mbr.bin of=/dev/sdX bs=1 count=64 skip=446 seek=446

Buy me a beer

SIGPIPE signal is sent by kernel to programs whose remote end closes or shuts down the socket and your program still tries to send/write operations on closed connection. The default signal handler terminates your program at this situation because of default behavior.

Solution 1:

Ignore the signal using ‘signal(SIGPIPE, SIG_IGN)’

then catch the EPIPE error which will return from the send/write operation due to a broken pipe.

Solution 2:

Pass MSG_NOSIGNAL flag to send(). This is results as same as solution 1