Tuesday, May 3, 2011

How to find a machine is 32 or 64 bit

Normally we confuse between whether a CPU or OS is 64/32 bits.. Here is some clarity. 

Linux :
=====
To find kernel is 64 or 32 bit:
-----------------------------
shell # uname -a
Linux vscn1u.rchland.ibm.com 2.6.18-92.el5 #1 SMP Tue Apr 29 13:16:15 EDT 2008 x86_64 x86_64 x86_64 GNU/Linux

If "x86_64" or "ia64" is mentioned, it means the kernel(OS) is 64 bit, otherwise its 32 bit.

To find whether a CPU is 64 or 32 bit :
---------------------------------------
1) shell # grep flags /proc/cpuinfo

    In the output if you see
    1. rm means: 16 bit processor
    2. tm means: 32 bit processor
    3. lm means: 64 bit processor

 2) shell # getconf LONG_BIT
     The output will say directly whether the processor is 32 or 64 bit.

Windows :
=======
To find whether the OS is 32 or 64 bit :
----------------------------------------
For Windows XP / Vista / Server 2003 :

For windows 7 :
1. Right click Computer -> Properties
    .. This will open up a window
2. Look at System Type field. It will directly say whether window 7 is 32 or 64 bit.

Monday, May 2, 2011

Linux Top command - Handy info

  • top -h for a condensed list of commands, 
  • man top for a much more verbose explanation of all available options.
  • It has a powerful interactive mode You can use a variety of commands in form of just letter key presses to manipulate what you are seeing. Here are a few examples.
  • To sort processes by memory usage simply press M (shift-m on the keyboard). 
  • To sort by CPU usage press P (shift-p). 
  • You can see a full list of fields by pressing f which will show the fields with their appropriate letter (which you can use to sort by that field).
  • With the key you can also opt to add a new field to display by pressing f and then the letter representing the key. For example if you want to add a code size field (CODE) press f and then r (as shown in the field list).
  • You can set the delay time for updates by just pressing s, putting in a desired number of seconds, and pressing enter. It will then update in that number of seconds, but you can update any time you want yourself by pressing the space bar. 
  • To change the number of processes shown just press n, put in the desired number and press enter.  
  • You can even kill processes from within top if you have a rogue process or a program of some kind wont quit or some process is using too many resources. To do so press k, enter the PID (Process ID, which you can read in top) of that process and press enter.
  • Linux top also supports the cumulative mode which can be simply toggled by pressing (shift-s). 
  • Start top with some options already set. 
  • For example, top -d 5 will cause top to refresh its data every five seconds (equivalent to s and 5 in the interactive mode). 
  • The top -q will display information without any delay, and run it with highest priority if top is run as a superuser (or root).
  • Top can also be started to show only a few updates and then quit automatically. Just run top -n 10, for instance, to have top show 10 iterations of information before quitting.
  • Another interesting command line option is top -b which runs top in a batch mode suitable for recording into a text file. Instead of just refreshing information on screen it prints it out in batches every specified number of seconds until all iterations run out (set by -n as mentioned above) or until it is quit. To write it out into a text file called top.txt stored in a local directory just run top -b > top.txt.
  • To quit top manually,just press the q key.

Thursday, February 10, 2011

Show Desktop Icon missing in Windows

The "Show Desktop" Icon is really helpful, when we have multiple windows open.. But sometimes, we may accidentally delete it.  Here is a way, how you can recreate it.  This tip can be used for Windows 2000, XP, Vista and Windows 7


 Follow these steps:
  1. Click on Start > Run
  2. Type: Notepad
  3. Press Enter
  4. Copy and paste these codes in your new text file:
    [Shell]
    Command=2
    IconFile=explorer.exe,3
    [Taskbar]
    Command=ToggleDesktop

   5. Save it as Show Desktop.scf
   6. Now right click on your taskbar and select “Unlock Taskbar”
   7. Drag the Show Desktop.scf file to the quick launch region!

Thursday, August 19, 2010

How to read a pdf file from shell

Following tool can be used to open *.pdf files from linux shell

1. shell # acroread pdf_name.pdf  --> In Aix
2. shell # evince pdf_name.pdf  --> In Linux
3. shell # okular pdf_name.pdf  --> In Linux

Tuesday, January 5, 2010

How to add a user account in Redhat Linux

This snip will help you create a user account from shell in Redhat linux. Only root users can avail this.
-----------------------------------------------------------------------------------
Step 1: Create a user account. The following command will create a user account with the specified and names the home directory as . If you want the home dir in different name, specify "-b ". This will create a home directory with both and combined.
shell #> useradd -m

Step 2: Set passwd for the
shell #> passwd
New Passwd :
Re-type passwd:

Step 3: Navigate the new user's home directory
shell #>cd /home/
-----------------------------------------------------------------------------------
Eg : shell #> userid -m rajesh
shell #>passwd rajesh
New passwd : xxxxxxxx
Re-type passwd : xxxxxxxx
shell #> cd /home/rajesh
shell #> pwd
/home/rajesh

Thursday, December 3, 2009

How to download directory using ftp or scp?

When you try to download a directory using ftp, it wont work properly. We need to some tricks to get it. Here is one of such kind.

Let "aaaa" be the directory you want to download from a remote machine(consider this directory also has lot of subdirectories).

Step 1) tar -cvf directory.tar aaaa
- This step will create a tar file "directory.tar" containing directory "aaaa" and it subdirectory.

Step 2) Now you can use the normal ftp or scp(I feel it better than ftp) to download this file to your local machine. The step results in having the directory.tar file in your local machine.

2.a) local machine> ftp remotemachine_ip
password in remote machine : xxxx
remote machine ftp> cd "path to the file to be downloaded"
remote machine ftp> mget directory.tar
directory.tar? give "y"

(or)
2.b) scp -r username@remotemachine_ip:"path to the tarfile in remote machine" "path in local machine where you need the file"
password in remote machine:yyyy

step 3) In your local machine, untar the tar file. You will have what you need.
tar -xvf directory.tar

How to create Recursive Directories?

Here is a trick to create recursive directories

linux > mkdir -p root/subdir1/subdir2/subdir3/

This will create a given directory hierarchy in present working directory(PWD). If you are bored to type "mkdir -p" every time. Add the following in your .bash_profile in home directory.

alias mkdir="mkdir -p"