Linux/Unix

How to find Operting System is 32 bit or 64 bit?

1)Linux

# uname -m
i386 or i686 then it is 32 bit
x86_64 is 64bit


Note: Using ” uname -a ” (or -m for short) only shows the type of kernel that is running.
A 32 bit kernel ( i386, i586, i686 ) can be run on a 64 bit capable CPU.
A 64 bit kernel ( x86_64 ) requires a 64 bit capable CPU to run.

[root@localhost ~]# uname -m
i686

[root@localhost ~]# file /usr/bin/file
/usr/bin/file: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped
[root@localhost ~]# getconf LONG_BIT
32
[root@localhost ~]# uname -ar
Linux localhost.localdomain 2.6.18-194.el5PAE #1 SMP Mon Mar 29 20:19:03 EDT 2010 i686 i686 i386 GNU/Linux


[root@localhost ~]# file /sbin/init
/sbin/init: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped


[root@localhost ~]# getconf WORD_BIT
32


2)Sunsolaris

isainfo -v


How to find the number of cpu ?

1)Linux


[root@apps u02]# cat /proc/cpuinfo |grep -i processor|wc -l
4
[root@apps u02]#


[root@apps ~]# grep -c /proc/cpuinfo -e "CPU"
4
[root@apps ~]#



top  ===> press numeric 1 and observe cpu column.

top - 08:48:31 up  6:51,  2 users,  load average: 0.11, 0.03, 0.01
Tasks: 121 total,   1 running, 119 sleeping,   0 stopped,   1 zombie
Cpu0  :  0.3% us,  0.7% sy,  0.0% ni, 99.0% id,  0.0% wa,  0.0% hi,  0.0% si
Cpu1  :  1.7% us,  2.4% sy,  0.0% ni, 95.9% id,  0.0% wa,  0.0% hi,  0.0% si
Cpu2  :  3.4% us,  1.7% sy,  0.0% ni, 94.9% id,  0.0% wa,  0.0% hi,  0.0% si
Cpu3  :  0.0% us,  0.3% sy,  0.0% ni, 99.7% id,  0.0% wa,  0.0% hi,  0.0% si
Mem:   7225436k total,  1931064k used,  5294372k free,    94796k buffers
Swap: 15358100k total,        0k used, 15358100k free,  1645644k cached



[root@localhost ~]# cd /sys/devices/system/cpu
[root@localhost cpu]# ls -ltrh
total 0
drwxr-xr-x 4 root root 0 Jan 31 19:33 cpu3
drwxr-xr-x 4 root root 0 Jan 31 19:33 cpu2
drwxr-xr-x 4 root root 0 Jan 31 19:33 cpu1
drwxr-xr-x 4 root root 0 Jan 31 19:33 cpu0
[root@localhost cpu]#

$ cat /proc/cpuinfo | grep "^physical id" | sort | uniq | wc -l
2

To find the number of cores per CPU:

$ cat /proc/cpuinfo | grep "^cpu cores" | uniq
cpu cores : 4

The total number of processors available is the number of physical CPUs multiplied by the number of cores per CPU.

To find the total number of processors:

$ cat /proc/cpuinfo | grep "^processor" | wc -l
16


2) Sunsolaris

# /usr/platform/sun4u/sbin/prtdiag -v

Uname -x

psrinfo | grep on-line | wc -l

6



To check the RAM size in linux.

 dmesg | grep RAM

There are three another way to check memory on Linux

1:- free -t -m
2: vmstat
3: top

Other commands for RAM :

cat /proc/meminfo

$ vmstat

$ vmstat -s


# dmidecode --type memory


Sunsolaris

# prtconf | grep Memory 

If you want the CPU speed(s) only:
# psrinfo -v


To find only directories in Linux/Sunsolaris?



[root@apps u01]# ls -ltrh|grep -i ^d
drwxr-xr-x  4 oracle dba 4.0K Feb  7 16:19 db
drwxr-xr-x  3 oracle dba 4.0K Feb  7 17:01 oradiag_oracle
drwxrwxrwx  2 oracle dba  16K Feb  7 19:12 lost+found
[root@apps u01]#

To find operating system version?



[root@apps etc]# ls -tlrh /etc/redhat-release
-rw-r--r--  1 root root 66 Nov 21  2007 /etc/redhat-release

[root@apps etc]# cat /etc/redhat-release
Enterprise Linux Enterprise Linux AS release 4 (October Update 6)
[root@apps etc]#


[root@apps etc]# ls -tlrh /proc/version
-r--r--r--  1 root root 0 Feb 12 08:58 /proc/version

[root@apps etc]# cat /proc/version
Linux version 2.6.9-67.0.0.0.1.ELhugemem (mockbuild@ca-build15.us.oracle.com) (gcc version 3.4.6 20060404 (Red Hat 3.4.6-3)) #1 SMP Sun Nov 18 00:31:12 EST 2007
[root@apps etc]#

To find the trc files which are older than 30 days?


[oracle@apps trace]$ find . -name "*.trc" -mtime +30 -exec ls -ltrh {} \;

-rw-r-----  1 oracle dba 914 Nov  8  2008 ./R1211DB1_dbrm_21512.trc
-rw-r-----  1 oracle dba 1.3K Nov  8  2008 ./R1211DB1_vktm_21506.trc
-rw-r-----  1 oracle dba 12K Nov  8  2008 ./R1211DB1_ora_21500.trc
[oracle@apps trace]$ date
Tue Feb 12 09:25:47 IST 2013
[oracle@apps trace]$


To delete the trace files older than 30 days.?


find . -name "*.trc" -mtime +30 -exec rm {} \;


To find the files more than 200MB.?



[oracle@apps ~]$ find . -name "*" -size +500000 -exec ls -ltrh {} \;
-rw-r--r--  1 oracle dba 257M Jun  6  2007 ./db/tech_st/11.1.0/md/demo/SampleData/sample_data.zip-rw-r-----  1 oracle dba 1.4G Feb 11 23:03 ./db/apps_st/data/a_txn_data01.dbf
-rw-r-----  1 oracle dba 1.5G Feb 11 23:00 ./db/apps_st/data/a_ref01.dbf
-rw-r--r--  1 oracle dba 1014M Feb 12 08:52 ./db/apps_st/data/system01.dbf
-rw-r-----  1 oracle dba 1.3G Feb 11 23:00 ./db/apps_st/data/system12.dbf
-rw-r-----  1 oracle dba 1.2G Feb 11 23:03 ./db/apps_st/data/a_txn_ind03.dbf
-rw-r-----  1 oracle dba 1.8G Feb 12 09:02 ./db/apps_st/data/undo01.dbf
-rw-r-----  1 oracle dba 311M Feb 11 22:59 ./db/apps_st/data/a_ref03.dbf
-rw-r-----  1 oracle dba 1.6G Feb 11 23:05 ./db/apps_st/data/a_txn_ind02.dbf
-rw-r-----  1 oracle dba 867M Feb 11 22:59 ./db/apps_st/data/a_archive01.dbf
-rw-r-----  1 oracle dba 1.2G Feb 11 22:59 ./db/apps_st/data/a_ref02.dbf


To find the req/out/log files which are more than 10Mb.


find . -name "*.req" -size +10000000c -exec ls -ltrh {} \;

find . -name "*.out" -size +10000000c -exec ls -ltrh {} \;




Default block size in Linux

If you ever want to confirm the block size of any filesystem of  any other Linux OS.
[root@apps ~]# tune2fs -l /dev/sda1 | grep Block
Block count:              3839527
Block size:               4096
Blocks per group:         32768

From this example, you can see that the default block size for the filesystem on /dev/sda1 partition is 4096 bytes, or 4k. That's the default block size for ext3 filesystem.



Confirm current filesystem parameters with tune2fs

The tunefs -l command will show you all the information contained in a filesystem's superblock. Here's how it typically looks:

[root@apps u02]# tune2fs -l /dev/sda1
tune2fs 1.35 (28-Feb-2004)
Filesystem volume name:   /
Last mounted on:          <not available>
Filesystem UUID:          45049a3c-9cf6-412b-9b99-cc33f7156afd
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery sparse_super large_file
Default mount options:    (none)
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              1921984
Block count:              3839527
Reserved block count:     191976
Free blocks:              1876714
Free inodes:              1591443
First block:              0
Block size:               4096
Fragment size:            4096
Reserved GDT blocks:      937
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         16288
Inode blocks per group:   509
Filesystem created:       Thu Feb  7 19:12:04 2013
Last mount time:          Mon Feb 11 16:49:24 2013
Last write time:          Mon Feb 11 16:49:24 2013
Mount count:              6
Maximum mount count:      -1
Last checked:             Thu Feb  7 19:12:04 2013
Check interval:           0 (<none>)
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               128
Journal inode:            8
Default directory hash:   tea
Directory Hash Seed:      360cd96b-5270-4f22-8284-02a66dc38a1d
Journal backup:           inode blocks
[root@apps u02]#


Creating 0 bytes (empty) files using touch command.


syntax: touch <filename>


[root@apps u02]# touch file1 file2 file3
[root@apps u02]# ls -ld file*
-rw-r--r--  1 root root 0 Feb 12 10:04 file1
-rw-r--r--  1 root root 0 Feb 12 10:04 file2
-rw-r--r--  1 root root 0 Feb 12 10:04 file3
[root@apps u02]#
[root@apps u02]# date
Tue Feb 12 10:06:28 IST 2013
[root@apps u02]#


To change the the timestamp (date and time of modification) of a file or directory.


syntax:
touch <options> <argument> <file or directory>

touch -t  YYYYMMDDhhmm <file or directory>

Example:


[root@apps u02]# date
Tue Feb 12 10:15:41 IST 2013
[root@apps u02]# ls -ld file*
-rw-r--r--  1 root root 0 Feb 12 10:04 file1
-rw-r--r--  1 root root 0 Feb 12 10:04 file2
-rw-r--r--  1 root root 0 Feb 12 10:04 file3
[root@apps u02]# touch -t 201302121016 file*
[root@apps u02]# ls -ld file*
-rw-r--r--  1 root root 0 Feb 12 10:16 file1
-rw-r--r--  1 root root 0 Feb 12 10:16 file2
-rw-r--r--  1 root root 0 Feb 12 10:16 file3
[root@apps u02]# date
Tue Feb 12 10:16:53 IST 2013
[root@apps u02]#


User Administration=============

creating an user

syntax:- useradd <options> <arguments> <username>


-u UID           -g primary grou GUID

-c comment        -d home directory

-G secondary group   -s shell

-o override

1) creating a user prakash with default options.

 root@apps u02]#  useradd prakash

 to check user has been created.

[root@apps u02]# tail -f /etc/passwd
amanda:x:33:6:Amanda user:/var/lib/amanda:/bin/bash
radiusd:x:95:95:radiusd user:/:/bin/false
ldap:x:55:55:LDAP User:/var/lib/ldap:/bin/false
radvd:x:75:75:radvd user:/:/sbin/nologin
postgres:x:26:26:PostgreSQL Server:/var/lib/pgsql:/bin/bash
fax:x:78:78:mgetty fax spool user:/var/spool/fax:/sbin/nologin
oracle:x:500:500::/u01:/bin/bash
applmgr:x:501:500::/u02:/bin/bash
ali:x:914:914:associate:/home:/bin/csh
prakash:x:915:915::/home/prakash:/bin/bash




2) create a user ali with the following parameters.

 1)userid  914

 2)comment  assocaite

 3)home directory  /home

 4)shell cshell


[root@apps u02]# useradd -u 914 -c associate -d /home -s /bin/csh ali
[root@apps u02]# tail -f /etc/passwd
mysql:x:27:27:MySQL Server:/var/lib/mysql:/bin/bash
amanda:x:33:6:Amanda user:/var/lib/amanda:/bin/bash
radiusd:x:95:95:radiusd user:/:/bin/false
ldap:x:55:55:LDAP User:/var/lib/ldap:/bin/false
radvd:x:75:75:radvd user:/:/sbin/nologin
postgres:x:26:26:PostgreSQL Server:/var/lib/pgsql:/bin/bash
fax:x:78:78:mgetty fax spool user:/var/spool/fax:/sbin/nologin
oracle:x:500:500::/u01:/bin/bash
applmgr:x:501:500::/u02:/bin/bash
ali:x:914:914:associate:/home:/bin/csh




To modify the properties of a user.

============================


 syntax:- usermod <options> <arguments> <username>


-u UID           -g primary grou GUID

-c comment        -d home directory

-G secondary group   -s shell

-o override  -l login name

-L lock the account   -U unlock the account


1) change userid of ali 750

[root@apps u02]# usermod -u 750 ali
[root@apps u02]#
[root@apps u02]# grep -i ali /etc/passwd
webalizer:x:67:67:Webalizer:/var/www/usage:/sbin/nologin
ali:x:750:914:associate:/home:/bin/csh
[root@apps u02]#

2)Lock the account of tom.

[root@apps u02]# usermod -L tom

to check logoff as root and login as tom.

3)To unlock the account of tom.

[root@apps u02]# usermod -U tom

to check logoff as root and login as tom.


4) to change the login name of user tom to jack.


[root@apps u02]# usermod -l jack tom



To delete a user============

1)delete user raj.

[root@apps u02]# userdel raj



[root@apps home]# ls /home

prakash  raj  tom

[root@apps home]#





2)Delete the user jack along with his home directory and mailbox.



[root@apps home]# ls /home
prakash  raj  tom
[root@apps home]# userdel -r jack
[root@apps home]# ls /home
prakash  raj
[root@apps home]#





Creating a group
===========

groupadd <groupname>

 or

groupadd <options> <argumetn> <groupname>

1)creating a group dba1 whose group id 751.

[root@apps home]# groupadd -g 751 dba1



Modifying the properties of a group.
=============================

1)change the groupid of dba1 to 800


[root@apps home]# groupmod -g 800 dba1





2)Changing the groupname of dba1 to db.



[root@apps home]# groupmod -n db dba1





Deleting the group db.

================

1)delete the group db.





[root@apps home]# groupdel db

[root@apps home]#


####################################################

To view how long the system is running.



[root@apps home]# uptime
 11:30:47 up  9:34,  3 users,  load average: 1.10, 1.10, 1.07
[root@apps home]#

============================================

To find out hardware details.


[root@apps ~]# lspci
00:00.0 Host bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (rev 01)
00:01.0 PCI bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX AGP bridge (rev 01)
00:07.0 ISA bridge: Intel Corporation 82371AB/EB/MB PIIX4 ISA (rev 08)
00:07.1 IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01)
00:07.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 08)
00:07.7 System peripheral: VMware Inc: Unknown device 0740 (rev 10)
00:0f.0 VGA compatible controller: VMware Inc [VMware SVGA II] PCI Display Adapter
00:10.0 SCSI storage controller: LSI Logic / Symbios Logic 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI (rev 01)
00:11.0 PCI bridge: VMware Inc: Unknown device 0790 (rev 02)
00:15.0 PCI bridge: VMware Inc: Unknown device 07a0 (rev 01)
00:15.1 PCI bridge: VMware Inc: Unknown device 07a0 (rev 01)
00:15.2 PCI bridge: VMware Inc: Unknown device 07a0 (rev 01)
00:15.3 PCI bridge: VMware Inc: Unknown device 07a0 (rev 01)
00:15.4 PCI bridge: VMware Inc: Unknown device 07a0 (rev 01)
00:15.5 PCI bridge: VMware Inc: Unknown device 07a0 (rev 01)
00:15.6 PCI bridge: VMware Inc: Unknown device 07a0 (rev 01)
00:15.7 PCI bridge: VMware Inc: Unknown device 07a0 (rev 01)
00:16.0 PCI bridge: VMware Inc: Unknown device 07a0 (rev 01)
00:16.1 PCI bridge: VMware Inc: Unknown device 07a0 (rev 01)
00:16.2 PCI bridge: VMware Inc: Unknown device 07a0 (rev 01)
00:16.3 PCI bridge: VMware Inc: Unknown device 07a0 (rev 01)
00:16.4 PCI bridge: VMware Inc: Unknown device 07a0 (rev 01)
00:16.5 PCI bridge: VMware Inc: Unknown device 07a0 (rev 01)
00:16.6 PCI bridge: VMware Inc: Unknown device 07a0 (rev 01)
00:16.7 PCI bridge: VMware Inc: Unknown device 07a0 (rev 01)
00:17.0 PCI bridge: VMware Inc: Unknown device 07a0 (rev 01)
00:17.1 PCI bridge: VMware Inc: Unknown device 07a0 (rev 01)
00:17.2 PCI bridge: VMware Inc: Unknown device 07a0 (rev 01)
00:17.3 PCI bridge: VMware Inc: Unknown device 07a0 (rev 01)
00:17.4 PCI bridge: VMware Inc: Unknown device 07a0 (rev 01)
00:17.5 PCI bridge: VMware Inc: Unknown device 07a0 (rev 01)
00:17.6 PCI bridge: VMware Inc: Unknown device 07a0 (rev 01)
00:17.7 PCI bridge: VMware Inc: Unknown device 07a0 (rev 01)
00:18.0 PCI bridge: VMware Inc: Unknown device 07a0 (rev 01)
00:18.1 PCI bridge: VMware Inc: Unknown device 07a0 (rev 01)
00:18.2 PCI bridge: VMware Inc: Unknown device 07a0 (rev 01)
00:18.3 PCI bridge: VMware Inc: Unknown device 07a0 (rev 01)
00:18.4 PCI bridge: VMware Inc: Unknown device 07a0 (rev 01)
00:18.5 PCI bridge: VMware Inc: Unknown device 07a0 (rev 01)
00:18.6 PCI bridge: VMware Inc: Unknown device 07a0 (rev 01)
00:18.7 PCI bridge: VMware Inc: Unknown device 07a0 (rev 01)
02:00.0 USB Controller: VMware Inc: Unknown device 0774
02:01.0 Ethernet controller: Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE] (rev 10)
02:02.0 Multimedia audio controller: Ensoniq ES1371 [AudioPCI-97] (rev 02)
02:03.0 USB Controller: VMware Inc: Unknown device 0770
[root@apps ~]#

    or

dmesg|less


=========================

Highlighting the running process in Linux use b/z.



===================================================
To see absolute path of a command use c.




=====================================================================

To display limited process use 'n' in top command.


===================================
To display memory information for a particular process id use below command.

[root@apps ~]# pmap -d 26764
26764:   cp -r db /u02
Address   Kbytes Mode  Offset           Device    Mapping
00696000      88 r-x-- 0000000000000000 008:00001 ld-2.3.4.so
006ac000       4 r---- 0000000000015000 008:00001 ld-2.3.4.so
006ad000       4 rw--- 0000000000016000 008:00001 ld-2.3.4.so
006b5000    1176 r-x-- 0000000000000000 008:00001 libc-2.3.4.so
007db000       8 r---- 0000000000125000 008:00001 libc-2.3.4.so
007dd000       8 rw--- 0000000000127000 008:00001 libc-2.3.4.so
007df000       8 rw--- 00000000007df000 000:00000   [ anon ]
009f9000       4 r-x-- 0000000000000000 008:00001 libcwait.so
009fa000       4 rw--- 0000000000000000 008:00001 libcwait.so
00acb000      52 r-x-- 0000000000000000 008:00001 libselinux.so.1
00ad8000       4 rw--- 000000000000d000 008:00001 libselinux.so.1
08048000      52 r-x-- 0000000000000000 008:00001 cp
08055000       8 rw--- 000000000000c000 008:00001 cp
09d6c000    1720 rw--- 0000000009d6c000 000:00000   [ anon ]
f6dc8000    2048 r---- 0000000000000000 008:00001 locale-archive
f6fc8000       8 rw--- 00000000f6fc8000 000:00000   [ anon ]
fef5d000     652 rw--- 00000000fef5d000 000:00000   [ stack ]
ffffe000       4 r-x-- 0000000000000000 000:00000   [ anon ]
mapped: 5852K    writeable/private: 2416K    shared: 0K
[root@apps ~]#

==================

List message queue.
[root@apps ~]# ipcs -q

------ Message Queues --------
key        msqid      owner      perms      used-bytes   messages

[root@apps ~]#


list semaphore
[root@apps ~]# ipcs -s

------ Semaphore Arrays --------
key        semid      owner      perms      nsems

[root@apps ~]#



list shared memory.



[root@apps ~]# ipcs -m

------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status
0x00000000 65536      root      600        393216     2          dest
0x00000000 98305      root      600        393216     2          dest
0x00000000 131074     root      600        393216     2          dest
0x00000000 163843     root      600        393216     2          dest
0x00000000 196612     root      600        393216     2          dest
0x00000000 229381     root      600        393216     2          dest
0x00000000 262150     root      600        393216     2          dest
0x00000000 294919     root      600        393216     2          dest
0x00000000 327688     root      600        393216     2          dest
0x00000000 360457     root      600        393216     2          dest

[root@apps ~]#

=========================





Example's of grep command
===========================

[oracle@apps ~]$ cp -r db /u02 &
[1] 26764
[oracle@apps ~]$ ps -ef|grep -i cp
root        15    10  0 02:45 ?        00:00:00 [kacpid]
root     24979     1  0 02:46 ?        00:00:00 /usr/sbin/acpid
root     26128 26106  1 02:46 ?        00:00:32 /usr/X11R6/bin/X :0 -audit 0 -auth /var/gdm/:0.Xauth -nolisten tcp vt7


[oracle@apps u02]$ ls -ltrh
total 36K
drwxr-xr-x  3 applmgr dba  4.0K Feb  7 16:19 inst
drwxr-xr-x  4 applmgr dba  4.0K Feb  7 16:19 apps
drwxrwxrwx  2 applmgr dba   16K Feb  7 19:12 lost+found
drwxr-xr-x  2 root    root 4.0K Feb 12 10:02 stage
-rw-r--r--  1 root    root    0 Feb 12 10:16 file3
-rw-r--r--  1 root    root    0 Feb 12 10:16 file2
-rw-r--r--  1 root    root    0 Feb 12 10:16 file1
drwxrwxrwx  4 root    root 4.0K Feb 12 21:00 clone
drwxr-xr-x  4 oracle  dba  4.0K Feb 14 03:33 db
[oracle@apps u02]$ rm -rf db &
[1] 26807
[oracle@apps u02]$ ps -ef|grep -i rm
root     26592     1  0 02:47 ?        00:00:21 /usr/bin/gnome-terminal
oracle   26807 26737  5 03:49 pts/2    00:00:00 rm -rf db
oracle   26809 26737  0 03:49 pts/2    00:00:00 grep -i rm
[oracle@apps u02]$

you can also check whether job is running or not.


[oracle@apps u02]$ jobs
[1]+  Running                 rm -rf db &



To stop remove job use kill cmd.

kill -9 process id

kill -9 26807




To check pmon is running or not.

[oracle@apps appsutil]$ ps -ef|grep -i pmon
oracle    1393 26737  0 04:11 pts/2    00:00:00 grep -i pmon
oracle   27379     1  0 03:53 ?        00:00:00 ora_pmon_PROD
[oracle@apps appsutil]$

To check fnd and http processes are running or not.

[applmgr@apps scripts]$ ps -fu applmgr|grep -i fnd|wc -l
12
[applmgr@apps scripts]$ ps -fu applmgr|grep -i http|wc -l
11
[applmgr@apps scripts]$



To check history.

[applmgr@apps scripts]$ history|grep -i fndcpass
  686  ps -fu applmgr|grep -i FNDCPASS
  687  ps -fu applmgr|grep -i FNDCPASS
  688  ps -fu applmgr|grep -i FNDCPASS
  712  history|grep -i fndcpass
[applmgr@apps scripts]$ history|grep -i adstrtal
   20  ./adstrtal.sh apps/apps
   25  ./adstrtal.sh apps/apps



You can also use fc -l cmd to check history in linux or Sunsolaris.

[applmgr@apps scripts]$ fc -l
699      ps -fu applmgr|grep -i http|awk '{print "kill -9",$2}'
700      kill -9 28298
701      kill -9 28303
702      kill -9 28304
703      kill -9 28309
704      kill -9 28360
705      kill -9 28362
706      kill -9 28363
707      kill -9 28366
708      kill -9 28367
709      kill -9 28368
710      kill -9 28519
711      ps -fu applmgr|grep -i http|wc -l
712      history|grep -i fndcpass
713      history|grep -i adstrtal
714      fc -l
715      fc -l|grep -i ps|head
[applmgr@apps scripts]$


Using grep command in fc -l.
[applmgr@apps scripts]$ fc -l|grep -i ps|head
698      ps -fu applmgr|grep -i http|wc -l
699      ps -fu applmgr|grep -i http|awk '{print "kill -9",$2}'
711      ps -fu applmgr|grep -i http|wc -l
[applmgr@apps scripts]$




How to check if a Port is listening for any Service?Checking webserver port no in the below example.

[applmgr@apps scripts]$ grep -i s_login $CONTEXT_FILE
         <login_page oa_var="s_login_page">http://apps.user.com:8000/OA_HTML/AppsLogin</login_page>
[applmgr@apps scripts]$
[applmgr@apps scripts]$ netstat -an|grep -i 8000
tcp        0      0 0.0.0.0:8000                0.0.0.0:*                   LISTEN
[applmgr@apps scripts]$


Also you can check with lsof (list of open files).

[applmgr@apps scripts]$ lsof |grep -i 8000
httpd     27226 applmgr   18u     IPv4      33089                 TCP *:8000 (LI STEN)
rotatelog 27235 applmgr   10w      REG        8,2      210   11846940 /u02/inst/ apps/PROD_apps/logs/ora/10.1.3/Apache/error_log.1360800000
rotatelog 27236 applmgr   11w      REG        8,2     1056   11846827 /u02/inst/ apps/PROD_apps/logs/ora/10.1.3/Apache/access_log.1360800000
httpd     27239 applmgr   18u     IPv4      33089                 TCP *:8000 (LI STEN)
httpd     27241 applmgr   18u     IPv4      33089                 TCP *:8000 (LI STEN)
httpd     27244 applmgr   18u     IPv4      33089                 TCP *:8000 (LI STEN)
httpd     27245 applmgr   18u     IPv4      33089                 TCP *:8000 (LI STEN)
httpd     27246 applmgr   18u     IPv4      33089                 TCP *:8000 (LI STEN)
httpd     27247 applmgr   18u     IPv4      33089                 TCP *:8000 (LI STEN)
[applmgr@apps scripts]$



egrep example




[applmgr@apps ~]$ egrep -i 's_login|s_applcsf|s_applout|s_appllog|s_applptmp|s_appltmp' $CONTEXT_FILE
         <login_page oa_var="s_login_page">http://apps.user.com:8000/OA_HTML/AppsLogin</login_page>
         <APPLCSF oa_var="s_applcsf">/u02/inst/apps/PROD_apps/logs/appl/conc</APPLCSF>
         <APPLLOG oa_var="s_appllog">log</APPLLOG>
         <APPLOUT oa_var="s_applout">out</APPLOUT>
         <APPLTMP oa_var="s_appltmp">/u02/inst/apps/PROD_apps/appltmp</APPLTMP>
         <APPLPTMP oa_var="s_applptmp" osd="UNIX">/usr/tmp</APPLPTMP>
[applmgr@apps ~]$



How can I find out if my processor is 64 bit or 32, under linux?

Look for lm (Long Mode) under flags - if you can see it, you have a 64 bit CPU, if not, it is a 32 bit one.
[root@apps ~]# cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 5
model name      : Intel(R) Core(TM) i5 CPU         650  @ 3.20GHz
stepping        : 5
cpu MHz         : 3191.891
cache size      : 4096 KB
physical id     : 0
siblings        : 2
core id         : 0
cpu cores       : 2
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 11
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht nx rdtscp lm pni popcnt
bogomips        : 6387.44

processor       : 1
vendor_id       : GenuineIntel
cpu family      : 6
model           : 5
model name      : Intel(R) Core(TM) i5 CPU         650  @ 3.20GHz
stepping        : 5
cpu MHz         : 3191.891
cache size      : 4096 KB
physical id     : 0
siblings        : 2
core id         : 1
cpu cores       : 2
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 11
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht nx rdtscp lm pni popcnt
bogomips        : 6384.87

processor       : 2
vendor_id       : GenuineIntel
cpu family      : 6
model           : 5
model name      : Intel(R) Core(TM) i5 CPU         650  @ 3.20GHz
stepping        : 5
cpu MHz         : 3191.891
cache size      : 4096 KB
physical id     : 1
siblings        : 2
core id         : 2
cpu cores       : 2
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 11
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht nx rdtscp lm pni popcnt
bogomips        : 6384.95

processor       : 3
vendor_id       : GenuineIntel
cpu family      : 6
model           : 5
model name      : Intel(R) Core(TM) i5 CPU         650  @ 3.20GHz
stepping        : 5
cpu MHz         : 3191.891
cache size      : 4096 KB
physical id     : 1
siblings        : 2
core id         : 3
cpu cores       : 2
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 11
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht nx rdtscp lm pni popcnt
bogomips        : 6384.69

[root@apps ~]#



OR

[root@apps ~]# cat /proc/cpuinfo|grep -i lm
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht nx rdtscp lm pni popcnt
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht nx rdtscp lm pni popcnt
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht nx rdtscp lm pni popcnt
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht nx rdtscp lm pni popcnt
[root@apps ~]#


Look for lm (Long Mode) under flags - if you can see it, you have a 64 bit CPU, if not, it is a 32 bit one.



=====================


How to check all mount pints of a server ?

[oracle@devuser u02]$ df -kh
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              15G  6.9G  6.8G  51% /
none                  2.2G     0  2.2G   0% /dev/shm
/dev/sda5             4.9G  344M  4.3G   8% /tmp
/dev/sda2              39G  2.4G   35G   7% /u01
/dev/sda6              34G  765M   31G   3% /u02
/dev/hdc              3.1G  3.1G     0 100% /media/cdrecorder

=========================

How to make tar?


i have a share mount point that is backup and you must be in oracle directory to make it tar.
in the below example it is taking input as 11.2.0 and sending the output to backup location.


nohup tar -cvf - 11.2.0 | gzip -c > /backup/share/1120.tar.gz &
nohup tar -cvf - appl | gzip -c > /backup/share/appl.tar.gz &
nohup tar -cvf - 10.1.2 | gzip -c > /backup/share/1012.tar.gz &
nohup tar -cvf - 10.1.3 | gzip -c > /backup/share/1013.tar.gz &
nohup tar -cvf - comn | gzip -c > /backup/share/comn.tar.gz &




How to untar?


you must be in oracle directory.
cd /u02/oracle

under oracle directoy 11.2.0 directory will  be untar.as the gunzip command taking the input from backup location 
and making under it from where you fired the command in my case oracle directory.
cd /u02/oracle

gunzip -c /backup/share/1120.tar.gz | tar -xvf - &

3 comments: