Commands.txt

solaris commands

wipro-bby
wiprobby

1. /usr/bin/uname – display current OS name, versin, Architecture

2. /usr/bin/uptime – Display how long the system has been up

3. /usr/bin/prtconf – Displays out detailed hardware info.

4. /usr/bin/prstat – Display active process statistics with the top process taking the most resource.

5. /usr/platform/sun4u/sbin/prtdiag – Displays very detailes hardware info such as CPU speed, CPU chache and on what slots memory chips is installed.

6. /usr/bin/showrev – displays machine and software version info.

7. /usr/bin/w – display info on currently logged on users.

8. Adding users –
#useradd -d /export/home/username -m -s /bin/ksh
the -m option tells the useradd command to automatically create the home directory.
NOte: do not store user directory in /home as this directory is used by solaris automounter. the automountwer gives the user to login to many machines and automatically ahve their home directories mounted on that machines /home area.

9. to delete users. – /usr/bin/userdel
for eg. userdel -r – will delete the users home directory as well.

10. psrinfo -v – processor info.

11. netstat -rn – show the routing table.

12. ifconfig -a – show the network iface info.

13. explorer output
/opt/SUNWexplo/bin/explorer – it is an executable file used to generate the explorer output
/opt/SUNWexplo/etc/ – directory contains the explorer tar files.

14. passwd -sa — for checking all system users password.

Network Configuration in Solaris.
1. to set the machine’s name – /etc/nodename

2. using DNS edit: /etc/nsswitch.conf – look for line that starts with “hosts:”
add “dns” to the end of the line.
you can add the “dns” entry to the very beginning of the line, which changes the order in which solaris will do the name lookups. for eg. if you have “nis” before “dns” it will check in nis database first and try to resolve it from there and if you have files before dns it will look in the /etc/hosts files before it look in dns.

3. adding entries in /etc/resolv.conf
file: /etc/resolv.conf
search domainname.com
domain domainname.com
nameserver ns1
nameserver ns2

4. adding machines info in /etc/hosts file.
file:/etc/hosts
ipaddr hostame

5. edit the following files.
/etc/net/ticlts/hosts
/etc/net/ticolts/hosts
/etc/net/ticotsnord/hosts

6. editing the interface name files.
sun systems can have multiple network cards, and each of those cards answer to a different hostname you may also have to edit a file to assign the hostname to the main network card.. you may want a single server to respond to many hostnames. the main network interface is mainly “hme0”.
to edit interface: /etc/hostname-interface

7. to edit netmask.
/etc/inet/netmasks
—————————————————————————————————————————-
###Exporting Display
##logging on server A using VNC.
1.ssh server B
2.xhost server B
3.export display server A:1.0

##for automatic color schemes.
ls –color=auto

##for time styling
ls –time-style=+%d-%m-%y\&H%M

##adding alias in .profile
alias variable=”alias name”
here “alias name” refers to any command which can be used in conjugtion.

##to show all the hidden files in one directory.
ls -d .*

##to remove empty lines using sed.
sed `/^$/d’

##password aging script in linux if chage is not working.
chage -l usernaem – most appropriate condition.
else
login as root.
grep the users in /etc/passwd file using:
#cut -d: -f1 /etc/passwd
#while read line do
#chage -l $users | grep “password expires” and line
#disply $users- your password will expire on

###Configuring Network.
##adding net up on command line.
#ifconfig eth0 netmask brodcast up

##adding the default gateway.
#route add default gw

##add the nameserver entries.
file: /etc/resolv.conf

#nmblookup -A -d1
#smblookup -LBC8 -I -U knopix % -w workcener name -d3

AIX commands.
#lscfg -vp | grep -p Cabinet — to check the cabinet no. on IBM/AIX

#lsdev -Cc Tape — to list the tape devices.

#rmdev -dl /dev/rmt0 — to delete rmt0 device.

#cfgmgr -v — reread the system hardware components and if iut finds any new thing. it will configure it accordingly.

#lsdev -Cc Tape — configure the tape drive.

#cfgmgr — same as above

#cat /etc/exclude.rootvg — filesystems to exclude while taking complete system backup.

#lsvg -l rootvg — list the volumme group called as rootvg

#smit mksysb — the smit interface to take the system backup

#tail smit.log — tail the log files to see smit is working fine.

#tctl -f /dev/rmt0 rewoffl -eject — this will rewind the tape and will eject the tape device.

#restore -tvf /dev/rmt0 — to list the contents of the tape device

#find ./log ./out -print | backup -ivf /dev/rmt0 | tee /tmp/log — to take backup of some files from ./log and ./out directory on tape device rmt0 while logging and printing the output on the screen.

#restore -xqdvf /dev/rmt0 — restoring the complete backup on the harddisk directory. the command must be fired from the parent directory to avoid confusions in where to restore dir. name.

########Grub.conf — How it works
####Manually loading through the bootloader.

###This will boot the windows partition.
rootnoverify (hd0,0)
makeactive
chainloader +1
boot

###booting linux fron /dev/hda3 device
root (hd0,2)
kernel /boot/vmlinuz root=/dev/hda3 -s
boot
initrd /boot/initrd

####SHUTTING DOWN ORACLE 9i

1. ps -aef | grep pmon -> to check orcale instances running.
2. sqlplus /as sysdba
3. shutdown immediately
4. exit
5. ps -aef | grep ora
6. ps -aef | grep tltns
10. kill -9 ora9ibrn

### copies a single 1024 block from /dev/zero(a continuous stream of zero bytes) to the file new file.
dd if=/dev/zero of=new_file bs=1024 count=1

iostat -En will show the devices like c0t0d0.
product :- the last line gives the size of the disk
mount -F hsfs /dev/dsk/c0t0d0s0 /mnt

To see all of the slices on all of the disks the easiest thing is:
prtvtoc /dev/rdsk/*s2
To see all disks do this:
format /dev/null 2>&1 redirecting the cron log to /dev/null
hwclock –systohc sync date with hwclock

df -g |awk ‘{print $1}’
df -g |awk ‘{print $7}’
df -g |awk ‘{print $4}’

To Change the username and home permission of a user
groupmod -n sysadmin santosh
usermod -d /home/sysadmin -m -g sysadmin -l sysadmin santosh

vncserver -kill :1

psrinfo will give number of cpus in Sun Solar
is

OGL Backup
cd /oraapps/oracle/prodcomn/admin

# find ./out ./log print | backup ivf /dev/rmtn

pscp.exe -pw ‘password’ “local machine path” user@host:/path/to/home/

df -g refresh
while :^Jdo^Jdf -g /kcf1dr /kcfdrvg^Jsleep 2^Jclear^Jdone

stopping one spd device
setsp -T -l3

3 is SPD number.

TIP
tip -9600 /dev/ttya
tip -9600 /dev/ttyb

changing users unsuccessful login attempt using sudo
sudo chsec -f /etc/security/lastlog -s username -a unsuccessful_login_count=0

mount -t ext3 -o acl

give rwx privileges to a user which does not belong to the group
setfacl -m u:prod:rwx test
checked the privileges using

getfacl -a test

opensssl rand -base64 6
—————————————————————————-
Restoration of backup
# restore -xdvgf /dev/rmtn
n-> no. of the tape drive attached.

To rewind and ejject the tape
# tctl -f /dev/rmtn rewoffl

To list the contents of the tape drive
# restore -Tl -vf /dev/rmt0

To check user account status like locked, unlocked and when the password expires etc.. use
on
AIX:
chuser

Solaris
passwd -s username

Linux
Chage -l username

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s