Solaris Faq

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

Listing USB devices on Fedora 7

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 0×07a6 ADMtek, Inc.
idProduct 0×8511 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 0×81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0×0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0×02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0×0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0×83 EP 3 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0×0008 1x 8 bytes
bInterval 1

SSH Tips

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

Linux keyboard shortcuts.

Linux has many keyboard shortcuts. Knowing them makes using Linux much easier.

Console/terminal

  • Ctrl-Alt-Delete – shuts down computer
  • Alt-Fn (F1, F2, F3,…) – switch to n-th console
  • Alt-Left or Alt-Right – switch to next/previous virtual terminal
  • Scroll Lock – locks terminal input/output – allows to read console contents when output is going too fast. To unlock, press Scroll Lock once again.
    Alternatively, Scroll Lock can be enabled using Ctrl-S and disabled with Ctrl-Q. Try last shortcut if your console hangs for unknown reason – it happened to me many times that I’ve locked it accidentaly by pressing CTRL-S.
  • Shift-Page Up and Shift-Page Down – scrolls console buffer up/down. Works also when Scroll Lock is enabled. After changing the terminal (Alt-Fn) buffer contents is erased and it is impossible to scroll it.
  • Ctrl-L – screen refresh
  • Ctrl-C or Ctrl-Backslash – kills current task
  • Ctrl-D – stands for EOF (End-of-file). If you type it on en empty command line, it will quit bash. This is so much faster than typing exit
  • Ctrl-Z – pause process. Use commands: bg to run in background or fg to run in foreground.




Bash & command-line

  • Ctrl-A – moves cursor to beginning of command line.
  • Ctrl-E – moves cursor to end of command line.
  • Ctrl-K – clears command line from cursor position to end of line.
  • Ctrl-U – clears command line from cursor position to beginning of line.
  • Ctrl-W – clears word to the left
  • Ctrl-Y – will paste in anything that was deleted by Ctrl-U or Ctrl-K or Ctrl-W
  • Tabcommand-line autocompletion. Automatically completes current command line.
    If autocompletion script is enabled, then also options and applications parameters are autocompleted.
  • Ctrl-R – followed by characters will do a incremental search of the previous command history



Kernel shortcuts

Following shortcuts must be enabled in kernel, they also must be enabled using proc interface (echo 1 > /proc/sys/kernel/sysrq).

  • Alt-SysRQ-S – sync all mounted filesystem. Data in buffers is immediately written to disks.
  • Alt-SysRQ-U – remounts mounted filesystems read-only
  • Alt-SysRQ-B – performs immediate reboot. Don’t do it without syncing and unmounting as it can cause massive filesystem corruption
  • Alt-SysRQ-S, then Alt-SysRQ-U, then Alt-SysRQ-B – attempts to sync all mounted filesystems, remounts them read-only and immediately reboots computer. Fastest way to reboot Linux.
  • Alt-SysRQ-H – prints out list of other SysRQ functions.



X-Windows shortcuts

  • Ctrl-Alt-Plus or Ctrl-Alt-Minus- changes screen resolution (higher/lower). Only if X-Windows server is configured for multiple resolutions.
  • Ctrl-Alt-Backspace – kill X-server. Running applications will be terminated.
  • Ctrl-Alt-Escapexkill – click an application to kill it.
  • Ctrl-Shift-Num Lock will turn the keypad on the keyboard into the mouse, so you can control the mouse from keyboard. Keys / and * on the numpad select left mouse click and right mouse click respectively. Mouse click is done by 5 on the numpad.
  • Ctrl-Alt-Fn (F1, F2, F3,…) – switches to n-th text console.



KDE shortcuts

  • Ctrl-Alt-Shift-Page Down – direct shutdown
  • Ctrl-Alt-Shift-Page Up – direct reboot
  • Alt-F2 – Starts the run command box. Type a application executable to launch it, folder name to open it, filename to use an appropriate program to launch it, url to go to it in konqueror and any of the numerous web shortcuts(gg, wp) defined by konqueror to activate them.

Do you know any other shortcuts that are worth to know?

Oracle Database 11g on Linux now available !!!

Oracle Database 11g Release 1 (11.1.0.6.0) – Standard Edition,
Standard Edition One, and Enterprise Edition – became avialable
for download from OTN.

You can download it from this link – a 1.7GB single zip file.

Execute shell commands from a C program

Heres a C Program that use system() function to
execute shell commands:

See man system for more information:

[root@linuxbox C_Programs]# cat test.c
#include
main()
{
printf (“Files More than 10 MB !!\n”);
system(“find . -size +10000k”);
return 0;
}

[root@linuxbox C_Programs]# gcc test.c

[root@linuxbox C_Programs]# ./a.out
Files More than 10 MB !!
./xemacs-packages-extra-20061221-1.fc7.noarch.rpm

Programming C under Unix

Writing a test Program in C (Unix):
====================================
[root@linuxbox C_Programs]# cat test.c
#include
main()
{

printf (“Hello Sriram!!\n”);

return 0;

}

Executing the above :
=====================
[root@linuxbox C_Programs]# gcc test.c

[root@linuxbox C_Programs]# ls
a.out test.c

[root@linuxbox C_Programs]# ./a.out
Hello Sriram!!

Find command tips …

Finding Max space used by Top 10 Files in MB:
============================================

[root@linuxbox Desktop]# find /tmp -type f | xargs ls -msa
| sort -rn | awk ‘{size=$1/1024;printf(“%dMb %s\n”, size,$2);}’
| head

10Mb /tmp/openldap-devel-2.3.34-0.fc7.i386.rpm,
6Mb /tmp/newtonslaw.wav
4Mb /tmp/openldap-clients-2.3.34-0.fc7.i386.rpm,
3Mb /tmp/ntfs-3g-1.516-1.fc7.i386.rpm,
2Mb /tmp/fuse-2.6.5-1.fc7.i386.rpm,
1Mb /tmp/orbit-root/bonobo-activation-server-ior,
0Mb /tmp/gconfd-root/lock/ior,
0Mb /tmp/orbit-root/bonobo-activation-register.lock,

Finding files which are more than 10 MB:
========================================

find /tmp -name “*” -size +10000k

Finding files modified 3 days ago but less than 5 days:
========================================================

find /tmp -type f -mtime +2 -mtime -5

Find files that were accessed exactly 3 days a go
==================================================
find /tmp -type f -atime 3

-atime +7: All files that were last accessed more than 7 days ago
-atime 7: All files that were last accessed exactly 7 days ago
-atime -7: All files that were last accessed less than7 days ago

To replace recursive in *.html files, with multiline support:
=============================================================
find ./dir/ -name *.html -exec perl -pi -e ‘undef $/;
s/REPLACE-THIS/WITH-THAT/s’ {} \;

Update the modification date for all files in the
current directory and below:
=================================================
find . -exec touch {} \;

Remove files in a directory that were created more
than x number of days ago (great for managing Maildir).
======================================================
find ./ -ctime +x | xargs | rm -f -r

This should delete files older than 7 days, and
print the name of each file it deletes.
=================================================
find ./ -ctime +7 -name “*.zip” -exec rm -f {} \; -ls

# If you want to be prompted before it deletes a file:
find ./ -ctime +7 -name “*.zip” -exec rm -i {} \; -ls

This will list the files with names ending in .c
and containing the word hello:
=================================================

find . -type f -name ‘*.c’ -exec grep -l hello {} /dev/null \;

Find all the files recursively that contain foo:
================================================
find . | xargs grep foo
./a:foo
./c:foo
./d:ifoo

a,c,d are the file names that contain foo

Mounting Windows NTFS partition under Fedora 7

I have a dual boot Fedora 7 + Windows 2000 Pro

When I tried mounting the NTFS Partition

# mount /dev/hda1 /mnt/win
mount: unknown filesystem type ‘ntfs’

I got the above message.

Then this is what I did to Mount windows NTFS partition
Under Fedora Release 7(Moonshine):

Install the below packages from Fedora core 7 DVD

rpm -ivh fuse-2.6.5-1.fc7.i386.rpm
rpm -ivh fuse-libs-2.6.5-1.fc7.i386.rpm
rpm -ivh ntfs-3g-1.516-1.fc7.i386.rpm

[root@linuxbox tmp]# fdisk -lu

Disk /dev/sda: 40.0 GB, 40007761920 bytes
255 heads, 63 sectors/track, 4864 cylinders,
total 78140160 sectors
Units = sectors of 1 * 512 = 512 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 63 51199154 25599546 7 HPFS/NTFS
/dev/sda2 51199155 51407999 104422+ 83 Linux
/dev/sda3 51408000 78140159 13366080 8e Linux LVM

My Windows NTFS partition is /dev/sda1

I create a directory
#mkdir /mnt/win_c/

Then Mount it:
[root@linuxbox tmp]# mount -t ntfs-3g /dev/sda1 /mnt/win_c/

[root@linuxbox win_c]# pwd
/mnt/win_c

[root@linuxbox win_c]# ls
arcldr.exe hawkz.exe RECYCLER
arcsetup.exe hiberfil.sys S4uDi.exe
AUTOEXEC.BAT IO.SYS Songs
boot.ini MSDOS.SYS Sriram
citianywhere.log My Music swsetup
citrix.log NTDETECT.COM System Volume Information
CONFIG.SYS ntldr WINNT
Documents and Settings pagefile.sys YServer.txt
Ebooks Program Files

HP Unix 11i commands

HP-Unix Command Line:

1) swinstall – installs software selections from a software source to either
the local host or to one or more target selections.

2) swremove – unconfigure and remove software products that has had software
loaded with software distributor.

3) swlist – display information about software products
The swlist command has a Graphical User Interface invoked by the swlist -i option.

4) swconfig – configure, unconfigure, or reconfigure installed software.

5) swverify – verify software products.

6) swpackage — Package a software distribution.

7) swacl – view or modify the Access Control Lists (ACLs) which protect
software products.

8) swjob – display and monitor job information and create and remove jobs.

The graphical user interface version of this command can be invoked with sd
or swjob -i

9) swcopy – The swcopy command copies software between depots.
Software that is copied into a depot cannot be used directly;
it is placed there only to act as a source for installation and other SD-UX operations.

10) swreg – Register/unregister depots and roots.

11) Updating Kernel in HP-UX 11i :

#cd /stand/build
#/usr/lbin/sysadm/system_prep -s system

This extracts the kernel file from currently running system.

#mk_kernel -s system

Makes new kernel in /stand/build directory called vmunix_test.
DLKM files are produced as /dlkm.vmunix.prev

At this point, the new kernel exists in the /stand/build directory.

It is recommended that you rename the existing kernel

#mv /stand/system /stand/system.prev

Now update the new kernel with :
#kmupdate /stand/build/vmunix_test

Kmupdate will automatically create backup copies of
/stand/vmunix and /stand/dlkm

as vmunix.prev and dlkm.prev under /stand

You can shutdown and boot from new kernel.
cd /; shutdown -r 0

Shuts the system so it comes with new kernel.

12) sam – starts the menu driven system Administration Manager.

Extras:
*) /stand : This contains kernel configuration and binary file that are required to
bring up a system. The important files in this dir is system, cmunix and dlkm files.

*) Default File System used in HP-UX 11i is Journal File System(JFS).

For more info visit : http://docs.hp.com
also visit www.sunguru.com for daily updates

Next Page »