Google Search

Google

What is the most suitable distro to use as a server?

Visit Us!

Google Groups
Kuantan Linux User Group
Visit this group

Threat Resource Center | Trend Micro

Sunday, April 18, 2010

Use Variables with Scripts

Using an editor or the cat command, write a script that uses a variable. Note that this script uses the bash shell on LINUX, but you can also use the ksh shell with UNIX.


1) Set a value for the variable first using typeset then check it using set.

[root@vmpc_rh804 root]# typeset first=you
[root@vmpc_rh804 root]# set | more
BASH=/bin/bash
BASH_ENV=/root/.bashrc
BASH_VERSINFO=([0]="2" [1]="05b" [2]="0" [3]="1" [4]="release" [5]="i686-pc-linu
x-gnu")
BASH_VERSION='2.05b.0(1)-release'
COLORS=/etc/DIR_COLORS
.
.
.
first=you
hi=hello
langfile=/root/.i18n


2) Write a short Welcome script that uses a variable.

[root@vmpc_rh804 root]# cat > Welcome.bash
#!/bin/bash
#
first=Student
echo "Welcome to Linux $first"
Ctrl/D


3) Execute your script using the shell interpreter.

$ bash Welcome.bash
Welcome to Linux Student

Invoke a Script

Use various methods to invoke a script, and determine when it runs in your shell, and when a subshell is created.


1) Using an editor or the cat command, write a korn or bash script that:
* Executes the ps command.
* Echos the value of the shell variable hi.

[root@vmpc_rh804 root]# cat > do-ps.bash
#!/bin/bash
# This script displays active processes
#
ps
echo $hi


2) Set the value of hi to hello in your current command line shell.

[root@vmpc_rh804 root]# hi=hello


3) Execute your script using the shell interpreter.

[root@vmpc_rh804 root]# bash do-ps.bash
PID TTY TIME CMD
1311 pts/4 00:00:00 bash
1358 pts/4 00:00:00 bash
1365 pts/4 00:00:00 ps

** Note that it doesn't recognize the hi variable. This is because the variable is local to the shell in which it was defined. When this script is executed, a new shell is started that is outside your local shell. **


4) Add execute privilege to the script file and run it as a command from the current directory.

[root@vmpc_rh804 root]# chmod +x do-ps.bash
[root@vmpc_rh804 root]# ./do-ps.bash
PID TTY TIME CMD
1311 pts/4 00:00:00 bash
1367 pts/4 00:00:00 do-ps.bash
1374 pts/4 00:00:00 ps


5) Use the built-in source command to execute the commands in the script file.

[root@vmpc_rh804 root]# source do-ps.bash
PID TTY TIME CMD
1311 pts/4 00:00:00 bash
1375 pts/4 00:00:00 ps
hello
[root@vmpc_rh804 root]#


** Note that it is able to recognize the hi variable. This is because the source command runs this script in the local shell. **

How to write a simple shell script in Linux

Below are the simple steps to write a simple shell script in Linux machine. Before this I don't have any experience to write a script. Thanks to HP's Virtual Lab. Its really make my day ;-)


===========
Exercise 1
===========

1) Find what shells are available on your system.

[root@vmpc_rh804 root]# more /etc/shells
/bin/sh
/bin/bash
/sbin/nologin
/bin/bash2
/bin/ash
/bin/bsh
/bin/tcsh
/bin/csh


2) Using an editor or the cat command, write a korn or bash script that:

* Comments what the script will do.
* Shows your current directory.
* Shows who is currently logged on.
* Prints the current date and time.

[root@vmpc_rh804 root]# cat > myscript
#! /bin/bash
#
# This script shows current directory
# then shows who is on the system
# then prints the date and time
#
pwd
who
date
Ctrl/D


3) Run the script by calling up the shell interpreter.

[root@vmpc_rh804 root]# bash myscript
/root
root :0 Apr 11 06:25
root pts/0 Apr 11 06:26
root pts/1 Apr 11 06:26
root pts/2 Apr 11 06:26
root pts/3 Apr 11 06:26
root pts/5 Apr 11 06:27
root pts/4 Mar 30 00:25 (16.158.13.22)
Tue Mar 30 00:55:01 EST 2010


4) Show how the script cannot be run as a command unless the file has execute privileges.

[root@vmpc_rh804 root]# ./myscript
-bash: ./myscript: Permission denied


5) Add execute privilege to the script file and try running it again.

[root@vmpc_rh804 root]# chmod +x myscript
[root@vmpc_rh804 root]# ./myscript
/root
root :0 Apr 11 06:25
root pts/0 Apr 11 06:26
root pts/1 Apr 11 06:26
root pts/2 Apr 11 06:26
root pts/3 Apr 11 06:26
root pts/5 Apr 11 06:27
root pts/4 Mar 30 00:25 (16.158.13.22)
Tue Mar 30 01:04:14 EST 2010




============
Exercise 2
============


1) [root@vmpc_rh804 root]# more /etc/shells
/bin/sh
/bin/bash
/sbin/nologin
/bin/bash2
/bin/ash
/bin/bsh
/bin/tcsh
/bin/csh

[root@vmpc_rh804 root]# cat > myscript1
#!/bin/bash
#
#
ifconfig eth0
netstat -i


2) [root@vmpc_rh804 root]# bash myscript1
eth0 Link encap:Ethernet HWaddr 00:50:56:03:04:40
inet addr:172.16.0.40 Bcast:172.16.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 b) TX bytes:168 (168.0 b)
Interrupt:10 Base address:0x10a0

Kernel Interface table
Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0 1500 0 0 0 0 0 4 0 0 0 BMRU
eth1 1500 0 1335 0 0 0 1351 0 0 0 BMRU
lo 16436 0 98 0 0 0 98 0 0 0 LRU


3) [root@vmpc_rh804 root]# ./myscript1
-bash: ./myscript1: Permission denied


4) [root@vmpc_rh804 root]# chmod +x myscript1


5) [root@vmpc_rh804 root]# ./myscript1
eth0 Link encap:Ethernet HWaddr 00:50:56:03:04:40
inet addr:172.16.0.40 Bcast:172.16.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 b) TX bytes:168 (168.0 b)
Interrupt:10 Base address:0x10a0

Kernel Interface table
Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0 1500 0 0 0 0 0 4 0 0 0 BMRU
eth1 1500 0 1397 0 0 0 1395 0 0 0 BMRU
lo 16436 0 98 0 0 0 98 0 0 0 LRU

Wednesday, April 14, 2010

Basic AIX command must know

This post is with reference to IBM's tutorial

==========
Hardware
==========

____________________________________________________
How do I get a detailed configuration of my system?
____________________________________________________

Type the following:

lscfg, prtconf


$ lscfg
INSTALLED RESOURCE LIST

The following resources are installed on the machine.
+/- = Added or deleted from Resource List.
* = Diagnostic support not available.

Model Architecture: chrp
Model Implementation: Multiple Processor, PCI bus

+ sys0 System Object
+ sysplanar0 System Planar
* vio0 Virtual I/O Bus
* ent1 U9117.MMA.06F18E3-V11-C5-T1 Virtual I/O Ethernet Adapter (l-lan)
* ent0 U9117.MMA.06F18E3-V11-C2-T1 Virtual I/O Ethernet Adapter (l-lan)
* vsa0 U9117.MMA.06F18E3-V11-C0 LPAR Virtual Serial Adapter
* vty0 U9117.MMA.06F18E3-V11-C0-L0 Asynchronous Terminal
* pci2 U789D.001.DQD34TR-P1 PCI Bus
* pci6 U789D.001.DQD34TR-P1 PCI Bus
+ sissas1 U789D.001.DQD34TR-P1-T3 PCI-X266 Planar 3Gb SAS Adapter
* sas1 U789D.001.DQD34TR-P1-T3 Controller SAS Protocol
+ hdisk1 U789D.001.DQD34TR-P3-D1 SAS Disk Drive (300000 MB)
+ ses3 U789D.001.DQD34TR-P3-Y2 SAS Enclosure Services Device
+ ses4 U789D.001.DQD34TR-P3-Y1 SAS Enclosure Services Device
* sata1 U789D.001.DQD34TR-P1-T3 Controller SATA Protocol
* pci7 U789D.001.DQD34TR-P1 PCI Bus
+ usbhc2 U789D.001.DQD34TR-P1 USB Host Controller (33103500)
+ usbhc3 U789D.001.DQD34TR-P1 USB Host Controller (33103500)
+ usbhc5 U789D.001.DQD34TR-P1 USB Enhanced Host Controller (3310e000)
* pci0 U789D.001.DQD37KN-P1 PCI Bus
* pci4 U789D.001.DQD37KN-P1 PCI Bus
+ sissas0 U789D.001.DQD37KN-P1-T3 PCI-X266 Planar 3Gb SAS Adapter
* sas0 U789D.001.DQD37KN-P1-T3 Controller SAS Protocol
+ ses0 U789D.001.DQD37KN-P4-Y1 SAS Enclosure Services Device
+ hdisk0 U789D.001.DQD37KN-P3-D1 SAS Disk Drive (300000 MB)
+ ses1 U789D.001.DQD37KN-P3-Y2 SAS Enclosure Services Device
+ ses2 U789D.001.DQD37KN-P3-Y1 SAS Enclosure Services Device
* sata0 U789D.001.DQD37KN-P1-T3 Controller SATA Protocol
+ cd0 U789D.001.DQD37KN-P4-D1 SATA DVD-RAM Drive
* pci5 U789D.001.DQD37KN-P1 PCI Bus
+ usbhc0 U789D.001.DQD37KN-P1 USB Host Controller (33103500)
+ usbhc1 U789D.001.DQD37KN-P1 USB Host Controller (33103500)
+ usbhc4 U789D.001.DQD37KN-P1 USB Enhanced Host Controller (3310e000)
* lhea1 U789D.001.DQD34LP-P1 Logical Host Ethernet Adapter (l-hea)
+ ent3 U789D.001.DQD34LP-P1-C10-T4 Logical Host Ethernet Port (lp-hea)
* lhea0 U789D.001.DQD34TR-P1 Logical Host Ethernet Adapter (l-hea)
+ ent2 U789D.001.DQD34TR-P1-C10-T4 Logical Host Ethernet Port (lp-hea)
+ L2cache0 L2 Cache
+ mem0 Memory
+ proc0 Processor


$ prtconf
System Model: IBM,9117-MMA
Machine Serial Number: 06F18E3
Processor Type: PowerPC_POWER6
Processor Implementation Mode: POWER 6
Processor Version: PV_6_Compat
Number Of Processors: 1
Processor Clock Speed: 4704 MHz
CPU Type: 64-bit
Kernel Type: 64-bit
LPAR Info: 11 myserver
Memory Size: 1024 MB
Good Memory Size: 1024 MB
Platform Firmware level: EM340_075
Firmware Version: IBM,EM340_075
Console Login: enable
Auto Restart: true
Full Core: false

Network Information
Host Name: host
IP Address: 192.168.1.1
Sub Netmask: 255.255.255.0
Gateway: 192.168.1.2
Name Server: 192.168.1.3
Domain Name: host.local

Paging Space Information
Total Paging Space: 2048MB
Percent Used: 18%

Volume Groups Information
==============================================================================
rootvg:
PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION
hdisk0 active 558 275 71..00..00..92..112
hdisk1 active 558 275 71..00..00..92..112
==============================================================================

INSTALLED RESOURCE LIST

The following resources are installed on the machine.
+/- = Added or deleted from Resource List.
* = Diagnostic support not available.

Model Architecture: chrp
Model Implementation: Multiple Processor, PCI bus

+ sys0 System Object
+ sysplanar0 System Planar
* vio0 Virtual I/O Bus
* ent1 U9117.MMA.06F18E3-V11-C5-T1 Virtual I/O Ethernet Adapter (l-lan)
* ent0 U9117.MMA.06F18E3-V11-C2-T1 Virtual I/O Ethernet Adapter (l-lan)
* vsa0 U9117.MMA.06F18E3-V11-C0 LPAR Virtual Serial Adapter
* vty0 U9117.MMA.06F18E3-V11-C0-L0 Asynchronous Terminal
* pci2 U789D.001.DQD34TR-P1 PCI Bus
* pci6 U789D.001.DQD34TR-P1 PCI Bus
+ sissas1 U789D.001.DQD34TR-P1-T3 PCI-X266 Planar 3Gb SAS Adapter
* sas1 U789D.001.DQD34TR-P1-T3 Controller SAS Protocol
+ hdisk1 U789D.001.DQD34TR-P3-D1 SAS Disk Drive (300000 MB)
+ ses3 U789D.001.DQD34TR-P3-Y2 SAS Enclosure Services Device
+ ses4 U789D.001.DQD34TR-P3-Y1 SAS Enclosure Services Device
* sata1 U789D.001.DQD34TR-P1-T3 Controller SATA Protocol
* pci7 U789D.001.DQD34TR-P1 PCI Bus
+ usbhc2 U789D.001.DQD34TR-P1 USB Host Controller (33103500)
+ usbhc3 U789D.001.DQD34TR-P1 USB Host Controller (33103500)
+ usbhc5 U789D.001.DQD34TR-P1 USB Enhanced Host Controller (3310e000)
* pci0 U789D.001.DQD37KN-P1 PCI Bus
* pci4 U789D.001.DQD37KN-P1 PCI Bus
+ sissas0 U789D.001.DQD37KN-P1-T3 PCI-X266 Planar 3Gb SAS Adapter
* sas0 U789D.001.DQD37KN-P1-T3 Controller SAS Protocol
+ ses0 U789D.001.DQD37KN-P4-Y1 SAS Enclosure Services Device
+ hdisk0 U789D.001.DQD37KN-P3-D1 SAS Disk Drive (300000 MB)
+ ses1 U789D.001.DQD37KN-P3-Y2 SAS Enclosure Services Device
+ ses2 U789D.001.DQD37KN-P3-Y1 SAS Enclosure Services Device
* sata0 U789D.001.DQD37KN-P1-T3 Controller SATA Protocol
+ cd0 U789D.001.DQD37KN-P4-D1 SATA DVD-RAM Drive
* pci5 U789D.001.DQD37KN-P1 PCI Bus
+ usbhc0 U789D.001.DQD37KN-P1 USB Host Controller (33103500)
+ usbhc1 U789D.001.DQD37KN-P1 USB Host Controller (33103500)
+ usbhc4 U789D.001.DQD37KN-P1 USB Enhanced Host Controller (3310e000)
* lhea1 U789D.001.DQD34LP-P1 Logical Host Ethernet Adapter (l-hea)
+ ent3 U789D.001.DQD34LP-P1-C10-T4 Logical Host Ethernet Port (lp-hea)
* lhea0 U789D.001.DQD34TR-P1 Logical Host Ethernet Adapter (l-hea)
+ ent2 U789D.001.DQD34TR-P1-C10-T4 Logical Host Ethernet Port (lp-hea)
+ L2cache0 L2 Cache
+ mem0 Memory
+ proc0 Processor


_____________________________________________________________________________________________
Displays platform-specific device information. The flag is applicable to AIX 4.2.1 or later.
_____________________________________________________________________________________________

lscfg -p

$ lscfg -p
INSTALLED RESOURCE LIST

The following resources are installed on the machine.

Model Architecture: chrp
Model Implementation: Multiple Processor, PCI bus

sys0 System Object
sysplanar0 System Planar
vio0 Virtual I/O Bus
ent1 U9117.MMA.06F18E3-V11-C5-T1 Virtual I/O Ethernet Adapter (l-lan)
ent0 U9117.MMA.06F18E3-V11-C2-T1 Virtual I/O Ethernet Adapter (l-lan)
vsa0 U9117.MMA.06F18E3-V11-C0 LPAR Virtual Serial Adapter
vty0 U9117.MMA.06F18E3-V11-C0-L0 Asynchronous Terminal
pci2 U789D.001.DQD34TR-P1 PCI Bus
pci6 U789D.001.DQD34TR-P1 PCI Bus
sissas1 U789D.001.DQD34TR-P1-T3 PCI-X266 Planar 3Gb SAS Adapter
sas1 U789D.001.DQD34TR-P1-T3 Controller SAS Protocol
hdisk1 U789D.001.DQD34TR-P3-D1 SAS Disk Drive (300000 MB)
ses3 U789D.001.DQD34TR-P3-Y2 SAS Enclosure Services Device
ses4 U789D.001.DQD34TR-P3-Y1 SAS Enclosure Services Device
sata1 U789D.001.DQD34TR-P1-T3 Controller SATA Protocol
pci7 U789D.001.DQD34TR-P1 PCI Bus
usbhc2 U789D.001.DQD34TR-P1 USB Host Controller (33103500)
usbhc3 U789D.001.DQD34TR-P1 USB Host Controller (33103500)
usbhc5 U789D.001.DQD34TR-P1 USB Enhanced Host Controller (3310e000)
pci0 U789D.001.DQD37KN-P1 PCI Bus
pci4 U789D.001.DQD37KN-P1 PCI Bus
sissas0 U789D.001.DQD37KN-P1-T3 PCI-X266 Planar 3Gb SAS Adapter
sas0 U789D.001.DQD37KN-P1-T3 Controller SAS Protocol
ses0 U789D.001.DQD37KN-P4-Y1 SAS Enclosure Services Device
hdisk0 U789D.001.DQD37KN-P3-D1 SAS Disk Drive (300000 MB)
ses1 U789D.001.DQD37KN-P3-Y2 SAS Enclosure Services Device
ses2 U789D.001.DQD37KN-P3-Y1 SAS Enclosure Services Device
sata0 U789D.001.DQD37KN-P1-T3 Controller SATA Protocol
cd0 U789D.001.DQD37KN-P4-D1 SATA DVD-RAM Drive
pci5 U789D.001.DQD37KN-P1 PCI Bus
usbhc0 U789D.001.DQD37KN-P1 USB Host Controller (33103500)
usbhc1 U789D.001.DQD37KN-P1 USB Host Controller (33103500)
usbhc4 U789D.001.DQD37KN-P1 USB Enhanced Host Controller (3310e000)
lhea1 U789D.001.DQD34LP-P1 Logical Host Ethernet Adapter (l-hea)
ent3 U789D.001.DQD34LP-P1-C10-T4 Logical Host Ethernet Port (lp-hea)
lhea0 U789D.001.DQD34TR-P1 Logical Host Ethernet Adapter (l-hea)
ent2 U789D.001.DQD34TR-P1-C10-T4 Logical Host Ethernet Port (lp-hea)
L2cache0 L2 Cache
mem0 Memory
proc0 Processor

PLATFORM SPECIFIC

Name: IBM,9117-MMA
Model: IBM,9117-MMA
Node: /
Device Type: chrp

Name: openprom
Model: IBM,EM340_075
Node: openprom

Name: interrupt-controller
Model: IBM, Logical PowerPC-PIC, 00
Node: interrupt-controller@0
Device Type: PowerPC-External-Interrupt-Presentation

Name: interrupt-controller
Model: IBM,Logical PHB
Node: interrupt-controller@800000025000200
Device Type: PowerPC-LSI-Source
Physical Location: U789D.001.DQD37KN-P1

Name: interrupt-controller
Model: IBM,Logical PHB
Node: interrupt-controller@800000025000220
Device Type: PowerPC-LSI-Source
Physical Location: U789D.001.DQD34TR-P1

Name: lhea
Node: lhea@23c00b08
Physical Location: U789D.001.DQD34TR-P1

Name: lhea
Node: lhea@23c00b10
Physical Location: U789D.001.DQD34LP-P1

Name: pci
Model: IBM,Logical_PHB
Node: pci@800000020000200
Physical Location: U789D.001.DQD37KN-P1

Name: pci
Model: IBM,Logical_PHB
Node: pci@800000020000220
Physical Location: U789D.001.DQD34TR-P1

Name: vty
Node: vty@30000000
Device Type: serial
Physical Location: U9117.MMA.06F18E3-V11-C0

Name: l-lan
Node: l-lan@30000002
Device Type: network
Physical Location: U9117.MMA.06F18E3-V11-C2-T1

Name: l-lan
Node: l-lan@30000005
Device Type: network
Physical Location: U9117.MMA.06F18E3-V11-C5-T1

Name: ethernet
Node: ethernet@23e00008
Device Type: network
Physical Location: U789D.001.DQD34TR-P1-C10-T4

Name: ethernet
Node: ethernet@23e00010
Device Type: network
Physical Location: U789D.001.DQD34LP-P1-C10-T4

Name: pci
Node: pci@2
Physical Location: U789D.001.DQD37KN-P1

Name: pci
Node: pci@2,4
Physical Location: U789D.001.DQD37KN-P1

Name: pci
Node: pci@2
Physical Location: U789D.001.DQD34TR-P1

Name: pci
Node: pci@2,4
Physical Location: U789D.001.DQD34TR-P1

Name: pci1014,02BD
Node: pci1014,02BD@1
Physical Location: U789D.001.DQD37KN-P1-T3

Name: usb
Node: usb@1
Physical Location: U789D.001.DQD37KN-P1

Name: usb
Node: usb@1,1
Physical Location: U789D.001.DQD37KN-P1

Name: usb
Node: usb@1,2
Physical Location: U789D.001.DQD37KN-P1

Name: pci1014,02BD
Node: pci1014,02BD@1
Physical Location: U789D.001.DQD34TR-P1-T3

Name: usb
Node: usb@1
Physical Location: U789D.001.DQD34TR-P1

Name: usb
Node: usb@1,1
Physical Location: U789D.001.DQD34TR-P1

Name: usb
Node: usb@1,2
Physical Location: U789D.001.DQD34TR-P1

Name: hub
Node: hub@1
Physical Location: U789D.001.DQD37KN-P1-T1

Name: hub
Node: hub@1
Physical Location: U789D.001.DQD37KN-P1-T2

Name: hub
Node: hub@1
Physical Location: U789D.001.DQD37KN-P1

Name: hub
Node: hub@1
Physical Location: U789D.001.DQD34TR-P1-T1

Name: hub
Node: hub@1
Physical Location: U789D.001.DQD34TR-P1-T2

Name: hub
Node: hub@1
Physical Location: U789D.001.DQD34TR-P1


____________________________________________________________________________________
Displays the VPD (Vital Product Database) found in the customized VPD object class.
____________________________________________________________________________________

lscfg -v

$ lscfg -v
INSTALLED RESOURCE LIST WITH VPD

The following resources are installed on your machine.

Model Architecture: chrp
Model Implementation: Multiple Processor, PCI bus

sys0 System Object
sysplanar0 System Planar
vio0 Virtual I/O Bus
ent1 U9117.MMA.06F18E3-V11-C5-T1 Virtual I/O Ethernet Adapter (l-lan)

Network Address.............466DAA4CB305
Displayable Message.........Virtual I/O Ethernet Adapter (l-lan)
Hardware Location Code......U9117.MMA.06F18E3-V11-C5-T1

ent0 U9117.MMA.06F18E3-V11-C2-T1 Virtual I/O Ethernet Adapter (l-lan)

Network Address.............466DAA4CB302
Displayable Message.........Virtual I/O Ethernet Adapter (l-lan)
Hardware Location Code......U9117.MMA.06F18E3-V11-C2-T1

vsa0 U9117.MMA.06F18E3-V11-C0 LPAR Virtual Serial Adapter

Hardware Location Code......U9117.MMA.06F18E3-V11-C0

vty0 U9117.MMA.06F18E3-V11-C0-L0 Asynchronous Terminal
pci2 U789D.001.DQD34TR-P1 PCI Bus

Hardware Location Code......U789D.001.DQD34TR-P1

pci6 U789D.001.DQD34TR-P1 PCI Bus

Hardware Location Code......U789D.001.DQD34TR-P1

sissas1 U789D.001.DQD34TR-P1-T3 PCI-X266 Planar 3Gb SAS Adapter

ROM Level.(alterable).......02200070
Customer Card ID Number.....572C
Hardware Location Code......U789D.001.DQD34TR-P1-T3

sas1 U789D.001.DQD34TR-P1-T3 Controller SAS Protocol
hdisk1 U789D.001.DQD34TR-P3-D1 SAS Disk Drive (300000 MB)

Manufacturer................IBM
Machine Type and Model......HUS153030VLS300
FRU Number..................10N7234
ROS Level and ID............41343234
Serial Number...............ABCD73EF
EC Level....................H17923Y
Part Number.................42R5648
Device Specific.(Z0)........000005329F001002
Device Specific.(Z1)........VBIPA424
Device Specific.(Z2)........0068
Device Specific.(Z3)........08263
Device Specific.(Z4)........
Device Specific.(Z5)........22
Device Specific.(Z6)........H17923Y
Hardware Location Code......U789D.001.DQD34TR-P3-D1

ses3 U789D.001.DQD34TR-P3-Y2 SAS Enclosure Services Device

ROM Level.(alterable).......0021
Hardware Location Code......U789D.001.DQD34TR-P3-Y2

ses4 U789D.001.DQD34TR-P3-Y1 SAS Enclosure Services Device

ROM Level.(alterable).......0021
Hardware Location Code......U789D.001.DQD34TR-P3-Y1

sata1 U789D.001.DQD34TR-P1-T3 Controller SATA Protocol
pci7 U789D.001.DQD34TR-P1 PCI Bus

Hardware Location Code......U789D.001.DQD34TR-P1

usbhc2 U789D.001.DQD34TR-P1 USB Host Controller (33103500)

Hardware Location Code......U789D.001.DQD34TR-P1

usbhc3 U789D.001.DQD34TR-P1 USB Host Controller (33103500)

Hardware Location Code......U789D.001.DQD34TR-P1

usbhc5 U789D.001.DQD34TR-P1 USB Enhanced Host Controller (3310e000)

Hardware Location Code......U789D.001.DQD34TR-P1

pci0 U789D.001.DQD37KN-P1 PCI Bus

Hardware Location Code......U789D.001.DQD37KN-P1

pci4 U789D.001.DQD37KN-P1 PCI Bus

Hardware Location Code......U789D.001.DQD37KN-P1

sissas0 U789D.001.DQD37KN-P1-T3 PCI-X266 Planar 3Gb SAS Adapter

ROM Level.(alterable).......02200070
Customer Card ID Number.....572C
Hardware Location Code......U789D.001.DQD37KN-P1-T3

sas0 U789D.001.DQD37KN-P1-T3 Controller SAS Protocol
ses0 U789D.001.DQD37KN-P4-Y1 SAS Enclosure Services Device

ROM Level.(alterable)....... 06
Hardware Location Code......U789D.001.DQD37KN-P4-Y1

hdisk0 U789D.001.DQD37KN-P3-D1 SAS Disk Drive (300000 MB)

Manufacturer................IBM
Machine Type and Model......HUS153030VLS300
FRU Number..................10N7234
ROS Level and ID............41343234
Serial Number...............ABCDEFGH
EC Level....................H17923Y
Part Number.................42R5648
Device Specific.(Z0)........000005329F003002
Device Specific.(Z1)........VBIPA424
Device Specific.(Z2)........0068
Device Specific.(Z3)........08263
Device Specific.(Z4)........
Device Specific.(Z5)........22
Device Specific.(Z6)........H17923Y
Hardware Location Code......U789D.001.DQD37KN-P3-D1

ses1 U789D.001.DQD37KN-P3-Y2 SAS Enclosure Services Device

ROM Level.(alterable).......0021
Hardware Location Code......U789D.001.DQD37KN-P3-Y2

ses2 U789D.001.DQD37KN-P3-Y1 SAS Enclosure Services Device

ROM Level.(alterable).......0021
Hardware Location Code......U789D.001.DQD37KN-P3-Y1

sata0 U789D.001.DQD37KN-P1-T3 Controller SATA Protocol
cd0 U789D.001.DQD37KN-P4-D1 SATA DVD-RAM Drive

Manufacturer................IBM
Machine Type and Model......RMBO00205B1
ROS Level and ID............RA33
Device Specific.(Z0)........058002028F000030
Part Number.................42R7969
EC Level....................H89633
FRU Number..................42R7970
Hardware Location Code......U789D.001.DQD37KN-P4-D1

pci5 U789D.001.DQD37KN-P1 PCI Bus

Hardware Location Code......U789D.001.DQD37KN-P1

usbhc0 U789D.001.DQD37KN-P1 USB Host Controller (33103500)

Hardware Location Code......U789D.001.DQD37KN-P1

usbhc1 U789D.001.DQD37KN-P1 USB Host Controller (33103500)

Hardware Location Code......U789D.001.DQD37KN-P1

usbhc4 U789D.001.DQD37KN-P1 USB Enhanced Host Controller (3310e000)

Hardware Location Code......U789D.001.DQD37KN-P1

lhea1 U789D.001.DQD34LP-P1 Logical Host Ethernet Adapter (l-hea)

Hardware Location Code......U789D.001.DQD34LP-P1

ent3 U789D.001.DQD34LP-P1-C10-T4 Logical Host Ethernet Port (lp-hea)

IBM Host Ethernet Adapter:
Network Address.............00215E32BBC0

lhea0 U789D.001.DQD34TR-P1 Logical Host Ethernet Adapter (l-hea)

Hardware Location Code......U789D.001.DQD34TR-P1

ent2 U789D.001.DQD34TR-P1-C10-T4 Logical Host Ethernet Port (lp-hea)

IBM Host Ethernet Adapter:
Network Address.............00215E32BF40

L2cache0 L2 Cache
mem0 Memory
proc0 Processor


_____________________________________________________________________________________
How do I find out the chip type, system name, node name, model number, and so forth?
_____________________________________________________________________________________

The uname command provides details about your system.


Displays the system name, nodename, version, machine ID.

### uname -a contains command -s, -n ,-r, -v -m ###


$ uname -a
AIX myserver 1 6 00CF18E34C00


Displays the chip type of the system. For example, PowerPC.

$ uname -p
powerpc


Displays the release number of the operating system.

$ uname -r
1


Displays the system name. For example, AIX.

$ uname -s
AIX


Displays the name of the node.

$ uname -n
myserver


Displays the system model name. For example, IBM, 9114-275.

$ uname -M
IBM,9117-MMA


Displays the operating system version.

$ uname -v
6


Displays the machine ID number of the hardware running the system.

$ uname -m
00CF12345C00


Displays the system ID number.

$ uname -u
IBM,0123F45E6




==========
About AIX
==========

_____________________________________________________________________________
What version, release, and maintenance level of AIX is running on my system?
_____________________________________________________________________________

Type one of the following:

oslevel -r, lslpp -h bos.rte


$ oslevel -r
6100-04

$ lslpp -h bos.rte
Fileset Level Action Status Date Time
----------------------------------------------------------------------------
Path: /usr/lib/objrepos
bos.rte
6.1.2.0 COMMIT COMPLETE 02/17/09 10:49:17
6.1.4.0 COMMIT COMPLETE 03/30/10 09:25:43

Path: /etc/objrepos
bos.rte
6.1.2.0 COMMIT COMPLETE 02/17/09 10:49:17
6.1.4.0 COMMIT COMPLETE 03/30/10 09:25:43


__________________________________________________
What SP (Service Pack) is installed on my system?
__________________________________________________

To see which SP is currently installed on the system, run the oslevel -s command. Sample output for an AIX 5L Version 5.3 system, with TL4, and SP2 installed

would be:

oslevel รข€“s
5300-04-02


$ oslevel -s
6100-04-03-1009


_________________________________________
How many processors does my system have?
_________________________________________

To display the number of processors on your system, type:

lscfg | grep proc

$ lscfg | grep proc
+ proc0 Processor


____________________________________________________________________
How do I determine the amount of paging space allocated and in use?
____________________________________________________________________

Type the following:

lsps -a

$ lsps -a
Page Space Physical Volume Volume Group Size %Used Active Auto Type Chksum
hd6 hdisk0 rootvg 2048MB 18 yes yes lv 0




==================================
Volume groups and logical volumes
==================================

___________________________________________________________
To display the number of hard disks on your system, type:
___________________________________________________________

lspv

$ lspv
hdisk0 00cf18e34d375ab5 rootvg active
hdisk1 00cf18e3b4df2ae5 rootvg active


____________________________________________________________
How do I list information about a specific physical volume?
____________________________________________________________

To find details about hdisk1, for example, run the following command:

lspv hdisk1


$ lspv hdisk0
PHYSICAL VOLUME: hdisk0 VOLUME GROUP: rootvg
PV IDENTIFIER: 00cf18e34d375ab5 VG IDENTIFIER 00cf18e300004c000000011f817ad65a
PV STATE: active
STALE PARTITIONS: 0 ALLOCATABLE: yes
PP SIZE: 512 megabyte(s) LOGICAL VOLUMES: 15
TOTAL PPs: 558 (285696 megabytes) VG DESCRIPTORS: 2
FREE PPs: 275 (140800 megabytes) HOT SPARE: no
USED PPs: 283 (144896 megabytes) MAX REQUEST: 1 megabyte
FREE DISTRIBUTION: 71..00..00..92..112
USED DISTRIBUTION: 41..112..111..19..00
MIRROR POOL: None


_____________________________________
How do I display all logical volumes
_____________________________________

$ lsvg
rootvg


____________________________________________________________________________________________
How do I display all logical volumes that are part of a volume group (for example, rootvg)?
____________________________________________________________________________________________

You can display all logical volumes that are part of rootvg by typing the following command:

lsvg -l rootvg


$ lsvg -l rootvg
rootvg:
LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT
hd5 boot 1 2 2 closed/syncd N/A
hd6 paging 4 8 2 open/syncd N/A
hd8 jfs2log 1 2 2 open/syncd N/A
hd4 jfs2 1 2 2 open/syncd /
hd2 jfs2 7 14 2 open/syncd /usr
hd9var jfs2 2 4 2 open/syncd /var
hd3 jfs2 20 40 2 open/syncd /tmp
hd1 jfs2 1 2 2 open/syncd /home
hd10opt jfs2 2 4 2 open/syncd /opt
hd11admin jfs2 1 2 2 open/syncd /admin
livedump jfs2 1 2 2 open/syncd /var/adm/ras/livedump
fslv00 jfs2 40 80 2 open/syncd /export/nim
fslv01 jfs2 1 2 2 open/syncd /tftpboot
fslv02 jfs2 200 400 2 open/syncd /export/nim/mksysb
loglv00 jfslog 1 2 2 closed/syncd N/A


_________________________________________________
To show all the characteristics of rootvg, type:
_________________________________________________

lsvg rootvg

$ lsvg rootvg
VOLUME GROUP: rootvg VG IDENTIFIER: 00cf18e300004c000000011f817ad65a
VG STATE: active PP SIZE: 512 megabyte(s)
VG PERMISSION: read/write TOTAL PPs: 1116 (571392 megabytes)
MAX LVs: 256 FREE PPs: 550 (281600 megabytes)
LVs: 15 USED PPs: 566 (289792 megabytes)
OPEN LVs: 13 QUORUM: 1 (Disabled)
TOTAL PVs: 2 VG DESCRIPTORS: 3
STALE PVs: 0 STALE PPs: 0
ACTIVE PVs: 2 AUTO ON: yes
MAX PPs per VG: 32512
MAX PPs per PV: 1016 MAX PVs: 32
LTG size (Dynamic): 1024 kilobyte(s) AUTO SYNC: no
HOT SPARE: no BB POLICY: relocatable


____________________________________
To show disks used by rootvg, type:
____________________________________

lsvg -p rootvg

$ lsvg -p rootvg
rootvg:
PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION
hdisk0 active 558 275 71..00..00..92..112
hdisk1 active 558 275 71..00..00..92..112


_________________________________________________
How do I list information about logical volumes?
_________________________________________________

Run the following command to display information about the logical volume hd5:

lslv hd5


$ lslv hd5
LOGICAL VOLUME: hd5 VOLUME GROUP: rootvg
LV IDENTIFIER: 00cf18e300004c000000011f817ad65a.1 PERMISSION: read/write
VG STATE: active/complete LV STATE: closed/syncd
TYPE: boot WRITE VERIFY: off
MAX LPs: 512 PP SIZE: 512 megabyte(s)
COPIES: 2 SCHED POLICY: parallel
LPs: 1 PPs: 2
STALE PPs: 0 BB POLICY: non-relocatable
INTER-POLICY: minimum RELOCATABLE: no
INTRA-POLICY: edge UPPER BOUND: 32
MOUNT POINT: N/A LABEL: primary_bootlv
MIRROR WRITE CONSISTENCY: on/ACTIVE
EACH LP COPY ON A SEPARATE PV ?: yes
Serialize IO ?: NO


_______________________________________
How do I display mounted file systems?
_______________________________________

Type the following command to display information about all currently mounted file systems:

mount


$ mount
node mounted mounted over vfs date options
-------- --------------- --------------- ------ ------------ ---------------
/dev/hd4 / jfs2 Mar 30 09:54 rw,log=/dev/hd8
/dev/hd2 /usr jfs2 Mar 30 09:54 rw,log=/dev/hd8
/dev/hd9var /var jfs2 Mar 30 09:54 rw,log=/dev/hd8
/dev/hd3 /tmp jfs2 Mar 30 09:55 rw,log=/dev/hd8
/dev/hd1 /home jfs2 Mar 30 09:55 rw,log=/dev/hd8
/dev/hd11admin /admin jfs2 Mar 30 09:55 rw,log=/dev/hd8
/proc /proc procfs Mar 30 09:55 rw
/dev/hd10opt /opt jfs2 Mar 30 09:55 rw,log=/dev/hd8
/dev/livedump /var/adm/ras/livedump jfs2 Mar 30 09:55 rw,log=/dev/hd8
/dev/fslv00 /export/nim jfs2 Mar 30 09:55 rw,log=/dev/hd8
/dev/fslv01 /tftpboot jfs2 Mar 30 09:55 rw,log=/dev/hd8
/dev/fslv02 /export/nim/mksysb jfs2 Mar 30 09:55 rw,log=/dev/hd8


____________________________________________________________
How do I get partition-specific information and statistics?
____________________________________________________________

The lparstat command provides a report of partition information and utilization statistics. This command also provides a display of Hypervisor information.

$ lparstat

System configuration: type=Shared mode=Uncapped smt=On lcpu=2 mem=1024MB psize=8 ent=0.10

%user %sys %wait %idle physc %entc lbusy vcsw phint
----- ----- ------ ------ ----- ----- ------ ----- -----
1.5 0.7 2.0 95.7 0.00 2.4 2.7 438900296 6281425




=========
Network
=========

___________________________________________
How do I get the IP address of my machine?
___________________________________________

Type one of the following:

ifconfig -a, host Fully_Qualified_Host_Name (eg; host myserver)


$ host myserver
myserver is 192.168.1.1


_______________________________________________________
How do I identify the network interfaces on my server?
_______________________________________________________

Either of the following two commands will display the network interfaces:

lsdev -Cc if, ifconfig -a


$ lsdev -Cc if
en0 Available Standard Ethernet Network Interface
en1 Available Standard Ethernet Network Interface
en2 Defined Standard Ethernet Network Interface
en3 Defined Standard Ethernet Network Interface
en4 Available Standard Ethernet Network Interface
et0 Defined IEEE 802.3 Ethernet Network Interface
et1 Defined IEEE 802.3 Ethernet Network Interface
et2 Defined IEEE 802.3 Ethernet Network Interface
et3 Defined IEEE 802.3 Ethernet Network Interface
et4 Defined IEEE 802.3 Ethernet Network Interface
lo0 Available Loopback Network Interface


____________________________________________________________________________________________
To get information about one specific network interface, for example, en0, run the command:
____________________________________________________________________________________________

ifconfig en0

Wednesday, April 7, 2010

How to get runlevel information in HP-UX

[hpa50-16]/ >who -r
. run-level 3 Apr 9 06:23 3 0 S

How to check software information in HP-UX

To check software information in HP-UX is simple. Just type swlist or /usr/sbin/swlist

[hpa50-16]/ >swlist
# Initializing...
# Contacting target "hpa50-16"...
#
# Target: hpa50-16:/
#

#
# Bundle(s):
#

B8342AA B.11.11.05 Netscape Communicator 4.75
BUNDLE11i B.11.11.0102.2 Required Patch Bundle for HP-UX 11i, February 2001
Base-VXVM B.03.20.1 Base VERITAS Volume Manager 3.2 for HP-UX
CDE-English B.11.11 English CDE Environment
FDDI-00 B.11.11.02 PCI FDDI;Supptd HW=A3739A/A3739B;SW=J3626AA
FibrChanl-00 B.11.11.09 PCI/HSC FibreChannel;Supptd HW=A6684A,A6685A,A5158A,A6795A
GOLDAPPS11i B.11.11.0112.6 Gold Applications Patches for HP-UX 11i, December 2001
GOLDBASE11i B.11.11.0112.6 Gold Base Patches for HP-UX 11i, December 2001
GigEther-00 B.11.11.14 PCI/HSC GigEther;Supptd HW=A4926A/A4929A/A4924A/A4925A;SW=J1642AA
GigEther-01 B.11.11.02 PCI/PCI-X GigEther;Supptd HW=A6794A
HPUX11i-OE-Ent B.11.11.0203 HP-UX Enterprise Operating Environment Component
HPUXBase64 B.11.11 HP-UX 64-bit Base OS
HPUXBaseAux B.11.11.0203 HP-UX Base OS Auxiliary
HWEnable11i B.11.11.0203.5 Hardware Enablement Patches for HP-UX 11i, March 2002
OnlineDiag B.11.11.06.09 HPUX 11.11 Support Tools Bundle, Mar 2002
RAID-00 B.11.11.01 PCI RAID; Supptd HW=A5856A
TermIO-00 B.11.11.05 PCI MUX; Supptd HW=A6748A/A6749A/J3592A/J35923A; SW=J3596A
b_SOPHOS 2.12 (SOPHOS) Sophos Anti-Virus
perl B.5.6.1.C Perl Programming Language

How to check Ignite version in HP-UX

Command below can be used to find what is the version of Ignite installed in our server

shah@nxxx07:(shah)> more /opt/ignite/Version
C.7.1.93

C.7.1.93 is the version of installed Ignite :-)

Linux News Of The Day!

Powered By
widgetmate.com
Sponsored By
Credit Card Forum