loadYOURSELF

loadYOURSELF

Entries Tagged ‘tip’

drive new drive unavailable…try again problem on nokia n series

If your nokia n series phone asks you to connect to internet or another place frequently,
you need to delete

. tools / settings / connection / Remote Drives .. delete "New Drive" ..

this can be a solution for the problem.

hope this helps.

Buy me a beer

Linux mbr record backup with sfdisk included extened partition infos

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

Creating & using ext3 filesystem images

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.

Shell script to check file & directory existance

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 backup with dd command @ LINUX

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

Linux Broken Pipe Error Solution

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

How to use mplayer as a YUV player (raw video)

You can use mplayer as a YUV player with the example command below.

mplayer foreman.qcif -demuxer rawvideo -rawvideo qcif

mplayer “yuv filename” -demuxer rawvideo -rawvideo “qcif,cif”

Buy me a beer

How to find active local computers on a LAN with Linux machine

This entry gives a way to find active computers on a LAN with Linux machine.
We can use nmap port scanning tool for that.

You can install nmap with
yum install nmap
or
apt-get install nmap
Example:
nmap -sP 192.168.200.0/23

searches 192.168.200.x & 192.168.201.x sub networks. And lists active computers.

nmap -v -sP 192.168.200.0/23 gives more verbose.

Buy me a beer

How to use windows shares with Linux Samba

First of all you need to share some directories on the windows machine then you can use,


example info:

WinMachine = 10.1.1.10
user=test
pass=test
windows share name= sharefolder


mkdir /mnt/winshare

mount -o username=<username>,password=<password> //<windows-machine>/<share name> /mnt/<mount point on the linux machine>

-> with example info

mount -o username=test,password=test //10.1.10.10/sharefolder /mnt/winshare

or

this also works, (accessing full disk)

mount -o username=test,password=test //10.1.10.10/c$ /mnt/winshare

hope this helps to connect your linux pc to windows machine.

How to change ‘ls’ command color @ linux terminal

First change ls commands color attribute to auto

alias ls=’ls –color=auto’

then add this to /$HOME/.bashrc

then create a file /$HOME/.dircolors

extract this to that file (which must be one line after export command there is a space)

export LS_COLORS=”no=00:fi=00:di=01;35:ln=01;36:pi=40;33:so=01;35:do=01;35:

bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:

tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:

*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:

*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:

*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:

*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:

*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:

*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mng=01;35:*.pcx=01;35:

*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:

*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:

*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:

*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:

*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:”

Some definitions for abbreviations