Professional Documents
Culture Documents
Applications
Shell
kernel
H/W
ravi_aix@yahoo.com
Kernel
The Kernel interfaces directly with the hardware devices and controls their access. It also controls the processes that are started by users.
Shell is a command interpreter and acts as an interface between user and kernel.
Also the Shell is a programming language. We can write Shell scripts to automate tasks.
ravi_aix@yahoo.com
Logging In $ login: team01 team01s Password: $ Logging In $ <ctrl+d> $exit $logout (or) (or)
ravi_aix@yahoo.com
Passwd
Passwd command is used to change the user password.
$
passwd
Changing password for team01 team01s Old password : team01s New password: Enter the new password again: $ _
ravi_aix@yahoo.com
Command Format
The general format of an AIX command is command option (s) argument (s)
$ lsvg l rootvg
command
option
argument
ravi_aix@yahoo.com
GMT
2008
Mon 5 12 19 26
Fri 2 9 16 23 30
Sat 3 10 17 24 31
ravi_aix@yahoo.com
$ $ $ $ $ $ $ $
ravi_aix@yahoo.com
lft0 pts/0
$ finger jim Login name: jim Directory: /home/jim Shell: /user/bin/ksh On since Mar 04 13:23:32 on tty3 No Plan.
9
ravi_aix@yahoo.com
Sending Mail $ mail team01 Mail to a user on the same system Subject: Meeting There will be a meeting in room 432 at noon. <ctrl-d> Cc: <Enter> $ mail team20@sys32 Mail to a user on a different system Subject: Meeting Do not forget about the meeting. <ctrl-d> Cc: <Enter>
10
ravi_aix@yahoo.com
write
write provides a conversation like communication with each user alternatively sending and recieving messages.
$ write jim <enter> reboot sys2 at noon <enter> o <enter> o means over $ write sam Ill do that <enter> oo <enter> <ctrl-d>
sams terminal
jims terminal oo means over and out to end session use write across a N/W
ravi_aix@yahoo.com
$ write sarah@system23
11
wall
The wall command writes to all terminals and useful to notify all users of a system event.
$ talk fred (fred recieves this message) Message from TalkDaemon@sys1 at sys1 at 5:23 ... talk: connection requested by john@sys1 talk: respond with: talk john $ talk john
12
File Structure
AIX has a Hierarchial File Structure.
14
ravi_aix@yahoo.com
File Structure
AIX has a Hierarchial File Structure.
15
ravi_aix@yahoo.com
File Structure
AIX has a Hierarchial File Structure.
16
ravi_aix@yahoo.com
File Structure
AIX has a Hierarchial File Structure.
17
ravi_aix@yahoo.com
pwd command
The print working directory prints your current directory
$ pwd /home/team01
18
ravi_aix@yahoo.com
list command
ls [ directory ]
dec.out
19
ravi_aix@yahoo.com
cd [ directory ] relative path absolute path moves to your home directory moves to the parent directory
20
ravi_aix@yahoo.com
mkdir command
21
ravi_aix@yahoo.com
rmdir command
rmdir [ directory ]
$ rmdir /home/team01/aaa $ cd home $ rmdir team01 rmdir: team01 not empty $ rmdir p dir1/dir2/dir3
22
ravi_aix@yahoo.com
rmdir command
rmdir [ directory ]
23
ravi_aix@yahoo.com
links 2
User
Group
Date
jan 10 9:15 jan 10 9:15
Size 512 96
loc
dir
755
jim
staff
$ vi myfile
24
ravi_aix@yahoo.com
$ istat mydir
Inode 51 on device 10/8 Directory Protection: rwxr-xr-x owner: 208(team01) Link count: 2 Last updated: Last modified: Last accessed: Mon Mon Tue Group: 1 (staff) Length 512 bytes Jan Jan Jan 17 17 18 21:05:43 2000 21:05:43 2000 13:25:43 2000
25
ravi_aix@yahoo.com
touch command
touch filename
The touch command creates a zero-length file. If a file with the name already exists the last modification time is updated with the current time.
$ touch aa
26
ravi_aix@yahoo.com
Recursive copy
27
ravi_aix@yahoo.com
move command
mv source target
The mv command can be used to move files and directories and also rename them.
28
ravi_aix@yahoo.com
$ cat aa this is a file to test the output of cat command. this file is created using vi editor. $ pg aa $ more aa
ravi_aix@yahoo.com
29
ravi_aix@yahoo.com
link command
ln source_file target_file
The ln command allows one file to have more than one name. Both copies have the same i-node.
31
ravi_aix@yahoo.com
print command
To queue files to the printer we use the qprt command. The qchk command displays the current status of a print queue. To cancel a print job use the qcan command.
$ qprt ls.out aa.txt $ qprt P lp2 mail to specify a non-default printer $ qchk Queue Dev lp0 lp0 $ qcan 23 job number
32
Status Running
Job 99
ravi_aix@yahoo.com
user name
filename
33
ravi_aix@yahoo.com
r w x
----------
Owner (u)
Others (o)
all (a)
ravi_aix@yahoo.com
34
Changing permissions
35
ravi_aix@yahoo.com
symbolic notation; chmod mod filename $ ls -l -rwxr-xr-x 2 team01 staff 1024 jan 12 r w x ---------read permission write permission execute permission u g o ------+ = ------10:35 test
10:35 test
ravi_aix@yahoo.com
4+1=5
4+2=6
10:35 test
To change permissions so that group also has write perm., and others do not have write perm:
10:35 test
ravi_aix@yahoo.com
umask
umask is an octal number which specifies what permission bits will be set on a new file or directory when created. It has a default value of 022 which is set in /etc/security/user.
$ umask 022
38
ravi_aix@yahoo.com
The Vi editor
$ vi tstfile ~ ~ ~ ~ ~ ~ tstfile [New file] If the file doesnt exist a new file tstfile is created.
39
ravi_aix@yahoo.com
The Vi editor $ vi tstfile ~ ~ ~ ~ ~ ~ tstfile [New file] ~ represents empty lines The editor starts in command mode
40
ravi_aix@yahoo.com
commands
a A i I ----add text after cursor add text to the end of line insert text at the cursor insert text at the start of line
k h j l
41
ravi_aix@yahoo.com
The Vi editor
more commands
:q! -- quit without saving :w -- write changes and stay in editor :wq :x -- write changes and quit <shift-zz> x -dw -d$ -d0 -dd -:20,40d u
42
delete a single character delete to the end of current word delete to the end of the line delete to the start of the line delete the whole line -- delete a range of lines (20,40 are line numbers) -- undo last change
ravi_aix@yahoo.com
search for a pattern search forward for the search backward for the continue search in same direction continue search in opposite direction
Global Replacement :g/abc/s//xyz/g replaces abc with xyz throughout the entire file yy p copy a line paste the copied line
43
ravi_aix@yahoo.com
vi options
we can change the behaviour of vi by setting some options. options are stored in the file $HOME/.exrc
display all settings set autoindent on set autoindent off enable line numbers disable line numbers displays non-printable characters hide non-printable characters ignore case sensitivity case sensitive
44
ravi_aix@yahoo.com
command-line editing
To enable the functionality of vi editor in the command line. To recall previous commands press <esc-k>,use k,j keys to scroll through previously entered commands.
45
ravi_aix@yahoo.com
vi EDITORS
There are various forms of vi.
read-only form of vi
beginners version of vi
simple form of ex
46
ravi_aix@yahoo.com
SHELL Basics
The Shell is the primary interface between the user and the OS.
47
ravi_aix@yahoo.com
48
ravi_aix@yahoo.com
Examples $ ls ne? net new $ ls ?e? few new den ? is expanded by the shell to match any single character in a filename.
49
ravi_aix@yahoo.com
$ ls > ls.out $mail team01 < letter $cat abc 2> errfile
50
Pipes
A pipe is a sequence of one or more commands where the stdout of one command becomes the stdin of the next command.
$ ls l | grep d | wc l
Filter
51
ravi_aix@yahoo.com
Tee
The tee command reads stdin and sends the data to both stdout and a file.
$ ls l | tee /tmp/ls.out | wc l
ls -l
tee
wc -l
/tmp/ls.out
52
ravi_aix@yahoo.com
command grouping
Multiple commands can be entered on the same line seperated by a semi-colon.
53
ravi_aix@yahoo.com
Shell Variables
Variables represent data whose value may change. Shell variables define your environment...HOME,TERM,PATH etc., Shell variable names are case sensitive. The convention is that UPPERCASE are used for system-defined variables and lowercase are used for user-defined variables.
$ set
ravi_aix@yahoo.com
Setting and Referencing Shell Variables $ SHELL=/usr/bin/bash assign a value to a shell variable $ xy=hi friends $ echo $xy hi friends $ unset xy referencing a variable delete a variable
55
ravi_aix@yahoo.com
Commmand substitution $ date Thu 13 Oct 23:43:55 2008 $ now=$(date) $ echo $now Thu 13 Oct 23:43:55 2008
56
ravi_aix@yahoo.com
Quoting Metacharacters
Single Quotes Ignores all metacharacters between the quotes.
ravi_aix@yahoo.com
Process
A program or a command that is actually running on a system is referred to as a process. Every process has a Process ID (PID). PID 1 is always assigned to the init process which is the first process that is started during the boot process. A PPID is the parent PID. The variable $$ shows the PID of the current shell.
PPID 1 205 20
ravi_aix@yahoo.com
PID=345
-ksh
Login
59
ravi_aix@yahoo.com
Each program runs in its own process environment.Variable x is not known in the subshell. To pass variables into a subshell we need to execute the export command.
60
ravi_aix@yahoo.com
Exporting variables $ x=4 $ y=6 $ export y $echo $x; echo $y 4 6 $ksh $echo $x $echo $y 6 $y=11 <ctrl-d> $echo $y 6
61
Subshell
ravi_aix@yahoo.com
Shell Script
A shell script is a collection of commands stored in a text file. Any text editor can be used to create a shell script. Here we start ksh and pass the script name as an argument.
$ cat hello echo hi friends today is $(date) pwd $ksh hello execute script hi friends today is Mon Aug 12 2008 12:34 /home/team01
Subshell
62
ravi_aix@yahoo.com
$ cat hello echo hi friends today is $(date) pwd $ chmod +x hello $ hello execute script hi friends today is Mon Aug 12 2008 12:34 /home/team01
Subshell
63
ravi_aix@yahoo.com
$ cat hello echo hi friends today is $(date) pwd $.hello execute script hi friends today is Mon Aug 12 2008 12:34 /home/team01
Subshell
64
ravi_aix@yahoo.com
Exit Codes
A command returns an exit value to the parent process. The environment variable $? contains the exit value of last command.
0 1-255
= =
65
ravi_aix@yahoo.com
ps command
The ps command displays process status information.
$ps -f UID PID jim 205 jim 206 $ps -f $ps -e $ps l
COMMAND ls date
FULL listing displays info about every process running in the system Long listing shows all processes from user team05
ravi_aix@yahoo.com
$ps u team05
66
Types of Processes
Processes that are started from and require interaction with the terminal are called Foreground processes. Processes that can run independently are called Background processes.
background process
67
ravi_aix@yahoo.com
Terminating Processes
68
Termination Signals Signal 01 02 03 Meaning hangup signal is sent to a process if its parent dies Interrupt signal is generated when <ctrl-c> is pressed Quit signal is generated when the quit key is pressed <ctrl-\> Kill signal
09 15
69
$nohup ls R / > ls.out & [1] 34 $_ $nohup ls R / [1] 34 sending output to nohup.out $_
ravi_aix@yahoo.com
70
Job control $jobs [1] + <ctrl-z> $fg %1 $bg %1 $kill %1 List jobs ls R / > ls.out Suspend a foreground job execute job in foreground execute job in background kill a job
Running
71
ravi_aix@yahoo.com
Daemons
A daemon is a never ending process that controls a system resource (printer queue). It starts when the system is started and runs until the system is down. For example qdaemon tracks print job requests and the printers available to handle them.
72
ravi_aix@yahoo.com
73
ravi_aix@yahoo.com
User Environment Login Files root /etc/environment can only be changed by system admin
root /etc/profile
User $HOME/.profile
74
sample /etc/environment
$ cat /etc/environment # # # # WARNING: This file is only for establishing environment variables.Execution of commands from this file or any lines specified above may cause failure of the initialization process.
75
ravi_aix@yahoo.com
sample /etc/profile
$ cat /etc/profile #System-wide profile.All variables set here may be #overridden by a users personal .profile file in their #$HOME directory.However all commands here will be #executed at login regardless. readonly LOGNAME umask 022 TMOUT=120 MAIL=/usr/spool/mail/$LOGNAME MAILMSG=[YOU HAVE NEW MAIL] TERM-ibm3151 export LOGNAME MAIL MAILMSG TERM TMOUT
ravi_aix@yahoo.com
76
sample .profile
$ cat .profile PATH=/bin:/usr/bin:/etc:$HOME/bin: PS1= $PWD=> if [ -s $MAIL ] then echo $MAILMSG ENV=$HOME/.kshrc execute this file every time a new ksh is started export PATH PS1 ENV
77
ravi_aix@yahoo.com
Environment Variables
LOGNAME TMOUT MAIL TERM TERM PS1 ENV It is a read-only variable which contains your login name. Time after which the terminal is logged off by the system. Holds the name of the file where your mail is sent. The terminal type that we are using. A list of colon seperated directories that the shell searches for commands Primary system prompt(default is $) Pointer to a file containing Korn shell settings
ravi_aix@yahoo.com
78
sample .kshrc
$ cat .kshrc # set up the command recall facility set o vi # set alias alias alias up aliases l=ls -l p=ps -f up=cd ..
The difference between .profile and .kshrc is that .kshrc is read each time a subshell is spawned whereas .profile is read once at login.
79
ravi_aix@yahoo.com
ksh features-Aliases
The alias command invoked with no arguments prints the list of aliases in the form name=value. The unalias command will cancel the alias named and removes it from the alias list. $ alias p=ps -ef $ alias l=ls -l $ alias history=fc -l l=ls -l p=ps -ef r=fc e- $unalias l $ l ksh: l: not found
80
ravi_aix@yahoo.com
ksh features-History
The last 128 commands are stored in $HOME/.sh_history. The r command allows you to recall previously entered commands. $ 2 3 4 5 fc l cd /home/list ls l fc l mail lists the last 16 commands
$ r m No mail for team01 $ r 3 -rw-r-r john staff 345 aug 23 12:35 fileout
81
ravi_aix@yahoo.com
82
ravi_aix@yahoo.com
$find . name m* exec -rw-r-r john staff 45 -rw-r-xr john staff 465 -rwxrwr john staff 12
The command following exec (ls) is executed for each file name found. \; is hard coded with the find command and is required for use with exec and ok.
83
ravi_aix@yahoo.com
84
ravi_aix@yahoo.com
Additional Options
-type -size f d +n -n n +x -x onum mode user ordinary file directory larger than n blocks smaller than n blocks equal to n blocks modified more than x days ago modified less than x days ago access permissions match onum access permissions match mode values find files owned by user logical or
ravi_aix@yahoo.com
85
find examples
$find . name s* type f size +2 exec ls l {} \; -rw-r-r john staff 3545 aug 23 11:35 sum.out -rwxr-r john staff 4543 aug 11 23:12 ss.out $find . perm 644 mtime +4 print ./impfiles/misc $find . name imp o name misc ./files/misc ./imp $find / name securityprint 2> err.out /var/security /usr/lib/security
86
ravi_aix@yahoo.com
The links +1 option lists the files that have more than one link associated with them.
ravi_aix@yahoo.com
87
HW
800 322-4500
$ps ef | grep team01 team01 10514 13254 0 09:54:55 pts/1 0:00 -ksh
88
ravi_aix@yahoo.com
Valid metacharacters . * [aA] any single character zero or more occurences of the preceeding character Enumeration: a or A any one of the char between a to f Any lines that start with a Any lines that end with a z
ravi_aix@yahoo.com
[a-f] ^a z$
89
grep examples
$ps ef | grep team01 team01 10514 13254 0 09:54:55 pts/1 0:00 -ksh $grep ^B phone1 Baker jim $grep 5$ phone1 Avis Betty $grep ^[DH] phone1 Dade travel sam Hotline HL
^ - start
454-3414
$ - end
125-4625 434-5643 322-4500
[DH] - enumeration
90
ravi_aix@yahoo.com
grep options -v -c -l -n -i -w print lines that do not match print only a count of matching lines print only the names of the files with matching lines number the matching lines ignore case senitivity do a whole word search
91
ravi_aix@yahoo.com
egrep
$egrep 800|817 phone1 Hotline HW 800 322-3455 sam jim 817 322-3434
92
ravi_aix@yahoo.com
sort command
The sort command sorts lins and writes the result to standard output. $ cat animals dog.2 cat.4 rabbit.7
$ sort animals default sort order cat.4 dog.2 rabbit.7 $ cat animals | sort +0.1 sort by second char., rabbit.7 cat.4 dog.2
ravi_aix@yahoo.com
93
$head -5 ls.out
$tail -20 myfile $tail f /tmp/err.out displays lines as they are added to the file
94
ravi_aix@yahoo.com
xargs
The xargs command reads a group of commands from stdin and runs an AIX command with that group of arguments. Here cat passes xargs the list of files and allows xargs to pass them to rm. The t flag echoes the constructed command line to stderr.
$cat oldfiles file1 file2 file3 file4 $cat oldfiles | xargs t rm rm file1 file2 file3 file4
95
ravi_aix@yahoo.com
$ls > printlist $xargs t qprt < printlist qprt file1 file2 file3 $ls | xargs t I {} mv {} {}.old mv mail mail.old
Here { } is called a placeholder and the I flag tells xargs to insert each line of the ls directory listing where { } appears.
96
ravi_aix@yahoo.com
$ find . type f mtime +30 | xargs t rm rm ./file1 ./file2 ./file3 $ find . type f | xargs t grep l Hello grep l Hello ./file4 ./file7 ./file10
97
ravi_aix@yahoo.com
which,whereis,whence
which command takes a list of program names and looks for the files that are executed when these names are given as a command. whereis also takes a list of program names but only searches in some standard locations. Whence is a ksh-specific command which also searches for ksh aliases.
ravi_aix@yahoo.com
file command
The file command can be used to determine the type of a file. It also tells us under what OS version it is compiled. $file /usr/bin/vi /usr/bin/vi:executable (RISC System/6000) or object module $file cl cl: ascii file $file /usr/bin /usr/bin: directory
99
ravi_aix@yahoo.com
> <
a indicates lines that should be appended to first file to obtain the second file d indicates lines that are missing from second file.
c indicates lines that are changed between the first file and second file.
100
ravi_aix@yahoo.com
cmp (compare)
The compare command works with all types of files and it reads two files until it finds any differences and reports them. $ cmp names names.old names names.old differ: $ cmp l names names.old 6 12 151 7 102 154 .... .... cmp:EOF on names Here the first column is the byte number and the second and third columns are the octal values of the bytes from first file and second file respectively that differ.
101
byte 6,line1
ravi_aix@yahoo.com
Telnet
The tn command allows to login to remote systems.
AIX Version 5 (C) Copyright by IBM and others 1982,1996 login: team01
102
ravi_aix@yahoo.com
FTP
The ftp command allows us to transfer files in a network.
$ftp miami connected to miami 220 FTP server ready Name (miami: team01): team05 Password rewquired for team05. Password: 230 User team05 logged in. ftp>
ftp prompt
ravi_aix@yahoo.com
103
FTP subcommands
The most important ftp subcommands are: ftp> pwd ftp> cd remotedir ftp> dir (or) ls -l ftp> get remotefile [localfile] ftp> put localfile [remotefile] ftp> help [subcommand] ftp> quit get file1 /tmp/file1 put /im/ls.out ls.out
104
ravi_aix@yahoo.com
tape
floppy
tar cvf /dev/fd0 . tar xvf /dev/fd0
disk
tar cvf /tmp/file1.tar . tar xvf /tmp/file1.tar
105
ravi_aix@yahoo.com
The tar options are -c -t -v -f -r -x create table of contents verbose filename extend archive extract
106
ravi_aix@yahoo.com
compress,uncompress,zcat
The compress command compresses a file and replaces the original file with a .z appended to it. $ ls l file1 127 rw-r--r 3 team01 staff 13354 oct 29 12:15 /home/file1 $ compress v filel file1: compression 56.99% file1 is replaced with file1.z $ ls l file1 127 rw-r--r 3 team01 staff 5756 oct 29 12:15 /home/file1 $ zcat file1.z view a compressed file
$ uncompress filel.z $ ls l file1 127 rw-r--r 3 team01 staff 13354 oct 29 12:15 /home/file1
107
ravi_aix@yahoo.com
108
ravi_aix@yahoo.com
Positional Parameters
Parameters can be passed to shell scripts as arguments on the command line $ cat ascript echo first parameter is $1 echo second parameter is $2 echo third parameter is $3 $ ascript good morning friends first parameter is good second parameter is morning third parameter is friends
109
ravi_aix@yahoo.com
expr Utility
The expr utility can be used to perform integer arithmetic. \* multiplication high / integer divison % remainder precedence order + addition subtraction low $ x=6 $ y=3 $ expr $x/$y 2 $ expr $x-$y 3 $ expr \($x+$y)\*4 \(\) to group expressions 36
110
ravi_aix@yahoo.com
conditional execution
The exit value from a command or a group of commands can be used to determine whether to do the next command. command1 && command2 if command1 is succesful then do command2 $ ls s* && rm s* command1 || command2 if command1 is not succesful then do command2 $ cd /dir1 || echo cannot change to dir1
111
ravi_aix@yahoo.com
test command
The test command allows you to test for a given condition. test expression or [ expression ] or [[ expression ]] The test command evaluates the expression and returns true or false. Operator $string1 = $string2 $string1 != $string2 $number1 -eq $number2 $number1 -ne $number2 -a $file -d $file -r $file -w $file
112
Returns true if strings are equal strings are not equal numbres are equal numbers are not equal file exists file is a directory file is readable file is writeable
ravi_aix@yahoo.com
if command
if condition is true then carry out this set of actions else carry out these alternative actions fi
optional
113
ravi_aix@yahoo.com
if command (example)
$ cat active usage=$0: userid if [[ $# -ne 1 ]] then echo proper usage: $USAGE exit 1 fi if who | grep $1 > /dev/null then echo $1 is active else echo $1 is not active fi exit0
114
ravi_aix@yahoo.com
read command
The read command reads one line from stdin and assigns the values of each field to a shell variable.
$ cat delfile # usage: delfile echo please enter the filename: read name if [[ -f $name ]] then rm $name else echo error: $name is not an ordinary file fi
The read command can be used to assign more than one variable. Here if delfile is invoked with more than one filename then then first variable is assigned first filename and so on...
115
ravi_aix@yahoo.com
for loop
for variable in list do commands done
$ cat count for var in ls.out err.out do wc l $var done $ count 12 ls.out 34 err.out $ cat rm_tmp for file in /tmp/* do echo removing $file rm $file done
116
ravi_aix@yahoo.com
While loop
while expression do commands done
$ cat info x=1 while [[ $x lt 9 ]] do echo it is now $(date) echo there are $(ps e | wc -l) processes running echo there are $(who | wc -l) users logged in x=$(expr $x + 1) sleep 600 done
117
ravi_aix@yahoo.com
118
ravi_aix@yahoo.com
X Window
The X-window is a N/W based graphics system. It enables us to work with multiple items simultaneously. It provides the capability to manage local and remote displays. X window uses a client/server environment. So the graphic application can run on one system, yet display its output on another system. X window is platform independent. It allows a keyboard and display attached to one system to use programs running on a completely different system.
119
ravi_aix@yahoo.com
X Window
The X-window is a N/W based graphics system.
X-station RISC workstation RS/6000 Workstation
RS/6000 Workstation
120
RS/6000 server
Intel PC
ravi_aix@yahoo.com
X Window
X window function is split into terminal and application support. Typically the application support runs on a UNIX system and the terminal system can run on any system. The system providing application support is called client and the one providing terminal support is called server. In most cases both will be on the same system. Client is the application that is running and needs to display graphics to a user. Clients recieve keyboard and mouse input from the associated x server. X servers respond to requests from clients and to actions from users.
ravi_aix@yahoo.com
121
X Clients
X clients are the aplications which the users run under the X window system:common X clients are xterm aixterm xclock xcalc xwd mwm Standard terminal emulator IBM AIX terminal emulator displays a clock displays a calculator dumps the image of an x window motif window manager
122
ravi_aix@yahoo.com
X Clients
standard X client command line options are: -bg color -bd color -bw number specifies the color for window background specifies the color for window border specifies window border in pixels Identifies the host server name and the X server display number where the command is to run. specifies the color for the window foreground specifies the normal sized text fontset.
-display Name:Number
123
ravi_aix@yahoo.com
X Server
Each X server controls one keyboard. one mouse and one or more screens. Allows simultaneous access by several clients Performs basic graphic operations Provides information such as fonts and colors Routes keyboard and mouse I/P to the correct clients
124
ravi_aix@yahoo.com
Starting AIXwindow
The startx command is used to start the AIXwindows environment. If the workstation is not an X Station then startx will execute the xinit command. By default startx starts three clients aixterm,xclock and mwm. Any errors occuring during will be logged in a file $HOME/.xerrors. We use <ctrl><alt><backspace> to close AIXwindows and return to command prompt. Some windows like aixterm accept and display information while some like xclock and xcalc simply display information.
125
ravi_aix@yahoo.com
126
ravi_aix@yahoo.com
127
ravi_aix@yahoo.com
xclient
application
xserver
ravi_aix@yahoo.com
xhost command
The xhost command adds and deletes hosts on the list of machines from which the xserver accepts connections. The X server allows connections only from X clients running on the same machine or clients listed in /etc/X0.hosts. The X host command must be executed on the machine to which the display is attached.
$ xhost displays names of hosts allowed access to Xserver add a hostname remove a hostname
129
ravi_aix@yahoo.com
AIXwindows Startup
The xhost command adds and deletes hosts on the list of machines from which the xserver accepts connections. After a customizable script .xinitrc will execute.It starts a users clients and then starts mwm. mwm starts Motif and tailors it according to files .Xdefaults and .mwmrc. Xdefaults file contains a users personal preferences like colors,fonts etc., and can be found in the users $HOME dir. mwmrc is used to customize things like Root menu etc.,
130
ravi_aix@yahoo.com
Customizing AIXwindows
---
.xinitrc
The startx first searches for a file specified by the users XINITRC environment variable. If it is not set (not set by default) then it searches the users HOME dir for a file called .Xinit,.xinit,.Xinitrc,.xinitrc or .xsession respectively to begin X client programs. If these files are not found then it uses the system-wide /usr/lpp/X11/defaults/xinitrc. If a user wishes to customize their own AIXwindows startup env., they should copy the system-wide file into their HOME dir and modify it. The file /usr/lib/X11/rgb.txt contains a list of valid colors which we can use while customizing AIXwindows files.
131
ravi_aix@yahoo.com
Customizing AIXwindows
---
.Xdefaults
Fonts are stored in /usr/lib/X11/fonts and can be listed using $ custom -e font. Most of the customization is done through the use of resources. For example the bgcolor of aixterm,preferred focus policy are all resources. Most of these resources are set in a users .Xdefaults file and they look like object*attribute: value.
$ vi $HOME/.Xdefaults Aixterm*background: grey Aixterm*foreground: navy Aixterm*font: rom10 xclock*update: 1 Mwm*keyboardFocusPolicy: explicit
132
ravi_aix@yahoo.com
Customizing AIXwindows
---
.mwmrc
Root menu,window menu and mouse options can be customized in the .mwmrc file. DO NOT MODIFY SYSTEM-WIDE FILE which can be found in /usr/lpp/X11/defaults/Motif1.2/system.mwmrc. To customize we need to copy this file to our HOME dir and modify it as it will override the system-wide version.
133
ravi_aix@yahoo.com