Get CPU information in Linux

It’s quite easy to get CPU information in Linux.Just open terminal and give the following command:

$ cat /proc/cpuinfo

Note : Presence of lm(Long mode) in flags indicate that the CPU is 64 bit whereas its absence indicates that it’s a 32 bit processor.

You can also use uname -i command  to know whether its a 32 bit or a 64 bit processor.

$ uname -i

It will say “i686” for 32bit and “x86_64” for 64bit.

Resetting root password in Linux using Backtrack

backtrack

Steps for resetting password of root to ‘sctfroot’ using backtrack.

Step1: Boot the backtrack cd and log in as root.

Step2: find the partition in which the linux is installed using cmd
$fdisk-l                                        //we are already loged in as root hence its not required to use sudo cmd anywhere.

Step3: suppose linux is installed in partition /dev/sda6 then make a directory name sda6 in mnt directory and mount that partition to it using following cmd(s)
$mkdir /mnt/sda6                             //make sda6 in mnt directory  
$mount /dev/sda6 /mnt/sda6

Step4: cd /mnt/sda6                                  //entering in sda6

Step4: change the permission of passwd file to 755
$chmod 755 passwd                             //check comments in step2

Step5: open passwd file
$vi /etc/passwd

Step6: Find root and delete the whatever is there in between the first ‘:’ and second ‘:’ and save the file.It will make the root password less.
root:x:0:0:root:/root:/bin/bash                //before

root::0:0:root:/root:/bin/bash               //after 

Step7: Now remove backtrack and restart the computer and open in grub mode(recovery mode) and you will find the root prompting at cmd line without asking for password.Now use passwd cmd to change passwd of root to sctfroot.

$passwd root
and type password as ‘sctfroot’ when it is asked.

Note: You can prevent him from hacking your sytem by setting a Bios password(so that he can’t access your system without cracking your bios password 😀 ).

Recording & playback of terminal session

Here is a simple tip to record and playback a terminal session.It is done by command script and scriptreplay.
You will find it very useful in making good tutorials.

Recording:

$ script -t 2> timing.log -a output.session
now type your commands;
…..
…..
…..
$ exit
script command here takes two files as arguments ‘timing.log(stores timing information at which each commands are run)’ and ‘output.session(stores the output of the commands)’

Playback:

$ scriptreplay timing.log output.session

Note:
timing.log and output.session can be shared with anyone who wants to replay a terminal session in their terminal.