www.flickr.com
Petri Lopia's items Go to Petri Lopia's photostream

Linux: Show your IP-address

Show IP-Address

How to get your IP-address:

ifconfig "eth0"|grep 'inet addr'|cut -d' ' -f12|cut -c6-20

and if you want to use IP-address at your own scripts just use:

INTIP=`ifconfig eth0|grep 'inet addr'|cut -d' ' -f12|cut -c6-20`
echo "$INTIP"

and now you have your IP-address on $INTIP enviroment and you can use that at your scripts.

If you want easy to change which interface IP-address you want to get just example do:

#!/bin/sh
INT="eth0";
INTIP=`ifconfig $INT|grep 'inet addr'|cut -d' ' -f12|cut -c6-20`
echo "$INTIP";

Linux: History command

You can see your command history on Linux just using command history:

history

and this should show you all commands which you have wrote with a line number on the beginning of the line.
You can redo those commands just with ! and writing number of that line which command you want to redo:

!line_of_history

add date and time to history list:

export HISTTIMEFORMAT='%d/%m/%Y %H:%M:%S '

or finnish way:

export HISTTIMEFORMAT='%d.%m.%Y %H:%M:%S '

Ofcourse you can use grep with history example like this:

history | grep apt-get

and get only line which has apt-get on them.

If you think that your history list is too short or too long just say:

echo $HISTSIZE

and you will see how long your history file is and if you want to change it just say:

export HISTSIZE=1000

at the command line to set your history size to 1000 lines.

If you just want to run again last command just do:

!!

Continue reading Linux: History command

Photography / Valokuvia

If you are here for photograps visit: http://www.flickr.com/photos/whig/sets/.
Jos tulit valokuvien takia niin klikkaa: http://www.flickr.com/photos/whig/sets/.

You can find me on facebook / Löydät minut myös facebookista: http://www.facebook.com/petrilopia


www.flickr.com

Continue reading Photography / Valokuvia

Windows, smartcard and automatic locking

I had a little problem with one Windows XP dell laptop where we use smartcards.
Normally when you remove smartcard from the laptop windows will lock your desktop but
this time windows didn’t do nothing when you removed smartcard from the laptop.
I tried to reinstall some software but that didn’t help at all but then I found one little
setting on the windows registry.

You can find that setting here:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon

and there should be one key called “scremoveoption” which should be 1.
If it’s 3 your windows machine will shutdown if you remove smartcard and if it’s 0 like it was on this
laptop your computer doesn’t do anything when you remove smartcard.

So I just changed 0 to 1 and this issue was solved :-)