Unix Blog !

July 29, 2008

Mounting a cdrom under Solaris

Filed under: Uncategorized — Tags: , — sriram003 @ 12:53 pm

1) Log in as a user with root authority.

2) Insert the CD-ROM into the drive.

3) If the Volume Manager (vold) is running on your system, the CD-ROM is automatically mounted as /cdrom/cd_label if the CD has a label or /cdrom/unnamed_cdrom if it is unlabeled. (more…)

July 7, 2008

Solaris quick reference !

Filed under: Uncategorized — Tags: — sriram003 @ 5:21 am

Display Physical RAM:
prtconf

Kernel modules are stored in three directories
1)  /platform/sparc/kernel or /platform/i86pc/kernel
2)  /kernel
3) /usr/kernel

List devices:
sysdef

Configure a Device:
drvconfig

Remove a Device:
rem_config

Where are the templates stored that are copied into the user’s home
directories for their personal customizations?

/etc/skel

# Display the parent/child tree of a process ?
– ptree Example: ptree 1267

# Show the working directory of a process ?
– pwdx Example: pwdx 1267

# Display the processes current open files ? –
pfiles Example: pfiles 1267

Alternative for top command ? –
prstat -a

July 4, 2008

diff 2 files; output diff’s to 3rd file

Filed under: Uncategorized — Tags: , — sriram003 @ 5:20 am

bash# diff file1 file2 | grep “[<>]” | sed “s/>/\t/g;s/<//g” > file3

The above command will the difference of file1 file2 in file 3

The output of file3 looks like below:

host1
host2
                 host3
                 host4

which means file1 has host1 and host2 which is not found in file2,  and in file2 there are words like host3, host4 which is not found in file1.

June 22, 2008

While running df command it says read only filesystem

Filed under: Uncategorized — sriram003 @ 3:11 pm

Taking further from my previous post,

I was not able to run df -k command :

It says , no filesystems processed:

Solution:

To remount root filesystem with read-write :
$mount -o remount,rw /

This will make a entry in /etc/mtab for read,write access to root filesystem

Using Linux Rescue

Filed under: Uncategorized — Tags: — sriram003 @ 3:09 pm

While trying to install Fedora core 8 on my Virtualbox(VM)
It got hanged after installation was done …

Here’s what I did:

1) Boot through Fedora core 8 CD

2) Select rescue installed system.

3) You will be asked to select the language, which defaults to English. Select the appropriate language and press OK to continue.

4)You will be asked to select the keyboard type, which defaults to us (USA). Select the appropriate keyboard type and press OK to continue.

5) do you want to start network interface – NO

6) Now it says, the rescue environment will find linux install and mount it under /mnt/sysimage – Select Continue

7) now it will say: your sytem is mounted under /mnt/sysimage and will reboot
if you exit – OK

8) now you you get a shell prompt

Once at shell prompt, Type :

i) chroot /mnt/sysimage
ii) fsck /dev/sda1 or fsck -p /dev/sda1

remove disk.
Reboot and check … your system should be up !

May 20, 2008

Shell Script Comparing files …

Filed under: Shell Script — sriram003 @ 12:09 pm

Have a file (file1) which is like

host1
host2
host3
host4
the list goes on…………

Now I want the above lines in files to be compared with files under
/opt/new/*

File names under /opt/new are as below:
Dev
Prod
QA

And suppose host1 from file1 is found under Dev(file under /opt/new)
than it should write under a seperate file New-list as host1-DEV

Ans:

while read line; do echo ${line}-$(grep -l $line /opt/new/*); done < file1 > new-file

The above line reads from file1 and compares the list of hosts given under it with
all files under /opt/new/* and if the host on file matches on any of file.

Then it writes to a new file (new-file) as
host-filename, here host is the one listed in file1 and filename is
the file under which it found the host .

eg if it finds host1 under dev file (/opt/new)

It will write as host1-dev under new-file !

March 27, 2008

Filed under: Solaris — sriram003 @ 12:18 pm

Identify Zombie Process in Solaris and Clean it :

bash-2.03$ ps -ef |grep defunct (The one marked in dark below is Parent Process)
zasshr 8134 24291 0 0:00 <defunct>
………………………
..It will show u a list…………………….

bash-2.03$ ptree 24291
24291 /opt/VRTSvcs/bin/CitiEquity/CitiEquityAgent -type CitiEquit
8134 <defunct>
8205 <defunct>

………………………
..It will show u a list…………………….

To Find total count for the defunct Parent Process :

bash-2.03$ ptree 24291 |wc -l

158

To clean the defunct Process:

$ preap 24291
24291: exited with status 0


December 13, 2007

Solaris Faq

Filed under: Solaris, Solaris Faq — sriram003 @ 1:55 pm

What is the command to do an interactive boot from the ok promt?
boot -i

How can i disable STOP+A utility on SUN machines,
which brings system into OK> prompt???.
In /etc/system set abort_enable=0 will disable STOP-A

Where are the templates stored that are copied into the user’s home
directories for their personal customizations?
/etc/skel

What SPARC emergency keyboard sequence will take
the system to the ok prompt (forth monitor) but will send output to TTYA?
STOP+A

What file controls system wide password aging?
/etc/shadow

What flag used with patchadd will prevent a later back out by
preventing patchadd from backing up files? If this flag is used,
the patch cannot be removed.
patchadd -d

What file do you put the umask setting in?
The UMASK value for bourne and korn shell users can
be modified system wide by editing the “umask” entry in the
“/etc/profile” file. To change the default UMASK for the C shell,
modify the UMASK variable in “/etc/default/login” file.

Which of the following commands can tell you whether
packets are being delayed or dropped on your network?
spray
% spray -c 100 -d 20 0 -l 2048 pluto
The following example sends 100 packets to a host (-c 100)
with each packet having a size of 2048 bytes (-l 2048). The packets
are sent with a delay time of 20 microseconds between
each burst (-d 20). If you don’t use a delay, you may run out of buffers.

Partition sizes can be set manually or from what configuration?
/etc/format.dat

Give the command that will display your default boot device.
eeprom boot-device & not printenv as suggested

How many different kill signals are there?
EXIT HUP INT QUIT ILL TRAP ABRT EMT FPE KILL
BUS SEGV SYS PIPE ALRM TERM USR1 USR2 CLD PWR
WINCH URG POLL STOP TSTP CONT TTIN TTOU VTALRM PROF
XCPU XFSZ WAITING LWP FREEZE THAW CANCEL LOST XRES RTMIN RTMIN+1 RTMIN+2 RTMIN+3 RTMAX-3 RTMAX-2 RTMAX-1 RTMAX

What software install group do you need to select in order to load the compilers?
sunwcprog
End User System Support Software Group (SUNWCuser)
Developer System Support Software Group (SUNWCprog)

What command can you use to display all of your groups?
groups – To display full list
id -a – To diaplsy full list of groups with group id numbers

What does this file /etc/path_to_inst contain and what is the
importance of this file
/etc/path_to_inst contains each device,
its instance name and number along with its physical name.

What is the command can reconfigure devices with out reboot?
devfsadm – solaris 8 onwards

How to restore a corrupted file sytem or trouble shoot bad
super blocks for a FS c0t2d0s5 ?
Well you can also just use the #FSCK -N /dev.dsk/c0t2d0s5
to get the back up block number and then using one of the numbers
that display #FSCK -F ufs -o b=32 can be executed.

How will you add a virtual IP address to a server. Given the interface
qe0 and IP 10.10.1.150
# ifconfig qe0:1 10.10.1.150 up
where “qe0” is an interface (e.g., le0) and N is a number between 1 and
. Removing the pseudo interface and associated address is done
with “ifconfig qe0:1 10.10.1.150 down”.
As with physical interfaces, all you need to do is make the
appropriate /etc/hostname.qe0:X file.

Boot phases of Solaris Operating Environment are:
1.boot PROM
2.boot programs like bootblk,ufsboot
3.kernel initialization like loading modules
4. init phase

How do you determin which Run Level the sytem is running
who -r

How would you find out what version of Solaris is currently running?
Run the command showrev. There’s a man page on showrev and
there are switches to help you do whatever you’re trying to do

As a system administrator, how would you figure out the system
transaction is slow between the system you logged into and from the system you did telnet login?
-time

# Display the parent/child tree of a process ?
– ptree Example: ptree 1267

# Show the working directory of a process ?
– pwdx Example: pwdx 1267

# Display the processes current open files ? –
pfiles Example: pfiles 1267

Alternative for top command ? –
prstat -a

December 9, 2007

Listing USB devices on Fedora 7

Filed under: Linux Utilities, lsusb, Unix Commands, USB — sriram003 @ 5:27 pm

lsusb command can list all usb devices found,
I had Fedora core 7(moonshine) installed and i did not find the command,

I had to install usbutils which brings the command:

[root@linuxbox ~]# yum -y install usbutils
Installed: usbutils.i386 0:0.71-2.1
Complete!

[root@linuxbox ~]# lsusb
Bus 004 Device 001: ID 0000:0000
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000
Bus 001 Device 004: ID 07a6:8511 ADMtek, Inc. ADM8511 Pegasus II Ethernet
Bus 001 Device 003: ID 046d:c016 Logitech, Inc. M-UV69a Optical Wheel Mouse

[root@linuxbox ~]# lsusb -d 07a6:8511 -v <— gives details
Bus 001 Device 004: ID 07a6:8511 ADMtek, Inc. ADM8511 Pegasus II Ethernet
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x07a6 ADMtek, Inc.
idProduct 0x8511 ADM8511 Pegasus II Ethernet
bcdDevice 1.01
iManufacturer 1 ADMtek
iProduct 2 USB To LAN Converter
iSerial 3 0001
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 39
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xa0
Remote Wakeup
MaxPower 160mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 3
bInterfaceClass 0 (Defined at Interface level)
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0008 1x 8 bytes
bInterval 1

SSH Tips

Filed under: Shell Script, ssh, Unix Commands — sriram003 @ 6:41 am

Pointing to some SSH tips given in Linux Magazine:

$ssh -T user@hostname

If you connect to a host this way, it will disable pseudo-tty allocation
and a command like w will not show your connection. Better add
`bash -i’ , as below.
$ssh -T user@hostname /bin/bash -i

With the below command the IP address of the system you connect to wont be
logged into known_hosts file, usually its in /root/.ssh/known_hosts.

$ssh -o UserknownHostsFile=/dev/null -T user@hostname /bin/bash -i

Older Posts »

Create a free website or blog at WordPress.com.