Tanti Technology

My photo
Bangalore, karnataka, India
Multi-platform UNIX systems consultant and administrator in mutualized and virtualized environments I have 4.5+ years experience in AIX system Administration field. This site will be helpful for system administrator in their day to day activities.Your comments on posts are welcome.This blog is all about IBM AIX Unix flavour. This blog will be used by System admins who will be using AIX in their work life. It can also be used for those newbies who want to get certifications in AIX Administration. This blog will be updated frequently to help the system admins and other new learners. DISCLAIMER: Please note that blog owner takes no responsibility of any kind for any type of data loss or damage by trying any of the command/method mentioned in this blog. You may use the commands/method/scripts on your own responsibility. If you find something useful, a comment would be appreciated to let other viewers also know that the solution/method work(ed) for you.

Tuesday, 25 February 2014

SOURCE CODE CONTROL SYSTEM (SCCS)


SCCS Overview
The source code control system allows versions of a program to be stored in a special file, so that any version may be retrieved. There are a few commands involved (not all of them listed here). All source code files start with 's.'
get -r
- get a program out of source code to read only. Missing out the -r flag gets the most recent version. e.g.
$ get $SCUK/s.parser.c # extracts file parser.c from source code file $SCUK/s.parser.c as read only. See get -e for editing.
get -e 
- get a piece of code out for edit, so that the code may be modified and a new version created using 'delta'. e.g.
$ get -e $SCUK/s.parser.c # extracts file parser.c from source code file $SCUK/s.parser.c for editing. See get for read-only.
delta 
- you must be in the directory with the modified piece of code when you execute this command. This adds the latest version to the source code file. e.g.
$ delta $SCUK/s.parser.c # writes file parser.c to the source code file $SCUK/s.parser.c . See get -e for information on how to extract the file from source code.
prs 
- show comments/details on source code file.
admin -r -i
- create a new source code file with progam. -r specifies the initial revision of the program and may be missed out (default is 1.1 I think). Must be spaced correctly! admin is also used for sccs administration, but it gets to fear and loathing time pretty fast. e.g.
admin -iparser.c $SCUK/s.parser.c # creates a new source code file called $SCUK/s.parser.c from the file parser.c
unget 
- cancels a get -e

SCREEN COMMUNICATION



echo
- a command mainly used in shell scripts. Examples:
$ echo "Hello" # will print Hello on your screen
$ echo "Hello" > /dev/tty616 # will print Hello on someone elses screen (warning - can crash their screen!)
$ echo $DESTF10 # will print the value of the environment variable DESTF10
$ echo "\033Fdemo demo" # will echo demo to the status bar at the top of a wyse terminal
See also file shellscripts
read
- will read text from standard input and place it in the variable name specified. See file shellscripts
line
- waits until the user presses return before carrying on (writes what is typed to standard output). If used in a crontab/at job this instruction is ignored. See file shellscripts
talk 
- set up an interactive communication dialogue box between two users. Looks good but isn't really that useful.
write 
- writes a message to someone elses screen. Try typing 'write root' and then type a message, finishing with control-D.
banner 
- writes in huge letters across your screen! (max: 10 chars per word)
wall 
- send a message to all people on a system. Can only be executed by root (I think).
tput 
- tty type independent attribute setting (requires TERM variable and TERMCAP to be set). I only know these few bits:
  • tput cnorm - turns the screen cursor on
  • tput civis - turns the screen cursor off
  • tput clear - clears the screen
  • tput smso - turns all new text to bold
  • tput rmso - turns all bold text off
tee (-a)
- command used in pipes to take a copy of the standard output. e.g.
ls | tee /tmp/x # would output ls normally and put a copy in /tmp/x. The option '-a' is used to append rather than replace files.

TAPES AND DISKS


Please see this page for more information on disks in AIX

dd if= of= bs= conv=sync
- direct (and I mean DIRECT) copy, normally to tape. Archaic syntax and very rarely used. flags:
  • if - input filename or device
  • of - output filename
  • bs - block size
  • conv - ??
e.g. To write a file to tape use
$ dd if=/etc/hosts of=/dev/rmt0 bs=1024 conv=sync # write hosts file to tape using dd
cpio
stands for copy in-out, and is extremely powerful if you can cope with the innumerable flags that you have to use(!)
$ cpio -iBcvumd "etc/hosts"
 # Grab /etc/hosts file from tape
find /etc -print | cpio -oBcv >/dev/rmt0 # Write the contents of the /etc directory to tape
find /etc -print | cpio -pdumv /usr2/etcbackup/ # copy directory /etc to /usr2/etcbackup and retain all permissions.
meaning of the flags:
  • i - input
  • o - output
  • B - Block size of 5120 bytes
  • c - read/write header info
  • v - list file names
  • u - unconditional copy - overwrites existing file.
  • m - keep modification dates
  • d - creates directories as needed.
  • t - generate listing of what is on the tape.
  • p - preserve permissions.
tapeutil -f
- A program which came with the tape library to control it's working. Called without arguments gives a menu. Is useful for doing things like moving tapes from the slot to the drive. e.g.
$ tapeutil -f /dev/smc0 move -s 10 -d 23 # which moves the tape in slot 10 to the drive (obviously, this will depend on your own individual tape library, may I suggest the manual?).
doswrite -a
- copy unixfile to rs6000's floppy disk drive in DOS format. -a option expands certain characters, for certain ascii conversions.
dosdir 
- show list of files on a dos floppy disk. Useful with option -l (long format). Like dos command 'dir'
dosread -a
- copy dos file in floppy disk drive to unix - if UNIXFILE is omitted, it outputs to the screen.
dosdel 
- delete dos file on floppy disk.
dosformat
- format dos floppy disk (High Density)
tar
- Read/Write stuff to archive.
tar cvf /dev/rmt0  # will write files to tape
tar xvf /dev/rmt0 will read files from tape
tar tvf /dev/rmt0 will give a listing of what's on the tape. If you're using an archive file then replace /dev/rmt0 in the examples above with the name of the archive file.

CONNECTIVITY



exit
- end current shell process. If you log in, then type this command, it will return you to login. ^D (control-D) and logout (in some shells) does the same.
rlogin
- login to a remote machine, e.g.
$ rlogin hollandrs # log in to machine called hollandrs
Useful with -l option to specify username - e.g.
$ rlogin cityrs -l ismsdev # log in to machine cityrs as user ismsdev For further info about trust network see .rhosts file and /etc/resolv.conf (I think).
telnet
- very similar to rlogin except that it is more flexible (just type telnet with no arguments and then '?' to see the options). Useful because you can specify a telnet to a different port.
ftp
- File Transfer Protocol - a quick and easy method for transferring files between machines. The .netrc file in your $HOME directory holds initial commands. type ftp without arguments and then '?' to see options)
rcp
- Remote copy. Copies a file from one unix box to another, as long as they trust each other (see .rhosts file or /etc/resolv.conf I think). Options
  • -f (to force the copy to occur)
  • -r (to recursively copy a directory)
  • -p (to attempt to preserve permissions when copying)
su -
- switch user, option '-' means that the users .profile is run, without option you merely assume the id and permissions of the user, without (for example) changing PATH and DBPATH, e.g.
$ su - root # become root
$ su root # gain permissions of root but don't change the current environment variables
$ su - vlink # switch to user vlink
If you are root, you may su to any other user without being prompted for a password. su without arguments is the same as 'su root'. Note that the 'su' option is not available on all UNIX machines as it can crash some of them.
ping 
- check that is alive and well (do not expect an immediate response from a machine that is linked over an ISDN line). Firewalls often block ping packets after the Ping of Death so quite often you'll find you can't ping internet sites either. Options include:
  • -q ping quietly
  • -i wait no of seconds between each packet sending. The default is 1 second. If you are using ping to keep an ISDN line up then using something like $ ping -i 5 -q hollandrs is ideal.
  • -f Never use this! Sends as many packets as it possibly can as fast as possible, used for network debugging and is likely to slow networks horribly when used. Known as 'flood' pinging.
  • -c send no of packets before giving up
To check that your machine can ping, try pinging 127.0.0.1 - this acts as a feedback loop, checking the network card's ability to ping.
rsh 
- remote shell - e.g.
$ rsh altos more /tmp/chk # will run the command more the file /tmp/chk on the machine called altos. Useful in pipes for example. rsh on its own will execute a login. Use option '-l' to specify logon name. You can also use rcmd and remsh on other flavours of unix.
host 
- lookup the ip address in the /etc/hosts file and give its name

SYSTEM COMMANDS



kill -
- sends a signal (normally a kill) to a process. kill -9 terminates the job no questions asked, kill -15 tries to clear up as much as possible - e.g. remove semaphores and such-like. Other signals may be sent as well, see manual and /usr/include/sys/signal.h to see what signals you can send to a process.
renice 
- make a process not hog the system so much by setting its nice value.
smit
- system admin program for AIX
df
- list volume groups + usage. see also lsvg. Usually used with the -k flag so the number of blocks is displayed in 1024-blocks.
cu -l
- log on to device such as a pad or a modem. See related files /etc/uucp/* and /etc/locks and /etc/services
stty sane
- Changes terminal settings back to normal. If a tetra module for example crashes your screen so that no keys function except ^C which doesn't even do very much then typing ^Jstty sane^J should cure the problem. To fully cure the problem you also need to type stty tab3 (and stty -ixon if you're feeling a little overzealous)
stty
- allows you to change terminal settings such as the interrupt key, quit key, etc. e.g.
$ stty intr ^A # would change the interrupt key to being control-A
$ stty quit ^L #would set the quit key (normally ^\) to control-L. other key changes are:
  • erase (normally ^H)
  • xon (normally ^Q)
  • xoff (normally ^S)
  • eof (normally ^D)
To really annoy a systems administrator, change interrupt to 't' and quit to '^D' . hehehehehehe
lscfg
- show all connected devices
lsvg
- list volume groups (see related file diskhelp)
lspv
- list physical disks (and see related file diskhelp)
lspv without arguments will produce a list of all the hard-disks used. lspv  will produce a list of information about the hard disk. lspv -l  will show any logical volumes which are mapped on to that drive.
lsdev
- list devices. Options:
  • -C list Configured devices
  • -P list Possible devices
produces different output when you are root.
mkdev
- make devices. e.g. To make a tty:
# Script to add a tty. Options that need amending are:
# -l name of tty to be created - e.g '-l tty600' wil create
# a tty called 'tty600'
# -p RAN name
# -w Port number on RAN
# -a Attributes (e.g. to set up auto login, etc.)
mkdev -c tty -t 'tty' -s 'rs232' -l tty433 -p sa2 -w 2 -a term='wyse50' -a forcedcd='enable' -a login='enable' -a speed='19200'
e.g. To create a printer (raw device):
mkdev -c printer -t 'osp' -s 'rs232' -p 'sa3' -w '10' -l label2 -a xon='yes' -a dtr='no' -a col=500
It is highly recommended that you make and change devices using smit
chdev
- change devices. See mkdev
cc
- c compiler, use with
  • -o to specify a target instead of a.out
  • -O optimise
  • -w or -W all warning flags.
shutdown
- shutdown the system so that it may be switched off. Rather obviously, this may only be run by root. Options:
  • -f shuts the system down immediately (rather than waiting for a minute)
  • -R reboot the system immediately after halt
oslevel
- show the current revision of the operating system.

GENERAL INFORMATION COMMANDS


smon
- monitor's system usage - F5 shows processes which are hogging the machine. Not available on AIX 4.1 and above sadly.
uptime
- shows how long the system has been up and how hard it is being hammered. The load average fields show how many jobs on average are waiting. <1 5="" around="" bad="" good="" is="" less="" not="" or="" pretty="" though="" unusual="" very="">10 the machine is being seriously hammered.
who
- list users who are currently logged on (useful with option 'am i' - i.e. 'who am i' or 'whoami')
w
- list users and what they are doing, including idle time. The first line is the output from uptime
id
- similar to whoami except that it does a direct check to see who you are - who only checks /etc/utmp so any su commands will be ignored.
ps
- list processes currently running, by default on the current shell. Useful with options:
  • -t - show all processes running on a terminal
  • -ef - show all processes
  • -u - show all processes owned by a user
  • -flp - show as much information as you can about a process number
  • -aux - show processes in order of usage of the processors. Useful to see what processes are hogging system resources.
fuser -u
- show who is using a file.(system hogging command). Useful when trying to work out who has locked a row or table in an informix database for example.
lpstat -p
- show the current status of a printer and any jobs in the queue. lpstat without arguments prints all of them.
enable 
- enable a printer queue. You must be root or a member of the printq group to run this command.
disable 
- disable a printer queue. You must be root or a member of the printq group to run this command.
enq 
- examine spool queue for printers.
uname -a
- will show you what machine you're currently on.
ipcs
- list semaphores and shared memory.
ipcrm -s
- remove semaphore or shared memory.
crontab
- use -l to list all regular scheduled jobs. To alter them, use option -e
at 
- perform a job at a specified time. (Useful for running something at a later date). at retains the current environment. e.g.
$ at now + 5 minutes
echo "Phone Julie McNally" > /dev/tty616
^D
job compjmd.389748732 will be run at ???
Will echo to tty616 the message "Phone Julie McNally" in 5 minutes. e.g.2
$ at 0331235930
echo "April fools day!" > /dev/console
^D
will echo "April fools day!" to the console at 11:59 and 30 seconds, on the 31st of march. Format for this is: [YYYY]MMDDhhmmss. at jobs are sometimes used in the place of crontab's because if the machine is off when the crontab is meant to take place, the job never happens. at jobs automatically start when the machine is switched on if the machine was down at the time. typing at -l will show you all the at jobs you have queued, at -r  will remove an at job (only the owner or root is allowed to do this).
date
- show current date and time. This command may also be used to set the system clock (ONLY WHEN EVERYONE IS LOGGED OFF) with a root user id. A date change is never simple, even when adjusting things by an hour. The safest way to do it is to change the date then reboot the machine because otherwise the crontab daemon may start doing jobs at odd times. I believe there might be a 'go slow/fast' option to set the clock, and the clock will then run 'slower/quicker' until it catches up with the required time.
last 
- shows a list of recent logins. It looks at /var/adm/wtmp so it only shows initial logins, and not whether those users have been su'd to.
fileplace -pv
- show the physical (as in disk location) location of a file. Useful for tracing informix files, and perhaps for working out whether defragmentation copying is required.

EXTREMELY USEFUL COMMANDS



ls -l
- lists files in a directory in long format. You cannot do without this. Here's a more detailed explanation. e.g.
$ ls -l
Part 1Part 2Part 3Part 4Part 5Part 6Part 7
-rw-rw-rw-1rootstaff28Jan 16 09:52README
-rw-------1compjmdstaff4304Jun 24 12:21tabledict
drwxrwxrwx2compjmdstaff512Jul 1 16:30testdir
-rwxrwx---1compjmdsystem0Jul 1 16:30a.out

... is a sample listing.

  • Part 1: Permissions - see chmod for explanation of these. If the first field is set, then the file in question is not really a file at all, but something else, key:
    • -: normal file
    • d: directory
    • l: symbolic link created by 'ln'
    • c or b: device of some sort
    You may sometimes see an 's' where the 'x' should be in the permissions - this is normally on executable files which change other files. e.g. Permissions of 'sqlexec' the file that executes all informix queries should be '-rwsr-sr-x' - this then accesses tables with permissions of '-rw-rw----'. where the table files are owned by informix (group informix). the 's' flags allows changing of the database tables on a program level, but not on a unix level. (can change contents via sqlexec but not use 'rm' command on db file).
  • Part 2: Number of links to this file (directories always have 2+).
  • Part 3: The owner of the file - e.g. If the owner is 'compjmd' and permissions are set to -rw------- then only the user 'compjmd' may read or write to that file. Again, if owner is "compjmd" and permissions are -r-x------ then only the user compjmd may read or execute that file. Only the owner of a file or root may chmod it.
  • Part 4: The group ownership of the file - (bloody hell, this is getting complicated). On a unix system there are certain 'groups' which users can belong to, held in the file '/etc/group'. You will notice that in this file there will be a main group, e.g. 'staff' which contains every user. Which means that any user listed under staff is in that group.....right...every file has a group attached to it. Which means that if a file had permissions ----rw---- and a group reference of 'system', then only users who were part of the group system could modify that file. To see which groups the current user belongs to do id. Sorry if this wasn't comprehensible but you should never need to use this anyway(!).
  • Part 5: Size of the file in bytes
  • Part 6: Time of last modification
  • Part 7: The name of the file
Useful options (and there are loads more). All may be combined except where specified:
  • ls -a show files starting with '.' too
  • ls -A show files starting with '.' but not '.' or '..'
  • ls -c must be used with either option l and/or t - displays/sorts by modification time
  • ls -d do not show subdirectory listings
  • ls -i display the i-node number of each file
  • ls -t Put the listing in time order (see options u and c)
  • ls -r Put the listing in reverse order - usually used with a -t
  • ls -u must be used with either options l and/or t - displays/sorts by last-access time
vi 
- love it or loathe it - the standard operating system text-file editor. See Related help file. Vi You can also use 'view' which forces Read only (-R opt). vi + enters the file at the specified line no. Also, vi +/ will enter the file and move to the first occurrence of . e.g.
$ vi +/"love it or loathe it" handycommands
Users new to vi hate it. I personally managed to get through University without using it ever (I used Joe's own editor instead). If I accidentally went into vi, I had to ^Z and kill the job. Sigh. Five years of using vi means that I'm getting a little better at it now... (I'm actually typing this now in a vi-clone for Windows).
grep 
- a phenomenally useful command which matches strings within files - e.g.
$ grep D7523 mcall_reps.out # will find all the lines in mcall_reps.out that have the string "D7523" in it. Also incredibly useful for things like pipes,e.g.
du | grep cred # (in /home directory will show all users that have 'cred' in their title). You may use regular expression matching - e.g.
$ grep "main.*{" x.c # would match any line containing 'main' and an open curly brackets at any point in the line afterwards. There are two variations to grep - fgrep and egrep which do virtually the same things as grep, but are either faster (having less options) or more complex (but slower). See also section on Wildcards
Options:
  • -v : show all lines that do not contain pattern.
  • -y : don't bother matching case
  • -i : don't bother matching case
  • -c : show count of matching lines rather than the lines themselves
  • -l : show filename's instead of matching lines.
ksh -o vi
- The Korn Shell - pros might notice that I don't mention using the C-Shell at all - I've never used it, so that's why it doesn't appear. A Shell is a program that you run your commands in. Typing exit will end the current shell. The -o vi option of the korn shell allows vi commands to work at the shell prompt after pressing escape. For example, pressing escape and then 'k' will bring up the last command used in the shell.
awk
- this would be a damn useful command if I knew how to use it properly. see alternative page awkhelp
man 
- look at the manual, e.g.
$ man ps # will list the manual page for the command ps

OTHER FILE HANDLING COMMANDS



type 
- show where the source of a command is: e.g.
$ type sendmail
sendmail is /usr/sbin/sendmail

This command is merely an alias for 'whence -v'
whence 
- show where the source of a command is: shell builtin command. See type
Use option: -v for verbose mode
which 
- show where the source of a command is held. Almost the same as type and whence
chmod 
- change file permissions. e.g.
$ chmod 666 handycommands
changes the permissions (seen by ls -l) of the file handycommands to -rw-rw-rw-
r = 4, w = 2, x = 1. In the above example if we wanted read and write permission for a particular file then we would use r + w = 6. If we then wanted to have the file have read-write permissions for User, Group and All, then we would have permissions of 666. Therefore the command to change is that above.
$ chmod 711 a.out
Changes permissions to: -rwx--x--x
Additional explanation of file permissions and user/group/all meaning are given in the description of ls -l
You may specify chmod differently - by expressing it in terms of + and - variables. For example
$ chmod u+s /usr/bin/su
will modify the "sticky bit" on su, which allows it to gain the same access on the file as the owner of it. What it means is "add s permission to user". So a file that started off with permissions of "-rwxr-xr-x" will change to "rwsr-xr-x" when the above command is executed. You may use "u" for owner permissions, "g" for group permissions and "a" for all.
chown 
- Change ownership of a file. Must be done as root. e.g.
chown informix *.dat # change all files ending .dat to be owned by informix
chgrp 
- Change group ownership of a file. Must be done as root. e.g.
chgrp sys /.netrc # change file /.netrc to be owned by the group sys
mvdir 
- move a directory - can only be done within a volume group. To move a directory between volume groups you need to use mv -r
or find -print | cpio -pdumv rm -r
cpdir 
- copy a directory. See mvdir
rmdir 
- this is crap - use rm -r instead
mkdir 
- Creates a directory. e.g.
$ mkdir /tmp/jon/ # create directory called /tmp/jon/ 
find  -name "searchkey" -print
- search for files - e.g.
$ find . -name "system.log" -print # will find all files (with full path names) called system.log - Wildcards are allowed, e.g.
$ find /tmp -name "sl.*" -atime +0 -print # will print out all files in /tmp/ that start sl. and which haven't been accessed for a day. Helpful for finding lost files, or finding stuff in enormous directories. Other useful options include:
  • -atime + - finds files that haven't been accessed for 1+days also, ctime (creation time) and mtime (modify time)
  • -prune - stay in current directory - don't look in dirs off the directory specified in path names - e.g.
    $ find /tmp -user "compgnc" -prune -print # will find all files in /tmp which user compgnc owns and will not search lower directories (e.g. /tmp/usr)
  • -size + - finds files that are bigger than
  • -exec rm {} \; - remove all files found...dangerous command - e.g.
    $ find /tmp -name "sl.*" -atime +0 -prune -print -exec rm {} \; # will remove all files in /tmp starting 'sl.' that haven't been accessed for a day. Spacing of this command is important! Most exec commands are possible:
    $ find /usr2/calltest -name "*.4gl" -print -exec grep "CHECK" {} \; | pg
  • -ok - like exec only it prompts for confirmation after each occurence. e.g.
    $ find /tmp/disk7 -name "*" -print -ok doswrite -a {} {} \; # Please note that you MUST end any exec or ok option with an escaped semicolon (\;).
  • -user - finds all files owned by
  • -group - finds all files with a group of
ln -s
- create a symbolic link to a different directory from current directory: e.g.
$ ln -s /usr/uniplex/compgnc /u/compgnc/uni # would create a link called 'uni' in the directory /u/compgnc. From then on, typing cd uni would cd to /usr/uniplex/compgnc. You can also give two files the same name. e.g.
$ ln make.e_enquiry makefile # would link the two files so that they are identical, and when you change one, you change the other. You may also create a symbolic link to a host(!). Instead of typing 'rlogin hpserver' every time, by typing
$ ln -s /usr/bin/rsh hpserver # will create a link so that whenever you type 'hpserver' it will execute a remote shell on the machine.
Option -f forces the link to occur
head -
- prints out the first few line of a file to screen. Specify number to indicate how many lines (default is 10). e.g. If you sent something to a labels printer and it wasn't lined up, then you could print the first few labels again using:
$ head -45 label1.out | lp -dlocal1
tail -
- prints out the end of a file. Very similar to head but with a very useful option '-f' which allows you to follow the end of a file as it is being created.e.g.
$ tail -f vlink.log # follow end of vlink.log file as it is created.
wc -
- Word Count (wc) program. Counts the number of chars, words, and lines in a file or in a pipe. Options:
  • -l (lines)
  • -c (chars)
  • -w (words)
To find out how many files there are in a directory do ls | wc -l
split -
- Splits a file into several files.e.g.
$ split -5000 CALLS1 # will split file CALLS1 into smaller files of 5000 lines each called xaa, xab, xac, etc.
tr 
- translates characters. e.g.
cat handycommands | tr "\t" " " # will take the file handycommands and translate all tabs into spaces. Useful when messing about with awk or you need to convert some input (e.g. that from tty) to a unique filename that does not contain special characters. e.g.
tty | tr "/" "." # produces for example .dev.pts.7
od 
- od converts nasty (binary save) files into character representations. Useful when back-compiling, examining raw .dat files,etc. Use with option '-c' for character display (recommended).
script
- starts recording everything in the shell to a file by default 'typescript'. Press ^D to finish the script. Provides a log of everything used. Has almost the same effect as ksh | tee typescript
Used for debugging shells, seeing error messages which flash off the screen too quickly, etc.
cut
- cut's the file or pipe into various fields. e.g.
$ cut -d "|" -f1,2,3 active.unl # will take the file active.unl which is delimited by pipe symbols and print the first 3 fields options:
  • -d
  • -f
Not too useful as you can't specify the delimiter as merely white space (defaults to tab) Alternatively, you can 'cut' up files by character positioning (useful with a fixed width file). e.g.
$ cut -c8-28 "barcode.txt" # would cut columns 8 to 28 out of the barcode.txt file.
paste
- paste will join two files together horizontally rather than just tacking one on to the end of the other. e.g. If you had one file with two lines:
Name:
Employee Number:
and another file with the lines:
Fred Bloggs
E666
then by doing:
$ paste file1 file2 > file3 # this would then produce (in file3).
Name: Fred Bloggs
Employee Number: E666
Note that paste puts horizontal tabs between the files, so you may need a sed 's/   //g' command to get rid of these.
sort 
- sorts the information from the file and displays the result on standard output (stdout). e.g.
$ sort /tmp/list_of_names # will sort the file into alphabetical order, and display it to the screen. Useful with option '-u' to filter out duplicates.
uniq 
- filters out all duplicate lines from a file or input stream (file or stream must be sorted!). Useful with option -c which merely produces a count of unique lines.
ex 
- ex is an old line editor, and almost never used now (similar to DOS edlin if you remember that - me, I've repressed it). You are most likely to come across ex within the vi editor - all commands beginning with a colon (:) are ex commands

INPUTS, OUTPUTS AND WILDCARDS



Unix commands generally get their information from the screen, and output to it. There are three main 'streams' which unix uses to get/place it's information on. These streams are called:
  • stdin (Standard Input) - normally, what you type into the screen
  • stdout (Standard Output) - normally, what is output to the screen
  • stderr (Standard Error) - normally, error messages which go to the screen

any of these may be redirected by the following symbols:
  • <  take input from rather than the screen. e.g.
    $ ksh < x # will read all commands from the file x and execute them using the Korn shell.
  • >  take output from the command and place it in . e.g.
    $ ls > x will place the output of the command 'ls' in the file x
  • >>  take output from the command and append it to . e.g.
    $ ls /tmp >> x will place the output of the command 'ls' and append it to the file x
  • 2>  take any error messages from the command and put it in . e.g.
    $ ls /tmp 2>/dev/null would throw away any error messages that are produced by ls (sorry, /dev/null is a file that, if written to, the information disappears never to be seen again).
  • command1 | command2 Pipe - Takes the standard output of the first command, and turns it into the standard input of the second command. The output of the second command will then be put on the standard output (which, again, may be a pipe) e.g.
    $ ls | more will send the output of 'ls' into the command 'more', thus producing a directory listing which stops after every page. This method is called piping.

command1 & - the ampersand (&) forces command1 to run in the background. so that you may continue to type other commands in the shell, while command1 executes. It is not advisable to run a command in the background if it outputs to the screen, or takes it's input from the screen

See also tee which allows splitting of the input stream and output to several different places at once.

Wildcards

B Bib Baby Fox Fib

There are various wildcards which you may use. One is '*' which means 0 or more characters. e.g. 'B*' will match 'B,Bib and Baby' from the list above, another wildcard is '?' which matches 1 character, e.g. '?ib' will match 'Bib and Fib'. Wildcards differ depending on the program in use: awk derivatives (awk,sed,grep,ex,vi,expr and others) have the following special characters:
  • ^ beginning of the line
  • $ end of the line
  • . any character
  • * one or more of the preceding character
  • .* any number of characters
  • \n Carriage return
  • \t Tab character
  • \ Treat as is (so, \$ would try to match a '$')
Given the following four lines:

Chargeable calls in bundle: $47.50
Chargeable calls out of bundle: $20.50
Other bundle charges: $0.00
Total Charge: $20.50

$ grep "^Charg.*bundle.*\$.*"
would match the first two lines.
In english - match all lines which start with 'Charg', then have any number of characters and then the word 'bundle', then have any number of characters, and then a dollar symbol, and then have any number of characters following to the end of the line

BASIC FILE HANDLING




ls
- list files in directory; use with options
  • -l (long format)
  • -a (list . files too)
  • -r (reverse order)
  • -t (newest appears first)
  • -d (do not go beyond current directory)
  • -i (show inodes)
pg
- used to control input by pages - like the dos /p argument. pg performs the same function as the more command but has different control, as it is based on ex
Helpful keys for pg:
  • 1 (go to top)
  • $ (go to bottom)
  • h (help)
  • / (Search)
  • ? (Search back)
  • q (quit)
  • -1 (back a page)
pwd
- show present working directory. e.g.
$ pwd
/usr/live/data/epx/vss2

To change the current working directory use cd
cd
- change directory (without arguments, this is the same as $ cd $HOME or $ cd ~)
cp
- copies a file from one location to another. e.g.
$ cp /etc/hosts /etc/hosts.backup # make a backup of the hosts file
$ cp /etc/motd /tmp/jon/ # Copy file /etc/motd to directory /tmp/jon/

Options
  • -f (to force the copy to occur)
  • -r (to recursively copy a directory)
  • -p (to attempt to preserve permissions when copying)
synonym: copy
mv
- move a file from one location to another. e.g.
$ mv /tmp/jon/handycommands.txt . # move handycommands in /tmp/jon to current directory
$ mv -f vihelp vihelp.txt # Move file vihelp to vihelp.txt (forced) 

Options
  • -f (to force the move to occur)
  • -r (to recursively move a directory)
  • -p (to attempt to preserve permissions when moving)
synonym: move
.
rm
- removes a file. e.g.
$ rm /tmp/jon/*.unl # remove all *.unl files in /tmp/jon
$ rm -r /tmp/jon/usr # remove all files recursively
 Options
  • -f (to force the removal of the file)
  • -r (to recursively remove a directory)
du
Recursively lists directories and their sizes. e.g.
$ du /etc # list recursively all directories off /etc
712 /etc/objrepos
64 /etc/security/audit
536 /etc/security
104 /etc/uucp
8 /etc/vg
232 /etc/lpp/diagnostics/data
240 /etc/lpp/diagnostics
248 /etc/lpp
16 /etc/aliasesDB
16 /etc/acct
8 /etc/ncs
8 /etc/sm
8 /etc/sm.bak
4384 /etc 
The sizes displayed are in 512K blocks. To view this in 1024K blocks use the option -k
lp -d
send file to printer. e.g. $ lp -dhplas14 /etc/motd # send file /etc/motd to printer hplas14
$ lp /etc/motd # send file /etc/motd to default printer
cat
- print a file to stdout (screen). e.g.
$ cat /etc/motd # display file /etc/motd to screen
*******************************************************************************
* *
* *
* Welcome to AIX Version 4.1! *
* *
* *
* Please see the README file in /usr/lpp/bos for information pertinent to *
* this release of the AIX Operating System. *
* *
* *
******************************************************************************* 
cat is also useful for concatenating several files. e.g.
$ cat fontfile IN* > newfile # appends fontfile and all files beginning with IN to newfileThough this might seem an essentially useless command, because most unix commands always take a filename argument, it does in fact come in extremely useful at more advanced levels. Awards are given out occasionally for the most useless usage of cat. If an option of '-' is specified, cat will take its input from stdin.

AIX Interview Questions & answer...........easy way




                                         AIX Interview Questions

How would I know if I am running a 32-bit kernel or 64-bit kernel?
To display if the kernel is 32-bit enabled or 64-bit enabled, type:
bootinfo –K

How do I know if I am running a uniprocessor kernel or a multiprocessor kernel?
/unix is a symbolic link to the booted kernel. To find out what kernel mode is running, enter ls -l /unix and see what file /unix it links to. The following are the three possible outputs from the ls -l /unix command and their corresponding kernels:
/unix -> /usr/lib/boot/unix_up              # 32 bit uniprocessor kernel
/unix -> /usr/lib/boot/unix_mp              # 32 bit multiprocessor kernel
/unix -> /usr/lib/boot/unix_64              # 64 bit multiprocessor kernel      

Note:
AIX 5L Version 5.3 does not support a uniprocessor kernel.
How can I change from one kernel mode to another?
During the installation process, one of the kernels, appropriate for the AIX version and the hardware in operation, is enabled by default. Let us use the method from the previous question and assume the 32-bit kernel is enabled. Let us also assume that you want to boot it up in the 64-bit kernel mode. This can be done by executing the following commands in sequence:
ln -sf /usr/lib/boot/unix_64    /unix
ln -sf /usr/lib/boot/unix_64    /usr/lib/boot/unix

bosboot -ad  /dev/hdiskxx
shutdown –r

The /dev/hdiskxx directory is where the boot logical volume /dev/hd5 is located. To find out what xx is in hdiskxx, run the following command:
 lslv -m hd5


Note:
In AIX 5.2, the 32-bit kernel is installed by default. In AIX 5.3, the 64-bit kernel is installed on 64-bit hardware and the 32-bit kernel is installed on 32-bit hardware by default.
How would I know if my machine is capable of running AIX 5L Version 5.3?
AIX 5L Version 5.3 runs on all currently supported CHRP (Common Hardware Reference Platform)-based POWER hardware.
How would I know if my machine is CHRP-based?
Run the prtconf command. If it's a CHRP machine, the string chrp appears on the Model Architecture line.
How would I know if my System p machine (hardware) is 32-bit or 64-bit?
To display if the hardware is 32-bit or 64-bit, type:
bootinfo –y

How much real memory does my machine have?
To display real memory in kilobytes (KB), type one of the following:
bootinfo -r   

lsattr -El sys0 -a realmem

Can my machine run the 64-bit kernel?
64-bit hardware is required to run the 64-bit kernel.
What are the values of attributes for devices in my system?
To list the current values of the attributes for the tape device, rmt0, type:
lsattr -l rmt0 –E

To list the default values of the attributes for the tape device, rmt0, type:
lsattr -l rmt0 –D

To list the possible values of the login attribute for the TTY device, tty0, type:
lsattr -l tty0 -a login –R

To display system level attributes, type:
lsattr -E -l sys0

How many processors does my system have?
To display the number of processors on your system, type:
lscfg | grep proc

How many hard disks does my system have and which ones are in use?
To display the number of hard disks on your system, type:
Lspv

How do I list information about a specific physical volume?
To find details about hdisk1, for example, run the following command:
lspv hdisk1              
                         

How do I get a detailed configuration of my system?
Type the following:
Lscfg

The following options provide specific information:
-p
Displays platform-specific device information. The flag is applicable to AIX 4.2.1 or later.
-v
Displays the VPD (Vital Product Database) found in the customized VPD object class.
For example, to display details about the tape drive, rmt0, type:
lscfg -vl rmt0

You can obtain very similar information by running the prtconf command.
How do I find out the chip type, system name, node name, model number, and so forth?
The uname command provides details about your system.
uname -p
Displays the chip type of the system. For example, PowerPC.
uname -r
Displays the release number of the operating system.
uname -s
Displays the system name. For example, AIX.
uname -n
Displays the name of the node.
uname -a
Displays the system name, nodename, version, machine ID.
uname -M
Displays the system model name. For example, IBM, 9114-275.
uname -v
Displays the operating system version.
uname -m
Displays the machine ID number of the hardware running the system.
uname -u
Displays the system ID number.
What version, release, and maintenance level of AIX is running on my system?
Type one of the following:
oslevel –r

lslpp -h bos.rte

How can I determine which fileset updates are missing from a particular AIX level?
To determine which fileset updates are missing from 5300-04, for example, run the following command:
oslevel -rl 5300-04

What SP (Service Pack) is installed on my system?
To see which SP is currently installed on the system, run the oslevel -s command. Sample output for an AIX 5L Version 5.3 system, with TL4, and SP2 installed would be:
oslevel –s
5300-04-02
                         

Is a CSP (Concluding Service Pack) installed on my system?
To see if a CSP is currently installed on the system, run the oslevel -s command. Sample output for an AIX 5L Version 5.3 system, with TL3, and CSP installed would be:
oslevel –s
5300-03-CSP
                         

How do I create a file system?
The following command will create, within volume group testvg, a jfs file system of 10MB with mounting point /fs1:
crfs -v jfs -g testvg -a size=10M -m /fs1
                          

The following command will create, within volume group testvg, a jfs2 file system of 10MB with mounting point /fs2 and having read only permissions:
crfs -v jfs2 -g testvg -a size=10M -p ro -m /fs2   
                          

How do I change the size of a file system?
To increase the /usr file system size by 1000000 512-byte blocks, type:
chfs -a size=+1000000 /usr

Note:
In AIX 5.3, the size of a JFS2 file system can be shrunk as well.
How do I mount a CD?
Type the following:
mount -V cdrfs -o ro /dev/cd0  /cdrom

How do I mount a file system?
The following command will mount file system /dev/fslv02 on the /test directory:
mount /dev/fslv02 /test

How do I mount all default file systems (all standard file systems in the /etc/filesystems file marked by the mount=true attribute)?
The following command will mount all such file systems:
mount {-a|all}

How do I unmount a file system?
Type the following command to unmount /test file system:
umount /test

How do I display mounted file systems?
Type the following command to display information about all currently mounted file systems:
Mount

How do I remove a file system?
Type the following command to remove the /test file system:
rmfs /test

How can I defragment a file system?
The defragfs command can be used to improve or report the status of contiguous space within a file system. For example, to defragment the file system /home, use the following command:
defragfs /home

Which fileset contains a particular binary?
To show bos.acct contains /usr/bin/vmstat, type:
lslpp -w /usr/bin/vmstat

Or to show bos.perf.tools contains /usr/bin/svmon, type:
which_fileset svmon

How do I display information about installed filesets on my system?
Type the following:
lslpp -l                          
                          

How do I determine if all filesets of maintenance levels are installed on my system?
Type the following:
instfix -i | grep ML

How do I determine if a fix is installed on my system?
To determine if IY24043 is installed, type:
instfix -ik IY24043

How do I install an individual fix by APAR?
To install APAR IY73748 from /dev/cd0, for example, enter the command:
instfix -k IY73748 -d /dev/cd0                     
                          

How do I verify if filesets have required prerequisites and are completely installed?
To show which filesets need to be installed or corrected, type:
lppchk –v

How do I get a dump of the header of the loader section and the symbol entries in symbolic representation?
Type the following:
dump –Htv

How do I determine the amount of paging space allocated and in use?
Type the following:
lsps –a

How do I increase a paging space?
You can use the chps -s command to dynamically increase the size of a paging space. For example, if you want to increase the size of hd6 with 3 logical partitions, you issue the following command:
chps -s 3 hd6                     
                          

How do I reduce a paging space?
You can use the chps -d command to dynamically reduce the size of a paging space. For example, if you want to decrease the size of hd6 with four logical partitions, you issue the following command:
chps -d 4 hd6                     
                          

How would I know if my system is capable of using Simultaneous Multi-threading (SMT)?
Your system is capable of SMT if it's a POWER5-based system running AIX 5L Version 5.3.
How would I know if SMT is enabled for my system?
If you run the smtctl command without any options, it tells you if it's enabled or not.
Is SMT supported for the 32-bit kernel?
Yes, SMT is supported for both 32-bit and 64-bit kernel.
How do I enable or disable SMT?
You can enable or disable SMT by running the smtctl command. The following is the syntax:
smtctl [ -m off | on [ -w boot | now]]

The following options are available:
-m off
Sets SMT mode to disabled.
-m on
Sets SMT mode to enabled.
-w boot
Makes the SMT mode change effective on next and subsequent reboots if you run the bosboot command before the next system reboot.
-w now
Makes the SMT mode change immediately but will not persist across reboot.
If neither the -w boot or the -w now options are specified, then the mode change is made immediately. It persists across subsequent reboots if you run the bosboot command before the next system reboot.
How do I get partition-specific information and statistics?
The lparstat command provides a report of partition information and utilization statistics. This command also provides a display of Hypervisor information.
How do I know if my volume group is normal, big, or scalable?
Run the lsvg command on the volume group and look at the value for MAX PVs. The value is 32 for normal, 128 for big, and 1024 for scalable volume group.
How to create a volume group?
Use the following command, where s partition_size sets the number of megabytes (MB) in each physical partition where the partition_size is expressed in units of MB from 1 through 1024. (It's 1 through 131072 for AIX 5.3.) The partition_size variable must be equal to a power of 2 (for example: 1, 2, 4, 8). The default value for standard and big volume groups is the lowest value to remain within the limitation of 1016 physical partitions per physical volume. The default value for scalable volume groups is the lowest value to accommodate 2040 physical partitions per physical volume.
mkvg -y name_of_volume_group -s partition_size list_of_hard_disks
                          

How can I change the characteristics of a volume group?
You use the following command to change the characteristics of a volume group:
Chvg

How do I create a logical volume?
Type the following:
mklv -y name_of_logical_volume name_of_volume_group number_of_partition
                          

How do I increase the size of a logical volume?
To increase the size of the logical volume represented by the lv05 directory by three logical partitions, for example, type:
extendlv lv05 3
                         

How do I display all logical volumes that are part of a volume group (for example, rootvg)?
You can display all logical volumes that are part of rootvg by typing the following command:
lsvg -l rootvg

How do I list information about logical volumes?
Run the following command to display information about the logical volume lv1:
lslv lv1

How do I remove a logical volume?
You can remove the logical volume lv7 by running the following command:
rmlv lv7

The rmlv command removes only the logical volume, but does not remove other entities, such as file systems or paging spaces that were using the logical volume.
How do I mirror a logical volume?
1.     mklvcopy LogicalVolumeName Numberofcopies
2.     syncvg VolumeGroupName
How do I remove a copy of a logical volume?
You can use the rmlvcopy command to remove copies of logical partitions of a logical volume. To reduce the number of copies of each logical partition belonging to logical volume testlv, enter:
rmlvcopy testlv 2

Each logical partition in the logical volume now has at most two physical partitions.
Queries about volume groups
To show volume groups in the system, type:
Lsvg

To show all the characteristics of rootvg, type:
lsvg rootvg

To show disks used by rootvg, type:
lsvg -p rootvg

How to add a disk to a volume group?
Type the following:
extendvg   VolumeGroupName   hdisk0 hdisk1 ... hdiskn

How do I find out what the maximum supported logical track group (LTG) size of my hard disk?
You can use the lquerypv command with the -M flag. The output gives the LTG size in KB. For instance, the LTG size for hdisk0 in the following example is 256 KB.
/usr/sbin/lquerypv -M hdisk0
256

You can also run the lspv command on the hard disk and look at the value for MAX REQUEST.
What does syncvg command do?
The syncvg command is used to synchronize stale physical partitions. It accepts names of logical volumes, physical volumes, or volume groups as parameters.
For example, to synchronize the physical partitions located on physical volumes hdisk6 and hdisk7, use:
syncvg -p hdisk4 hdisk5                    
                          

To synchronize all physical partitions from volume group testvg, use:
syncvg -v testvg                  
                          

How do I replace a disk?
1.     extendvg VolumeGroupName  hdisk_new
2.     migratepv hdisk_bad hdisk_new
3.     reducevg -d VolumeGroupName hdisk_bad
How can I clone (make a copy of ) the rootvg?
You can run the alt_disk_copy command to copy the current rootvg to an alternate disk. The following example shows how to clone the rootvg to hdisk1.
alt_disk_copy -d  hdisk1

How can I display or set values for network parameters?
The no command sets or displays current or next boot values for network tuning parameters.
How do I get the IP address of my machine?
Type one of the following:
ifconfig -a

host Fully_Qualified_Host_Name

For example, type host cyclop.austin.ibm.com.
How do I identify the network interfaces on my server?
Either of the following two commands will display the network interfaces:
lsdev -Cc if

ifconfig –a

To get information about one specific network interface, for example, tr0, run the command:
ifconfig tr0

How do I activate a network interface?
To activate the network interface tr0, run the command:
ifconfig tr0 up

How do I deactivate a network interface?
For example, to deactivate the network interface tr0, run the command:
ifconfig tr0 down

 


1. How do you create an LV?
Ans: #mklv –y lv_name vg_name PPs pv_name

2. How do you create a filesystem on a given LV?
Ans: # crfs –v jfs –d /dev/lv_name –m /mount_point

3. What is Journaled File System?
Ans: It maintains a log in corresponding log device before committing any changes to LV and thus maintains integrity of file system.

4. What are the types of filesystems in AIX?
Ans: JFS, JFS2, CDRFS, NFS

5. What are the differences between JFS and JFS2 FS?
Ans:  JFS- inode allocation while creating file systems is static
         JFS2 – Inode allocation is dynamic
         JFS- maximum file system size is 1 TB
         JFS2- Maximum file system size is 4 PB
         JFS- Inode size is 128 Bytes
         JFS2 – Inode size is 512 bytes

6. What is the file responsible to tell about the filesystems?
Ans: /etc/filesystems

7. How will you troubleshoot the file system problem?
Ans: using fsck and logform

8. Where you keep the shared folders in AIX?
Ans: /etc/exports

9. What exportfs –a command does?
Ans: It reads entries from /etc/exports and updates /etc/xtab

10. What is inode?
Ans: It is an Index node and points to the another inode or a datablock
11. What is superblock?
Ans: First block of any file system and contains Meta data of its like no of inodes and free list of inodes etc.

12. What is the daemon responsible for error log?
Ans: errdemon

13. What is the path for default log file?
Ans: /var/adm/ras/errorlog

14. How do you restrict remote user?
Ans: chuser rlogin=false user_name

15. How do you list filesystems?
Ans: lsfs

16. What are the stanzas in /etc/filesystem?
Ans: dev=, Mount=, Log=, Vfs=, Check=, Type=
         
17. How do you check error log?
Ans: # errpt -a

18. What is /proc file system?
Ans: contains process related information of all processes which are presently running.

19. What is the command to change the password of another user by a user –admin (other than root user) who can set the passwords for users?
Ans: pwdadm

20. In the above question user “admin” belongs to which group?
Ans. Security

21. How will you set the password for a user whose password length must be eight characters?

Ans: smit chuser or # chuser minlen=8 user_name Entries will be updated in /etc/security/user


22. Where is the password for a user stores?
Ans: /etc/security/passwd

23. What are the fields available in the: /etc/security/passwd file?
Ans: last update, password and flag

24. What are the fields available in /etc/passwd file?
Ans: username: password indication: uid: gid: gcos: homedirectory: shell

25. What are the actions will take happen while exporting vg?
Ans: Removes that vg entry from odm
Removes corresponding filesystem entries related to VG from /etc/filesystems.

26. One VG is exported from a system and imported in another system there created some new filesystems in that VG. Now to import that VG back to the old system what command you should execute?
ANS:   importvg –L –y vgname pvname

27. What is the VGDA information?
Ans: VG id, LV names, PV count, total PP’s, free PP’s, lv count, LTG etc.
(Use   # lqueryvg –p hdiskx –At)

28. While importing VG the /etc/filsystems will get updated, from where the information of file systems it gets?
Ans: LVCB of each lv (mount point information will reside in LVCB if the mount point length is less than 128 characters)

29. How will you set the customized UMASK for all users?
Ans: Add the entry in /etc/security/user- In default Section

30. What is LVM and its components?  What is the advantage of LVM in AIX.?
Ans: VG, PV, LV, FILESYSTEMS, File systems can be extended beyond the limit of PV size to multiple PVs.

31.  Can we add PV of different sizes into an existing VG? How to fully utilize the hdd space?
Ans Yes we can add PV of different sizes to existing VG. Change t factor

32. How you find out the characteristics of VG? What are the main features you look for?
Ans: #lsvg vgname.   NO. PPs, Free PPs, stale PPs etc


33. What is stale partition?
Ans: When a pp is out of synchronization it shows as stale partition.

34. How many PPs can be pointed by a LP? Is the size of LP increases with mirroring of PPs?
Ans: 3 PPs can be pointed a LP. No the size of LP does not increase with PP mirroring

35. What are the information you get in VGDA ?
Ans: PP size, PV count, max PPs, LV names etc, Free PPs,

36. What is the difference between VGDA & VGSA?
Ans:

37. What is LVCB?
Lvname, no of copies, inter policy, intra policy, no. of lps, lvid etc

38. What is quorum? Give details.
Ans: 51% of total VGDA information is called quorum

39. What is ‘t’ factor?
Ans:  by t factor we can increase max no. of PPs from default 1016. Ex: t2 will make 2032 max physical partitions.

40. How you make concurrent VG ?
Ans: mkvg –C –y vgname pvname

41. What are daemons in NFS ? Give details of each daemon ?
Ans : nfsd, rpc.mountd, rpc.statd, rpc.lockd and at client side biod

42. When we reopen an exported file after working on it we get stale error. What is the reason ?

43. What is the difference between network interface and network devices?
Ans: interface is logical device for tcpip networking, network devices are physical adapter.

44. How to add IP by aliasing to a network device ?
Ans: ifconfig en0 193.9.200.227 255.255.255.0 alias


45. What is netmask ?
Ans: to differentiate between network address and host address.

46. Give an example of class B network
Ans:  130.10.200.0

47. What is loopback address and its utility ?
Ans: IP address 127.0.0.1 is called loopback address and is used by the node to check the functioning of  its own tcpip sevices.

48. Where to add gateway in the network ? Can we use router as gateway ?
Ans: to connect between two different networks. Yes we can use router as gateway.

49. What is the difference between /etc/passwd and /etc/security/passwd ?
Ans: user information are stored in /etc/passwd . encrypted passwd is stored /etc/security/passwd

50. How to disable the lock of a user when he has crossed the failed login limits? Which is the file to look into it?
Ans: chuser account_locked=true user. /etc/security/user
51. What is the difference between systemwide profile and .profile of an user ?
Ans: ./profile of user overrides the env variables set by /etc/profile

52. What difference you find in #su root and #su – root ?
Ans: Su – root initializes the environment to that of root.

53. What is umask and why we require it ?
Ans: The umask value is deducted from default permission value 777 of a file when created.

54. What is tcb and how it works ?
Ans:  trusted computing base. When it is enable only trusted commands are executed by verifying with /etc/security/sysck.cfg.

55. What is quota and give full syntax of commands.
Ans: it fixes the limits for files and sizes for each user. Quota

56. What is trusted path and trusted shell?
Ans:

57. How you enable ACL in a file.
Ans: extended permission to be set in file. To set use the command acledit,aclget,aclput

58. How to find out the characteristics of an user ? What is difference between #lsuser and #lsattr?
Ans: lsuser, by lsattr we can find out the attributes of a device

59. What is the procedure to configure remote printer?
Ans: enable lpd daemon, create a queue and connect it to remote queue

60. What is difference between defined and available state in ODM ?
Ans: defined means it is already configured but not available for use. Available means the device is ready for use.

61. How you see maintenance level in AIX? What is the other command than #oslevel –r
Ans: instfix

62. How you install ML in AIX?   
Ans: #smitty update_all

63. What is the procedure in installing a package in AIX ? What is applied , commited, rejected states ?
Ans: applied –for testing of package only, committed: to install the package into the system. Reject: to reject the package if it fails in applied state

64. Can we install ML5 and ML6 simultaneously in applied state in same machine?
Ans: yes we can

65. If we remove ML5 from the m/c, will the ML6 will work ?
Ans: yes it will work

66. What is difference between backup and archive ?
Ans: archive: the backup data stored permanently for retrieval later date. Backup is a regular process like full backup, differential backup, incremental backup.

67. What is the difference between incremental and differential backup ?
Ans: In diff. Bacup it is compared with last full backup. In incremental backup it is compared to last backup.

68. What is crontab and how to schedule a job to run at 5pm on every Saturday?
Ans: to schedule to run a process at particular time. Edit the crontab file by crontab –e or crotab –l > crontmp, edit the crontmp by syntax m, h, day of month, month, day of week /process. Then start the process by crontab crontmp

69. What is the location where cron queues are being maintained
Ans: /var/spool/cron/crontabs

70. Where errorlog files are stored ?
Ans: /var/adm/ras/errlog

71. When there is a problen in a system what to do first ?
Ans: lookinto error log by errpt –a command

72. What is difference between errorlog and alog  files ?
Ans: alog gives the information on boot error.

73. What is the boot sequence in AIX and give the details of each step of booting.
Ans: 

74. What is mksysb backup? What are advantages we get out of it?
Ans: rootvg backup, sytem can be restored in case of failure, PP size can be changed, filesystem size can be reduced by shrink

75. Can we do the mksysb backup and savevg of other vg on same tape? Give the reason.
Ans: No

76. What is the procedure to retrieve only /etc/hosts file from mksysb tape? Give commands with exact syntax.
Ans: #tctl –f /dev/rmt0 rewind
  #restore –s4 –xqvf /dev/rmt0.1 ./etc/hosts

77. How you increase the size of a file system by 5GB? Give command details.
Ans: #chfs –a size=+5G /data

78. What are the tools available for performance monitoring?
Ans: sar, vmstat, topas

79. When you tell the system is CPU Bound or memory bound?
Ans: Run the sar command. If the value of %USER + %SYS is more than 80% we call the system is CPU bound. Run the vmstat command. If PI and PO is high we call the system to be memory bound.      

80. How will you check a given file system is large filesystem enabled?
Ans: lsfs –q fsname, if bf=true the given filesystem supports big filsystem

81. What is command to see MAC address of NIC
Ans: # lscfg –l ent0 –v

82. How will you check the serial no of the system?
Ans: uname –a

83. How will you see the parent device for en0?
Ans: # odmget –q “name like en0” CuDv

84. What is the fastpath for SSA RAID?
Ans. # smit ssaraid

85. How will you check the given hdiskn has how many no of Pdisks of your SSA box?
Ans: # ssaexlate –l hdiskn

86. What is the command to list all supported hardware by your system?
Ans: lsdev –P –H

87. How will you list the total no adapters your system have?
Ans: lsdev –Cc adapter

88. What is the command to see your dumpdevice?
Ans: sysdumpdev –l

89. What is the default dumpdevice?
Ans: /dev/hd6

90. List the file system hd1, hd2 etc and what they are meant for?
Ans:

91. How will you see the hard ware errors?
Ans: # errpt –d –H

92. How to clear the all errorlog messages?
Ans:# errclear 0

93. How to make the secondary dumpdevice permanently active?
Ans: # sysdumdev –P –s /dev/xxx.

94. Tell me the steps to replace the one hdd belongs to the mirrored rootvg?
Ans. Explain the detailed procedure

95. What is the command to move an lv to another hdd?
Ans: # migratepv –l lv_name hdiskx hdisky

96. How to disable a user from remote login?
Ans: # chuser rlogin=false user_name

97. How to prevent all users to login from the remote?
Ans: # touch /etc/nologin (Except root all users can not login from remote)

98. How to add a pv into a VG?
Ans: # extendvg vg_name pv_name

99. How to see the ftp service is running or not? How to enable it?
Ans: lssrc –s inetd, startsrc –s inetd or startsrc –t ftpd

100. What are the differences between IPAT over IP aliasing and replacement?
Ans: Explained the complete details of both methods.

101. What is the difference between MOUNT=TRUE and MOUNT=AUTOMATIC in /etc/filesystems?
Ans: OS related File systems which are mounted at the time of boot process will have ‘AUTOMATIC’ attribute and other filesystem which can be mounted along with system startup
Will have ‘TRUE’ attribute.

102. What is sticky bit and tell me example?
Ans: Sticky bit permission will be set to directory so as all user can make use of the files in that directory, but only owner can delete the file.

103. What is setuid and tell me example?
Ans: A file which is having SUID will be excuted as if its effective id Eg. /etc/passwd

104. If T and S permissions are set for the files what does it mean?
Ans: When Sticky bit and SUID permission set on directory and file which are not with executable permissions  set  respectively will shown like this.

105. How to check a VG is mirrored or not?
Ans: If a lp is mapped to more than one  pp by  lsvg –l vgname  command then VG is said to be mirrored.

106. What are the differences between AIX 5.1 and 5.3?
Ans:

107. What is the difference between UDP and TCP?
Ans:TCP- Connection oriented and acknowledgment for packet transmitted.
UDP-User Datagram protocol- Connectionless and no acknowledgment for the packets transmitted.

108. How to restore a single file of rootvg from mksysb backup tape media?
Ans: restore –S4 xvf /dev/rmt0 ./

109. How to format a log file system?
Ans: logform

110. What is the difference between applied and committed s/w?
Ans: applied state software can be rejected if don’t work properly if it suite then it can be committed. A software which was committed can‘t be rejected only way is uninstall.

111. How to commit applied state software?
Ans: installp –cgX

112. What is the difference between hard and soft mount in NFS?
Ans: For Hard mount the client keep tries to mount the file system until it succeeds. Where as the Soft Mount tries to mount the file system for few attempts if it is not succeeded in a given attempts it gives up.

113. What is the command to make the hdisk as bootable (bosboot)?
Ans: bosboot –ad /dev/hd5.

114. What is the lpp resource in NIM?
Ans. It has software image to be installed at client.

115. How to list all file systems?
Ans: lsfs

116. How will you edit the crontab?
Ans:    crontab –e
crontab –l > filename, edit file and crontab filename.

117. How do you list all volume groups?
Ans. Lsvg
118. How do you mirror rootvg?
Ans. Extendvg rootvg hdiskn, mirrorvg rootvg hdiskn, bosboot –ad, bootlist –m normal hdiskx, hdiskn.

119. What are the commands you used for performance monitoring?
Ans. Vmstat, sar, iostat, topas etc.

120. How will you come to know the system required more real memory using vmstat?
Ans. If pi and Po count is more (if paging activity is more even though it has enough paging space)

121. What is the use of AT command and how will you list the jobs?
Ans: One time operation for a given time. Atq –L

122. How do you exclude some file systems while taking mksysb backup?
Ans: By mentioning the file systems name in exclude.rootvg

123. How do you list the pv in system?
Ans: lspv

124. What are the AIX installation methods?
Ans: Complete and overwrite, preservation installation and migration

125. What are the prerequisites before attempting migration installation?
Ans: Take the system backup, check for hardware and s/w compatibility for newly installable os. Prepare with remedies for known problems.

126. How to roll back to the previous ML level if the newly installed ML had problem with applications.
Ans: If newly installed ML is in applied state, reject it. If it is committed state remove the fix and reinstall the previous ML.

127. What are the difference between applied state and committed state?
Ans: If we select applied state it will not replace the previous level and will have option to commit or reject the newly installed s/w. In committed state newly installed s/w will overwrite the existing s/w and will not have option to reject.

128. What is /etc/filesystems and what is its role?
Ans: /etc/filesystem has information regarding file systems, its mount point type of file system etc. Its main purpose to mount and check the file systems as per the parameters mentioned in it.

129. How to see the paging space?
Ans: lsps –a

130. How to increase the paging space?
Ans: chps –s pp’s  devicename.


131. What is the default paging space device?
Ans: hd6

132. What is ODM & Location of Database Files
Ans; ODM is database which contains the information of devices & system configuration. /etc/objrepos, /usr/lib/objrepos, /usr/share/lib/objrepos

133. Give details of each database files.
Ans: /etc/objrepos:  contains customized database
/usr/lib/objrepos:  contains predefined database
/usr/share/lib/objrepos:  contains software vital product data
134. How to set password history?
Ans: /etc/security/user

135. How to set two or three password?

136. What happens when execute exportvg & importvg?
Ans: Exportvg: removes info. of particular VG from ODM
  Importvg:  Add info. Of from VGDA of disk to ODM

137. What is NFS & file names of NFS?
NFS is distributed file system which provide remote access of file system.
File name:  /etc/exports

138. How to set permissions for exported directory?
Using /etc/exports

139. What are the types of Installation in AIX?
Ans: Complete/Overwrite Migration and Preservation Installation.

140. What is migration installation?
Ans:    For Upgrading the version of AIX.

141. Can we preserve /var file system in preservation installation?
Ans:    By default it removes /var files system. However by specifying in /etc/preserve.list we can retain the /var filesystem .

142. If you confirmed rootvg is completely crashed and no backup is available what are the actions to be performed?
Ans:    Reinstall OS, apply the required ML level and install /configure all apllications. Import all volume groups.

143. How to create a user using command prompt by specific home directory:
Ans:    #mkuser -a /xxxx/user1 user1

144. What is zombie process?
Ans:    It is dead process but it shows in the process list
 
145. What are LVM components?
Ans:     Explained all components like PPs, LPs, etc.

146. What is command to create LV
Ans:    # mklv  -t type  -y  lv_name  vg_name  no.of PPs   pvname

147. How to create a Vg:
Ans:    mkvg -y vgname  pvname1 pvanme2

148. What is the path for sulog?
Ans:    /var/adm/sulog

149. What is path for wtmp?
Ans:    /var/adm/wtmp

150. What is the path for failedlogin?
Ans     /etc/security/failedlogin

151. What makes difference when you su with - and without - ?
ANs:   With - env variable will set for newly switched user.

152. What are env variables?
Ans:    PATH, TZ, PWD, SHELL, EDITOR, etc.

153. What component we can not install once installation is carried out?
Ans:    TCB

154. How will you check whether TCB is installed or not?
Ans:    /usr/bin/tcbck

155. How will you list applied S/W?
Ans:    lslpp -l | gerp apllied

156. What is difference between applied state and committed state installation?
ANs    Applied state - Can be committed of rejected
          Committed state- Can not be rejected.



157. What is the difference between backup and archive?
Ans:    Backup: Performs regularly and recycle the media periodically.
          Archive: For preserving data for longer times and media should have good quality for preserving data and less seek time is required for data retrieval on need basis.

158. How to kill a process?
Ans:    By confirming the process whether it controlled by SRC or Init, if it is init use kill command of if it is by SRC use stopsrc.

159. What is shell?
Ans     Command intrepeter.

160. How to check ML version?
Ans:    # oslevel -r

161. If the system had ML version 7 and rootvg is courrpted and needs to restore mksysb. But mksysb backup was taken with ML5 How to go about?
Ans:     Restore mksysb and update new ML version with 7.

162. What is stickybit can we set it for file?
Ans:    To prevent deletion of each other files of users who had common directory?
          Stickybit set for a file is no use.

163. What is the purpose of chmod
Ans     To assign file/directory permissions for user/group/others

164. How will you check the attributes of a user?
Ans:    lsuser


165. How will you prevent user form logging remote?
ANs    # chuser -a rlogin=false username

166. If the uptime file is corrupted how will you see the server uptime?
Ans:    # who -b

167. What is the difference between differential and incremental backup?
Ans:    Differential backup will take the backup of the data modified w.r.t to its previous full backup whereas incremental backup will take the backup of modified data w.r.t its previous backup.
168. How do you add pv in shared vg?
Ans.    Explain detailed procedure.

169. What is the significance of 9 with kill command?
Ans:    It surly kills the process and will not save any

170. How will you list the specific attributes of a user?
Ans: lsuser -a id home username

171. How will u see the version and ML of AIX?
Ans: oslevel –r for version and instfix –ik |grep ML for ML

172. How will u check the errors during booting?
Ans: alog command

173. How will u check the errors after booting?
Ans: errpt command



174. Detailed information about NFS?
Ans: Explain about NFS and the daemons at server and client

175. What is LVM?
Ans. Logical Volume manager- explained its advantages and all of its components.

176. What is the parameter used for inodes while creating filesystem?
Ans: nbpi

177. Explain the installation procedure for installing AIX
Ans. Explained the complete installation procedure and narrated type os installation

178. How to repair a file system?
Ans.  Fsck and logform

179. What is super block?
Ans: First block of every file system which contains meta data of the file system and its alternate block is 31.