Showing posts with label AIX - Tips n Tricks. Show all posts
Showing posts with label AIX - Tips n Tricks. Show all posts

Friday, 17 June 2016


AIX Tips 'n' Tricks - Part III

1. How to list IDE controllers in your system ?

lscfg -l ide*

Sample Output:

DEVICE LOCATION DESCRIPTION
ide0 01-00-00 ATA/IDE Controller Device
ide1 01-00-01 ATA/IDE Controller Device

It shows
Controller ide0 and ide1 are located on the system planar
(Notice 1st and 2nd digits in location code).
The planar indicator is the second digit in the location value with a value of 1.
6th digit indicates the controller number.

2. After a successful login, the login command displays the message of the day, the date and time of the last successful and unsuccessful login attempts for this user, and the total number of unsuccessful login attempts for this user since the last change of authentication information (usually a password).

How to supress these messages?

You can supress these messages by creating a .hushlogin file in your home directory.

At the prompt in your home directory, type the following:
# touch .hushlogin

The touch command creates the empty file named .hushlogin if it does not already exist. The next time you log in, all login messages will be suppressed. You can instruct the system to retain only the message of the day, while suppressing other login messages.

3. What are the files, system reads when you logon ?

First File : /etc/environment - contains variables specifying the basic environment for all processes.

Second File: /etc/profile - controls system-wide default variables

Third File : $HOME/.profile - lets you customize your individual working environment

Fourth File: $HOME/.env - lets you customize your individual working environment variables.


4. How to override variables defined in /etc/environment for a particular user?

A fourth file that the operating system uses at every user logon is the
$HOME/.env file, if your .profile contains the following line: export
ENV=$HOME/.env The .env file lets you customize your individual
working environment variables.

The .env file contains the individual user environment variables that override the variables set in the /etc/environment file. You can customize your environment variables as desired by modifying your .env file.

5. How to change the font in AIX ?

To change the font to an italic, roman, and bold face of the same size, type the following:

# chfont -n /usr/lpp/fonts/It114.snf /usr/lpp/fonts/Bld14.snf /usr/lpp/
fonts/Rom14.snf

You can also use smitty chfont.

6. How to run a process in the background ?

For Ex, to run script1.sh in background run

# script1.sh & -> But this script process gets killed if you close the terminal

So always run, # nohup script1.sh &

Usage of nohup doesn't kill the process if you close the telnet session.
Output from the process/script will be stored in a file called nohup.out in the directory from where you started the process.

So if you want to start backup using mksysb and close your terminal wihle leaving leaving office, you can safely use "nohup command &".

Next day morning, you can view the contents of nohup.out to know the status of the backup job.

7. Whats the default priority for a process?

Default priority is 0. Priority numbers is in the range of -20 to 20.
Highest number is the lowest priority and lowest number has hight priority.

To set the priority while start a process, use nice command.
If the process is already running, you can use "renice" command to change its priority.

8. How to stop, resume a process and to make it foreground process?

To stop(pause) a foreground process, use Cntrol + Z keys ie., Ctrl+Z.

Note: Ctrl+Z works in the Korn shell (ksh) and C shell (csh), but not in the Bourne shell (bsh). To restart a stopped process, you must either be the user who started the process or have root user authority.

To restart a stopped process, enter
# kill -19 pid

To run it in foreground, enter
# fg pid

where pid is the procedd id which can be obtained from "ps -ef | grep process_name"

9. How to display a program output as well as copying to a file ?

Normally usage of output redirection supresses the output on screen.
Ex. ls -l > file1

If we want to redirect the output as well as show the output in screen use the tee command.

Ex: ls -l | tee -a file1

10. How to capture the terminal screen to a file ?

To capture the screen of a terminal, at the prompt, type the following:

#script

The system displays information similar to the following:

Script command is started. The file is typescript.

Everything displayed on the screen is now copied to the "typescript" file.

To stop the script command, press Ctrl-D or type exit and press Enter.

The system displays information similar to the following:

^D
Script command is complete. The file is typescript.

Use the cat command to display the contents of your file.

11. How to number all lines in a file ?

# n1 -ba file1.txt

This will display all lines of file1.txt alongwith their line number.

12. What are the supported file systems in AIX ?

a) JFS (or) JFS2 - Disk based file system
b) NFS - Network based File system
c) CDRFS - CDROM based file system
d) UDFS - DVD-ROM based file system
e) RAMFS - RAM based file system used while booting the system

13. What are the different directory abbreviations ?

Abbreviation Meaning
. The current working directory
.. The parent of the current working directory
~ Your home directory
$HOME Your home directory

14. What are the different directory path names ?

Absolute path name - Traces the path from the /(root) directory.
Absolute path names always begin with the slash (/) symbol.
Ex. /home/raja/dir1

Relative path name - Traces the path from the current directory
through its parent or its subdirectories and files. As user "raja", I
can say ./dir1 since I'm already in /home/raja

15. How to move a directory ?

# mvdir book manual

This moves the book directory under the directory named manual, if the manual directory exists. Otherwise, the book directory is renamed to manual.

16. What the RAID groups AIX LVM supports?

RAID-0 - Striping
RAID-1 - Mirroring
RAID-10 (or) RAID 0+1 - Mirroring and striping

17. How to read and remove mails from my system mailbox?

At your system command line prompt, enter the mail command:
# mail

If there is no mail in your system mailbox, the system responds with a message:
No mail for YourID

If there is mail in your mailbox, the system displays a listing of the messages in your system mailbox:

Mail Type ? for help.
"/usr/mail/lance": 3 messages 3 new
>N 1 karen Tue Apr 27 16:10 12/321 "Dept Meeting"
N 2 lois Tue Apr 27 16:50 10/350 "System News"
N 3 tom Tue Apr 27 17:00 11/356 "Tools Available"

The current message is always prefixed with a greater-than symbol (>).

Each one-line entry displays the following fields:

status - Indicates the class of the message.
number - Identifies the piece of mail to the mail program.
sender - Identifies the address of the person who sent the mail.
date - Specifies the date the message was received.
size - Defines the number of lines and characters contained in the message (this includes the header).
subject- Identifies the subject of the message, if it has one.

The status can be any of the following:
N - A new message.
P - A message that will be preserved in your system mailbox.
U - An unread message. This is a message that was listed in the mailbox the last time you used the mail program, but the contents were not examined.
* - A message that was saved or written to a file or folder.

18. What is the difference between IBM system p5 570 and IBM System p570 Server models ?

IBM System p5 570 is the P5(Power5 Processor) server whereas System p
570 is the latest model from IBM containing POWER 6 Processor.

19. How to display the values of NFS tuning parameters?

# nfso -o

20. How to monitor the performance of file systems?

Use filemon command.

21. How to list the available memory slots (DIMM) in your pSeries box ?

# lscfg -vp | grep -e "Memory DIMM" -e "Size"

22. What are the login programs what do not need AIX license ?

ftp, rsh and recec.

23. Have you seen some people use rmt0.1 (or) rmt1.5 for tape device name. We know rmt0 or rmt5 is a tape drive name but whats the ".1" or ".5" that comes after the tape drive name.

Here is the logic

rmt0.x where x = A + B + C

A = density 0 = high 4 = low
B = retension 0 = no 2 = yes
C = rewind 0 = yes 1 = no

So rmt0.1 means tape drive rmt0 with no rewind.
Normally if we use rmt0 for taking backup, after the backup operaation
tape gets rewinded. IF you dont want to rewind, use rmt0.1

24. Tips on System Dump Device

a) Don't mirror the system dump device
b) Don't use compression on the dump device
c) Don't use a secondary dump device unless it is on a seperate device

25. How to monitor/obtain LVM performance?

Use lvmstat command.

26. How to monitor/obtain NFS performance statistics?

Use nfsstat command.

27. How to set the variables defined in a file to the current shell/ environment ?

Suppose you the following variable defined in file1.sh

LANG=jp_JP
TZ=CUT-5

To set them in current shell, run ". ./file1.sh"

28. How will you encode a binary file ?

uuencode command converts a binary file to ascii data. This is mainly used for sending a file thru mail.

For Ex.,
uuencode source_file output_file

29. How you decode a file (which was encoded using uuencode command) ?

# uudecode source_file

30. How to view a a compressed file without uncompressing it ?

Use "zcat file1.Z"

31. How to configure the system to send mails each time an error is added to error report

a. Create a file /tmp/mailtoroot

errnotify:
en_name = "mailtoroot"
en_persistenceflg = 1
en_method = "/usr/bin/errpt -a -l $1 | mail -s \"errpt: $9\" root"

b. odmadd /tmp/mailtoroot

c. Verify by creating a error message

# errlogger 'Test Error Message"

You can always remove this ODM entry using the below command:

# odmdelete -q 'en_name=mailtoroot' -o errnotify 


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



How to change Max length of username in aix :
On AIX 5.3 to change default length of username:

# chdev -l sys0 -a max_logname=9
sys0 changed

To check the current length of username:

# lsattr -El sys0 -a max_logname
max_logname 9 Maximum login name length at boot time True


# getconf LOGIN_NAME_MAX 21

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

How to disable first time password change in AIX :

Clear the ADMCHG flag of the user account with "pwdadm -c <user>".

Example:

# pwdadm –c username

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

How to find the number of asynchronous i/o servers running in IBM AIX :

To find the number of asynchronous i/o servers running in IBM AIX:

To determine you how many Posix AIO Servers (aios) are currently running, as root:

# pstat -a | grep -c posix_aioserver

To determine you how many Legacy AIO Servers (aios) are currently running, as root:

# pstat -a | grep -c aioserver

Example:

pstat -a | grep -c aioserver 

-->How to find the values for asynchronous i/o in IBM AIX ?

To find the values for asynchronous I/O in IBM AIX:

# lsattr -El aio0

Example:

lsattr -El aio0 

-->How to mount a cd manually in AIX ?
To manually mount a cd in IBM AIX:

# mount -V cdrfs -o ro /dev/cd0 /cdrom

Example:

mount -V cdrfs -o ro /dev/cd0 /cdrom 


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

How to mount an ISO file as a filesystem in AIX :
In AIX you "dd" the ISO file into a raw LV, then mount the LV as a filesystem.

Here are the steps for copying the ISO named "image.iso" into "/cd1iso", a JFS filesystem:

1. Create a filesystem with size slightly bigger than the size of the ISO image. Do NOT mount the filesystem:
# /usr/sbin/crfs -v jfs -g rootvg -a size=800M -m/cd1iso -Ano -pro -tno -a frag=4096 -a nbpi=4096 -a ag=8

2. Get the logical volume name associated with the new filesystem:
# lsfs | grep cd1iso (assume it is /dev/lv00)

3. dd the ISO image into rlv00 (raw lv00):
# dd if=image.iso of=/dev/rlv00 bs=10M

4. Alter /cd1iso stanza in /etc/filesystems => vfs=cdrfs and options=ro (read-only)


    /cd1iso:
            dev            = /dev/cd1_lv
            vfs             = cdrfs
            log             = /dev/loglv00
            mount           = false
            options         = ro
            account         = false


5. Mount the file system :
# mount /cd1iso

6. When finished, remove the filesystem:
# rmfs /cd1iso

Example:

/usr/sbin/crfs -v jfs -g rootvg -a size=800M ..

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

How to stop crontab writing to var/spool/mail/root file :

My crontab is writing to /var/spool/mail/root file... Is there anyway I can stop this? The crontab is running every minute and it would fill the mail pretty quickly.

Solutions:



1)

Can i see the crontab rule ?? you must of put to sent email to root
If use the crontab rule like in below example, it will not send any email


Example:
*/5 17,18 * * 1-5 /sage.sh >/dev/null 2>&1

2)

At the top of your crontab file just add:
MAILTO=""
This will disable mail sending by crond.



Recommended Solution:


Try to set that in the script itself rather than the whole crontab file
===============================================

AIX - Tips and Tricks - Part II

1. How to force a failover of an EtherChannel ?
# /usr/lib/methods/ethchan_config -f Etherchannel_Device

2. How to add a backup adapter to an existing etherchannel device ?
# /usr/lib/methods/ethchan_config -a -b Etherchannel_Device Ethernet_Adapter

3. How to change the address to ping attribute of an EtherChannel ?
# /usr/lib/methods/ethchan_config -c Etherchannel_Device netaddr New_Ping_IP_Addr

4. How to list the available major numbers in a system ?
# lvlstmajor

5. How to list the major number of a volume group ?
# lvgenmajor rootvg

6. Consider a situation where you have a VG in a PV. But you have not imported that.
Now you need to find a list of attributes of that volume group before importing/varyon it.
Answer the below questions :

a. How to list the maximum number of logical volumes allowed in the VG ?
# lqueryvg -p PVname -N

b. How to show the PP size ?
# lqueryvg -p PVname -s

c. How to show the number of free PPs in the VG ?
# lqueryvg -p PVname -F

d. How to show the current number of LVs in the VG ?
# lqueryvg -p PVname -n

e. How to list the current number of PVs in the VG ?
# lqueryvg -p PVname -c

f. How to list the total number of VGDAs for the VG ?
# lqueryvg -p PVname -D

g. How to list each LVID, LV name, state for each logical volume ?
# lqueryvg -p PVname -l

h. How to list each PVID, number of VGDAs and state for each PV in the VG ?
# lqueryvg -p PVname -P

i. How to list all the attributes with tags for the vG ?
# lqueryvg -p PVname -At

j. How to list the VGID from that physical volume ?
# lqueryvg -p PVname -v

7. How do you move a physical partition ( actually its just a data between PPs) ?
# lmigratepp -g VGID -p old_PVID -n old_PPNum -P new_PVID -N new_PPNum

8. How to retrive the VG name for a particular LV from ODM ?
# getlvodm -b LVID

9. How to retrive all configured PVs from ODM ?
# getlvodm -C

10. How to retrive the major number for a VGID from ODM ?
# getlvodm -d VGID

11. How to retrive the logical volume allocation characteristics for a LVID from ODM ?
# getlvodm -c LVID

12. How to retrive the free configured PVs from ODM ?
# getlvodm -F

13. How to retrive the strip size for a LVID from ODM ?
# getlvodm -F LVID

14. How to retrive the PV name for a PVID from ODM ?
# getlvodm -g PVID

15. How to retrive all VG names from the ODM ?
# getlvodm -h

16. How to retrive the VGID for a PVID from ODM ?
# getlvodm -j PVID

17. How to retrive the LVs and LVIDs for a VG name or VGID from ODM ?
# getlvodm -L VGDescriptor

18. How to retrive the LVID/LV Name for a LV Name or LVID from ODM ?
# getlvodm -l LVDescriptor

19. How to retrive the mount point for a LVID from ODM ?
# getlvodm -m LVID

20. How to retrive the stripe width for a LVID from ODM ?
# getlvodm -N LVID

21. How to retrive the PVID/PN name for a PV name or PVID from ODM ?
# getlvodm -p PVDesciptor

22. How to retrive the PV names, PVIDs and VGs of all configured PVs from ODM ?
# getlvodm -P

23. How to retrive the relocatable flag for a LVID from ODM ?
# getlvodm -r LVID

24. How to retrive the VG state for a VG from ODM ?
# getlvodm -s VGDescriptor

25. How to retrive the timestamp for a VG from ODM ?
# getlvodm -T VGDescriptor

26. How to retrive the VG name for a VGID from ODM ?
# getlvodm -t VGID

27. How to retrive the auto-on value for a VG name or VGID from ODM ?
# getlvodm -v VGDesciptor

28. How to retrive the VGID for a vG name ?
# getlvodm -v VGDesciptor

29. How to retrive the PV names and PVIDs for a VG from ODM ?
# getlvodm -w VGDesciptor

30. How to retrive the LV type ffor a LVID from ODM ?
# getlvodm -y LVID

31. How to retrive the concurrent capable flag for a VG from ODM ?
# getlvodm -X VGDescriptor

32. How to retrive the auto-on concurrent flag for a VG from ODM ?
# getlvodm -x VGDescriptor

33. How to display the contents of LVCB ?
# getlvcb -A LVName

34. How to list the number of copies of a LV from LVCB ?
# getlvcb -c LVName

35. How to list the file system name of a LV from LVCB ?
# getlvcb -f LVName

36. How to list the label of a LV from LVCB ?
# getlvcb -L LVName

37. How to display the type of the file system from LVCB ?
# getlvcb -t LVName

38. How to display the upper limit from LVCB ?
# getlvcb -u LVName

39. How to list the current defrag state of a file system ?
# defrag -q Filesystem

40. How to lsit the current and future (if degragmented) state of a file system ?
# degrag -r Filesystem

41. How to defragment a file system ?
# defrag Filesystem

42. How to run fsck on 2 filesystems simultaneously on different drives ?
# dfsck FileSystem1 FileSystem2

43. How to list the superblock, i-name map, disk map information for a file system ?
# dumpfs Filesystem

44. Where is the magic file located ?
/etc/magic

45. How do you remove a file system data from /etc/filesystems ?
# imfs -x -l LVName

46. How do you list inode, last update/modify/access timestamp of a file ?
# istat FileName

47. How do you update the i-node table and write buffered files to the hard disk ?
# sync

48. How do you list the filesystems in a volume group ?
# lsvgfs VGName

49. How do you redefine the set of PVs of a VG in the ODM ?
# redefinevg -d PVName VGName

50. How do you replace a PV in a VG ?
# replacepv SourcePV DestinationPV 


AIX - Tips n Tricks - Part I

1. How to configure the system and create a restricted shell user ?

Below example shows how to create a restricted shell user (this user can execute only "ls" and "vi" commands
a) Make a reduced bin directory to contain links to programs for the user or users:
# mkdir /usr/rbin
b) Link the necessary commands and programs in the reduced bin directory.
For example, give access to the ls and vi commands:
# ln -s /usr/bin/ls /usr/rbin/ls
# ln -s /usr/bin/vi /usr/rbin/vi
c) Add Rsh as a valid shell in /etc/security/login.cfg:
# vi /etc/security/login.cfg
d) Add /usr/bin/Rsh to the list of shells in the usw stanza:
usw:
shells = /bin/sh,/bin/bsh,/bin/csh,/bin/ksh,/bin/tsh,/bin/ksh93,/usr/bin/sh,
/usr/bin/bsh,/usr/bin/csh,/usr/bin/ksh,/usr/bin/tsh,/usr/bin/ksh93,/usr/sbin/
uucp/uucico,/usr/sbin/sliplogin,/usr/sbin/snapp,/usr/bin/Rsh
e) Add the restricted shell user:
# mkuser shell="/usr/bin/Rsh" alex
f) Assign an initial password:
# passwd alex
g) Change the ownership of the users profile to root:
# chown root:system /home/alex/.profile
h) Change the permissions of the users profile to 755:
# chmod 755 /home/alex/.profile
i) Edit the users profile setting the PATH and Shell variables:
# vi /home/alex/.profile
Set PATH for the new bin directory and Set SHELL to rksh:
PATH=/usr/rbin; export SHELL=/usr/bin/Rsh
---------------------------------------------------------------------------­---------------------------------
2. How to change the default welcome (herald) message on the login display ?
Edit the file /etc/security/login.cfg and update the herald parameter ...
default:
herald = "Unauthorized use of this system is prohibited\n\nlogin: "
sak_enable = false
logintimes =
logindisable = 0
logininterval = 0
loginreenable = 0
logindelay = 0
You can also use the below command to change the herald value
# chsec -f /etc/security/login.cfg -a default -herald "Unauthorized use of this system is prohibited.\n\nlogin: "
---------------------------------------------------------------------------­---------------------------------
3. How to set automatic logoff (only for terminals) ?
Edit the /etc/security/.profile file to include an automatic logoff value for all users, as in the following example:
TMOUT=600 ; TIMEOUT=600 ; export readonly TMOUT TIMEOUT
The number 600, in this example, is in seconds, which is equal to 10 minutes. However, this method only works from the shell.
---------------------------------------------------------------------------­---------------------------------
4. How to auto forward the mails ?
Create $HOME/.forward file and add adresses or aliases.
When mail is sent to a local user, the sendmail command checks for the $HOME/.forward file.
If the file exists, the message is not sent to the user. The message is sent to the addresses or aliases in the $HOME/.forward file.
---------------------------------------------------------------------------­---------------------------------

5. How to set(define) and unset a variable in a shell or shell script ?

# x=3 -> Defines a vlue for a variable 'x'
# echo $x -> Displays the vlue of 'x' vairable
3
# unset x -> Unsets the variable
# echo $x -> Again display its value
#
---------------------------------------------------------------------------­---------------------------------

6. How to send file1 as a message to user alex ?

# mail alex <>
---------------------------------------------------------------------------­---------------------------------

7. How to display mail queue ?


Note: mailq is the queue where your mails are stored

# mailq (or) sendmail -bp
There is 1 request in the mail queue
---QID---- --Size-- -----Q-Time----- ----------Sender/ Recipient-----------
OAA 19258 * 29 Mon Jun 26 14:57 root
---------------------------------------------------------------------------­---------------------------------

8. Whats sendmail command?

It receives formatted messages and routes messages to one or more users. IT can deliver messages to users on local/remote machines. It will be started by tcpip sub-system . It uses /etc/mail/sendmail.cf as config file.
Once this daemon started, you can find its process id in
/etc/sendmail.pid.

---------------------------------------------------------------------------­---------------------------------


9. How to define mail aliases for users?

a) Add the aliases to /etc/aliases.
For Example,
nobody: /dev/null
certify: user02, user5801@server3, root@server4, user5911@se
b) Rebuild the aliases database using
newaliases (or) sendmail -bi
---------------------------------------------------------------------------­---------------------------------

10. If logging with telnet takes long time (for ex. 2 mins), what might be the issue?

There might be problem with DNS resolution. Check /etc/resolv.conf and check dns connection thru nslookup command.
---------------------------------------------------------------------------­---------------------------------
11. While attempting to log in, you see the below message. How you solve this issue ?
'All available login sessions are in use.'
Check the number of AIX user license using "lslicense"
If required increase the license using "chlicense" command.
---------------------------------------------------------------------------­---------------------------------
12. Oracle DBA says that his database is not able to go beyond certain limit. For example, oracle userid is not able to start more than 500 process's. Whats the issue?
This is because of the "maxuproc" value is 500. Check the value using "lsattr -El sys0 -a maxuproc"
If required change the value using
# chdev -l sys0 -a maxuproc=1000
Normally for Oracle Production machines, you have to consult with DBA's while installing the server and set an agreed value.
---------------------------------------------------------------------------­---------------------------------
13. Errpt is not displaying any reports. Found that /var/adm/ras/ errlog file is there in the location and errdemon is running fine. What might be the issue the issue?
errlog file seems to be corrupted. Delete the file and stop the errdemon (/usr/lib/errstop).
Start the errdaemon (/usr/lib/errdemon). While starting, daemon creates the errlog file automatically.
---------------------------------------------------------------------------­---------------------------------
14. How to list IDE controllers in your system ?
# lscfg -l ide*
DEVICE LOCATION DESCRIPTION
ide0 01-00-00 ATA/IDE Controller Device
ide1 01-00-01 ATA/IDE Controller Device
The following sample display from the lscfg -l ide command shows
There are 2 IDE I/O controllers configured in the server
Controller ide0 and ide1 are located on the system planar ( Notice 1st and 2nd digits in location code)

The planar indicator is the second digit in the location value with a value of 1.

6th digit indicates the controller number.
---------------------------------------------------------------------------­---------------------------------
15. After a successful login, the login command displays the message of the day, the date and time of the last successful and unsuccessful login attempts for this user, and the total number of unsuccessful login attempts for this user since the last change of authentication information (usually a password).
How do you suppress these messages?
You can suppress these messages by creating a “.hushlogin” file in your home directory.
For Example,
At the prompt in your home directory, type the following:
# touch .hushlogin
The touch command creates the empty file named .hushlogin if it does not already exist. The next time you log in, all login messages will be suppressed. You can instruct the system to retain only the message of the day, while suppressing other login messages.
---------------------------------------------------------------------------­---------------------------------
16. Whats the files system read once you login ?
First File : /etc/environment - contains variables specifying the basic environment for all processes.
Second File: /etc/profile - controls system-wide default variables
Third File : $HOME/.profile - lets you customize your individual working environment
Fourth File: $HOME/.env - lets you customize your individual working environment variables.
---------------------------------------------------------------------------­---------------------------------
17. How to override variables defined in /etc/environment for a particular user?
A fourth file that the operating system uses at login time is the
$HOME/.env file, if your .profile contains the following line:
export ENV=$HOME/.env
The .env file lets you customize your individual working environment variables. The .env file contains the individual user environment variables that override the variables set in the /etc/environment file. You can customize your environment variables as desired by modifying your .env file.
---------------------------------------------------------------------------­---------------------------------
18. How to change the font in AIX ?
To change the font to an italic, roman, and bold face of the same size, type the following:
# chfont -n /usr/lpp/fonts/It114.snf /usr/lpp/fonts/Bld14.snf /usr/lpp/
> fonts/Rom14.snf
You can also use smitty chfont.
---------------------------------------------------------------------------­---------------------------------
19. How to run a process in the background ?
For Ex, to run script1.sh in background run
# script1.sh &
But this script process gets killed if you close the terminal
So always practice to run using nohup,
# nohup script1.sh &
Usage of nohup doesn't kill the process if you close the telnet session. Output from the process/script will be stored in a file called nohup.out in the directory from where you started the process.
This will help you in case if you want to start backup using mksysb and close your terminal/ leaving office, you can safely use "nohup command &". Next day morning, you can view the contents of nohup.out to know the status of the backup job.
---------------------------------------------------------------------------­---------------------------------
20. What is the default priority for a process?
Default priority is 0. Priority numbers is in the range of -20 to 20. Highest number is the lowest priority and lowest number has high priority while using resources.
To set the priority while start a process, use nice command.
If the process is already running, you can use "renice" command to change its priority.
---------------------------------------------------------------------------­---------------------------------
21. How to stop, resume and to make it foreground process?
To stop(pause) a foreground process, use
Cntrol + Z keys ie., Ctrl+Z.
Note: Ctrl+Z works in the Korn shell (ksh) and C shell (csh), but not in the Bourne shell (bsh).
To restart a stopped process, you must either be the user who started the process or have root user authority.
To restart a stopped process, enter
# kill -19 pid
To run it in foreground, enter
# fg pid

where pid is the process id which can be obtained from the following command

ps -ef | grep precess_name | awk '{print $2}'
---------------------------------------------------------------------------­---------------------------------
22. How to display a program output as well as copying to a file ?
Normally usage of output redirection suppresses the output on screen.

Ex. ls -l > file1

If we want to redirect the output as well as show the output in screen use the tee command.
Ex: ls -l | tee -a file1
---------------------------------------------------------------------------­---------------------------------
23..How to capture your terminal screen to a file ?
To capture the screen of a terminal, at the prompt, type the following:
#script
The system displays information similar to the following:
Script command is started. The file is typescript.
Everything displayed on the screen is now copied to the "typescript" file.
To stop the script command, press Ctrl-D or type exit and press Enter.
The system displays information similar to the following:
^D
Script command is complete. The file is typescript.
Use the cat command to display the contents of your file.
---------------------------------------------------------------------------­---------------------------------
24. What are the supported file systems in AIX ?
a) JFS (or) JFS2 - Disk based file system
b) NFS - Network based File system
c) CDRFS - CDROM based file system
d) UDFS - DVD-ROM based file system
e) RAMFS - RAM based file system used while booting the system
---------------------------------------------------------------------------­---------------------------------

25. What are the different directory abbreviations?

Abbreviation Meaning
. The current working directory
.. The parent of the current working directory
~ Your home directory
$HOME Your home directory
---------------------------------------------------------------------------­---------------------------------
26. What are the different directory path names ?
Absolute path name:
Traces the path from the /(root) directory. Absolute path names always
begin with the slash (/) symbol.
Ex. /home/ raja/dir1

Relative path name:

Traces the path from the current directory through its parent or its
subdirectories and files. As user "raja", I can say ./dir1 since I'm already in /home/raja
---------------------------------------------------------------------------­---------------------------------
27. How to move a directory ?
# mvdir book manual
This moves the book directory under the directory named manual, if the
manual directory exists. Otherwise, the book directory is renamed to manual.
---------------------------------------------------------------------------­---------------------------------
28. What the RAID groups AIX LVM supports?
RAID-0 - Striping
RAID-1 - Mirroring
RAID-10 (or) RAID 0+1 - Mirroring and striping
---------------------------------------------------------------------------­---------------------------------
29. How to read and remove mails from my system mailbox?
At your system command line prompt, enter the mail command:
# mail
If there is no mail in your system mailbox, the system responds with a message:

No mail for YourID

If there is mail in your mailbox, the system displays a listing of the messages in your system mailbox:
# mail
Here Type ? for help.

"/usr/mail/lance": 3 messages 3 new

>N 1 karen Tue Apr 27 16:10 12/321 "Dept Meeting"
N 2 lois Tue Apr 27 16:50 10/350 "System News"
N 3 tom Tue Apr 27 17:00 11/356 "Tools Available"
The current message is always prefixed with a greater-than symbol (>).
Each one-line entry displays the following fields:
status - Indicates the class of the message.
number - Identifies the piece of mail to the mail program.
sender - Identifies the address of the person who sent the mail.
date - Specifies the date the message was received.
size - Defines the number of lines and characters contained in the
message (this includes the header).
subject - Identifies the subject of the message, if it has one.
The status can be any of the following:
N - A new message.
P - A message that will be preserved in
---------------------------------------------------------------------------­---------------------------------
30. After logging as an application user (oradba), when I issued "crontab -l" system throwed the below error
0481-103 Cannot open a file in the /var/spool/cron/crontabs directory.
What is the solution?
Here is the solution
a) Create an empty file /var/spool/cron/crontabs/oradba
b) Change the ownership of the file to root.cron
c) Login as oradba and issue "crontab -l" to verify the cron.
---------------------------------------------------------------------------­---------------------------------
31. How to identify the program listening in the given port ?
METHOD I: # lsof –P –n –i :505 (for port 505)
METHOD II:
# netstat -Aan|grep 9404
f100060006952b98 tcp 0 0 *.9404 *.* LIST
EN
f100060006a90b98 tcp 0 0 *.19404 *.* LIST
EN
# rmsock f100060006952b98 tcpcb
The socket 0x6952808 is being held by proccess 753870 (java).
---------------------------------------------------------------------------­---------------------------------
32. How to display non-printable characters in a text file ?
Lets create a file with non-printable characters.
# vi filename.txt
$
$
$
$
this is a test$
I^I$
~
: set list
Now we will list the file so that non-printable chars are viewed
# cat -vet filename.txt
^I^I^I^I$
$
$
$
this is a test$
^I^I^I^I$
# od -c filename.txt
0000000 \t \t \t \t \n \n \n \n t h i s i s
0000020 a t e s t \n \t \t \t \t \n
0000034
---------------------------------------------------------------------------­---------------------------------
33. How to display specific lines in a text files ?
For illustration purposes, I'm using the cat -n filename to show the line numbers in this script.
# cat -n filename
...
8 for i in $*
9
10 do
11
12 typeset -i16 hex
13 hex=$i
14 print $i equals $hex in hexadecimal
15
16 typeset -i8 oct
17 oct=$i
18 print $i equals $oct in octal
19
20 typeset -i2 bin
21 bin=$i
22 print $i equals $bin in binary
23
24 print
25 done
...
Prints out the for loop without displaying the line numbers
# sed -n 8,25p filename | tee for_loop
---------------------------------------------------------------------------­---------------------------------
34. How to recover the root password in AIX ?
If you forgotten the root password, we can easily recover it but the system requires 2 recycles.
Here is the way I follow
Password recovery is one of the simplest troubleshooting procedure in
AIX. Once you boot from CD, you see a menu with 3 menu items.
In that select the 3rd item
ie., "Start Maintenance Mode for System Recovery" à
"Access a Root Volume Group" ->
"Access this volume group and start a shell".
This will open a shell prompt. The just use "passwd" command for
setting a new password for root.
Thats it. root password has been changed.
Now you can reboot the machine from rootvg hard disk (normally it should be hdisk0)
---------------------------------------------------------------------------­---------------------------------
34. How to find out the (real) memory usage ?
# svmon -G
size inuse free pin virtual
memory 2097152 2097026 126 195637 1237158
pg space 524288 61023
work pers clnt lpage
pin 195404 233 0 0
in use 1189840 906786 400 0
The size and inuse columns of the memory and pgspace output represent real memory and paging space usage respectively.
The size is measured as the number of 4K pages.
Here in this case used memory is
= ((2097026 x 4)/1024)/1024 GB of used memory
---------------------------------------------------------------------------­---------------------------------
35. Here are some of the errors you get when paging space is low.
INIT: Paging space is low!
ksh: cannot fork no swap space
Not enough memory
Fork function failed
fork () system call failed
Unable to fork, too many processes
Fork failure - not enough memory available
Fork function not allowed. Not enough memory available.
---------------------------------------------------------------------------­---------------------------------
36. How is the default paging space size determined ?
It follows the following standard

    * Set paging space to 2 times the amount of RAM

    * Paging space can use no more than 20% of total disk space in the root volume Group
    * Paging space can be no larger than 2 GB