Monday, December 27, 2010

How to play with linux

As a linux user I always prefer using command line than gui. So in some cases file copy, move, delete can cause lot of troubles and loses so that those commands has to be used in a secure or careful maner.
Since I'm a nut there is no support from my side to be careful when Im using the commands. So i found a simple method to how to be careful when im copying, moving and deleting files and folders.

Alias can be used be used to run combined commands and strings etc..
for example alias ls='ls -l'
now when ever you run ls it will run as ls -l so that you dont have to type long commands for nearly 1km.


when copying/moving/deleting if you put -iv as parameters then because of i it will ask whether to overwrite or delete, according to the operation. And v is verbose which will show what is happening so you can understand very easily.

example : alias mv='mv -iv'

will create and alias to mv command so the user will get more time and understanding, which will happen.

and you can create aliases for other commands too.
alias cp='cp -iv'
alias rm='rm -iv'

have exploring linux from command line :D

Monday, November 8, 2010

Hmmmmm

after 4 years
i had to carry only
a bunch of tears and blames
love is different than the brotherhood
who sweet you were
still remember we ate together
bt im still correct
i never did a wrong to u
dont worry truth will win
!!!! we will see !!!

Saturday, November 6, 2010

නුඹ!!

පිටින් පෙනෙන ලස්සන නුඹෙ හිතේ
තිබුන නAM
අක්කල සෙET එක කියපු දේවල්
අහුවෙ නෙත්නAM
බොරැවට තරහ වෙලා
සති ගනන් 4n එක off කලේ නෙත්න
නුඹත් අද REජිනකි **නි!!

Friday, October 1, 2010

මගේම පැටී

කොච්චර මට hate කලත්
හැමදාමත් මගේ මතකයේ
රැජිණ වෙලා
මගේ ලගින් ඉඳීවි ඔයා
මගේම පැටී!!

Thursday, September 30, 2010

අනේ මගේ කට!!!

හැමදාම ඔයා ඉදපු
Bordin එක ලගින් යද්දි..
ඔයාට Films දෙන්න ආව මතකයි...
ඒත් මට අන්තිමේදි කීවෙ  "දර්ශන ඔයා ඕක ඕනෑම කෙල්ලෙක් වෙනුවෙන් කරයි"
 අනේ මගේ කට!!!!

Thursday, July 29, 2010

Logging off using the terminal

Open a terminal and type:
gnome-session-save --kill

if you dont want the log off window add --silent

Tuesday, July 27, 2010

How to install compiz

Compiz is a very great desktop effect application that runs on Linux environment, here how to install it

type in the terminal:
sudo apt-get install compiz compizconfig-settings-manager compiz-fusion-plugins-main compiz-fusion-plugins-extra emerald librsvg2-common

and

sudo apt-get install fusion-icon

Friday, July 23, 2010

How to create a custom symlink

If you compile some custom program and you need to run it without adding path
you can create a symlink(symbolic link) so that it will directed to the specified link

open terminal
type:
sudo ln -s /home/darshana/ns-allinone-2.34/ns-2.34/ns /usr/bin/ns

Here I explained to add the symbolic link for ns (network simulator)

How to view CPU and RAM information from terminal

In some cases you are unable to use system monitor or any other tool to check what is your processor type, how much memory in the RAM. You can use /proc to view the information

To view cpu info
open a terminal
type:
less /proc/cpuinfo

To view ram information
open a terminal
type:
less /proc/meminfo

Sunday, July 18, 2010

How to convert a String to date object in Java

I am going to illustrate using an example

import java.util.Date;
import java.text.SimpleDateFormat;
public class test{
public static void main(String args[]){
String dateStr = "26/08/2010";
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");

try{
Date date = formatter.parse(dateStr);
System.out.println("Date is : " + formatter.format(date));
}
catch (java.text.ParseException e){
e.printStackTrace();
}

}
}

Tuesday, July 13, 2010

How to use wget to download a file

As i know you cannot download wget to download files from the web sites which needs authentication or human verification.

but most of the times you can directly get the URL of the file,
open a terminal and type (without [])

wget -drc [URL]



if you need to pass from a proxy if you did not set the proxy address yet

 
export http_proxy="[url]:[port]"



example


export http_proxy="http://cache.pdn.ac.lk:3128"

Sunday, July 11, 2010

How to clear the page cache memory from terminal

When your page cache memory is full your computer will be really really slow and
you may be unable to run even a single program.

So open a terminal and type as a root user

sync; echo 3 > /proc/sys/vm/drop_caches



This will clear your cache memory and enables you to work faster than previously.

How to add a 'nop' using C

When you write a C code sometimes
you will need to add an assemble nop(No OPeration)
this is how it goes..


__asm__("nop");


for multiple nops add ';'

__asm__("nop;nop;nop");

Saturday, July 10, 2010

How to change Grub in ubuntu

Unlike other grub versions, Grub 2 can be edited from the GUI and it is very easy
here is the steps for Ubuntu 10.04,

open a terminal and run

sudo grub update
when the Grub update finished, run
sudo apt-get install 

for this you will need an Internet connection, if not download it from here
now open System->Administration->Startup-Manager

Wednesday, June 2, 2010

How To Change root password in Ubuntu 10.04

open a terminal and type:
sudo passwd root
then
you will be asked to enter current password or if you did not activate it
already you will be asked for the new password
like this
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

Thursday, March 18, 2010

Cache Timing Attack on AES

in 2005 Daniel Bernstien announced a successful cache timing attack so that from there one can deduce the secret key.. Im working on a project which checks this attack for newer processors.. (core 2 duo and quad core etc..)