Friday, 24 July 2015

AIX - Tips and Tricks - Part IV

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

No comments:

Post a Comment