Sunteți pe pagina 1din 133

‡ UNIX Structure





M

M   



2
‡ 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.

M   




‡ Logging In
 


 


‡ Logging In

  

 

 

M   



=
‡ Passwd
± Passwd command is used to change the user password.

  

  


!  

" 
#   

$

M   



Œ
‡ Command Format
± The general format of an AIX command is
± command option (s) argument (s)

 % & %



 


M   




‡ Date,Cal commands

  
' (  ) *  +,-.) /

  +) /

- 0) /
'-.1.2' 
)3
4+56/*
 ) 3 4 + 5 6
/ *) ) )))3)4
)+)5)6)/)*3 3
M   

D
‡ Clear,echo and banner
± The Clear command clears the terminal window.

  

  ) 
 ) 

7  



M   



å
‡ Who, Finger commands
± The Who and Finger commands are used to find information
about the users.

 
  8+ +4+
9
: 8+ 64

 

9
: 8+ 64

 9

;
9

<0:
:9
' ::7:=
!-  4 3)33)03
" >
M   

 
‡ Sending Mail

 
x -   
0

'79-
. 7 

43) >
 ?
#


 
) @03)x -    0

'79-
< 7
>
 ?
#

M   



Ô
‡ write
± write provides a conversation like communication with each
user alternatively sending and recieving messages.

 9


70)   


  x 
 %



A   9


  x 
 % 
 ? x 

  @0
)3 x   ":1

M   



ÔÔ
‡ wall
± The wall command writes to all terminals and useful to notify all
users of a system event.

 .% 7


)3  0>
‡ talk
± The talk command allows two users to hold a conversation.

 =

%
 
- 
. =< 
@0  0  +)3>>>
 =B709@0
 = =9

 =9  % 


M   

Ô2
‡ Files and Directories
± A file is a collection of data.

 MM

 M

   

     


M   



Ô

‡ File Structure
± AIX has a Hierarchial File Structure.

M   



Ô=
‡ File Structure
± AIX has a Hierarchial File Structure.

M   



Ԍ
‡ File Structure
± AIX has a Hierarchial File Structure.

M   



Ô
‡ File Structure
± AIX has a Hierarchial File Structure.

M   



ÔD
‡ pwd command
± The print working directory prints your current directory

 
:
:

M   



Ôå
‡ list command ls [ directory ]
± The list command is used to list the contents of a directory.

 
77
 >
 ?
>>>> 77
 >
 &
 3
?)
  )4(  + 4+ 7
??)
 + )8 / +4 

M   



Ô 
‡ cd command cd [ directory ]
± The cd command changes our current directory.

 
  % 

 :
:
7  

 
%0
0

 >>
% 0

M   



2
‡ mkdir command mkdir [ directory ]
± The mkdir command creates one or more new directories.


= :
:
:   


 :
:
 % 



= 


= & :):3  
  

M   




‡ rmdir command rmdir [ directory ]
± The rmdir command removes a directory.

 
:
:
:

 


 





0

 
& :):3

M   



22
‡ rmdir command rmdir [ directory ]
± The rmdir command removes a directory.

 
:
:
:

 


 

[M
M  MM



0 

M   



2

‡ display directory info


± The istat command displays the i-node information for a
particular file or dir.
± Every file has an associated § 

± When a file is accessed the filename is matched with the


corresponding i-node number and the data is located.

name i-node  Type mode links User Group Date Size loc
SubdirÔ = = dir DŒŒ 2 jim staff jan Ô ŒÔ2
 Ԍ
myfile Ô jan Ô
Ô file == Ô jim staff  
 Ԍ

 %
0 

M   



2=
  
0
A+ % :/<0
??

) /
,  
;=) ;+ )70

;  - (  6)  +43)


; 
- (  6)  +43)
;  . (  / 3)+43) 

M   




‡ 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.

 

M   



2
‡ copy command cp source target cp fileÔ file2 ... target_dir
± The cp command can be used to copy files and directories.
 
:
:

 :
:
): 77
 &C:
:
x C%0

M   



2D
‡ move command mv source target
± The mv command can be used to move files and directories
and also rename them.
 
:
:


% >

M   




‡ cat, pg and more commands
± The cat command lists a file but if the file is longer than one
screen space it scrolls down to the end of the file.
± The pg command displays the file one page at a time.
± The more command also works the same way but you can
scroll one line at a time by pressing ÿ  and one screen at a
time by pressing the  .

  
   

>
  %>

 




M   




‡ wc command wc [-c] [-l] [-w] filename
± The wc command counts the number of lines,words and bytes in a
named file.
± This command is very useful when comparing files.

 ?  7$ 
+ +4**5 7$ 

"M
! M
M

°

± If no options are used the order will be lines,words and characters

M   




‡ 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.

 
:
:

  7:
:
):0D

M   




Ô
‡ print command qprt filenameÔ filename2
± 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.
 B > >
B& )
 x 0 ?  

 B=
E<%' (72 FGH =C=
@ @  
    

B  )3

97
7
M   


2
‡ File protection/permissions

 ?
???)
  )49  ) 3+

M  M M


   M
 

 M 
 M
M  


  

M   




‡ File protection/permissions

 ?
???)
  )49  ) 3+

??

M 

#M
????   #"M
#"M& $%
$%
????  'M
$%
???? 

$ %
M   


=
‡ Changing permissions

M   




Œ
‡ symbolic notation; 

 

 ?
???)
  )49  ) 3+

????  
??? 

???? 
? ??? 
%

????  
I???   


??? 
???   ???
??? 

 
?
????? )
  )49  ) 3+

M   





‡ octal notation; 

 
 F  !
???? 4 ??
???? )
????

4) I6 4)I5
4 I+
 ?
??? )
  )49  ) 3+
j
 M  M   §  M  M 
 § M (

 
664
 &
??? )
  )49  ) 3+

M   




D
‡ 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 22 which is set in /etc/security/user.

 
=
))

M   




å
‡ The Vi editor

 % 
J
J
J
J
J
J
  K" L

„& ")*
M 

M   




 
‡ The Vi editor
 % 
J o represents empty lines
J
J The editor starts in command mode
J
J
J
  K" L

M   



=



‡ The Vi editor
 %  ??  
J 8??  
J ??  
J A??    
J
J ..#M.-!<# #
J
  K" L 

!MM+ x  

ü
M   


‡ The Vi editor




BN?? B %


??    0
B
??   B
?DD

??      


??  
??   
 ??    
??    
) O4 ??     ) O4  

7
??   
M   

=2
   
‡ The Vi editor
:x   
Px  7 = 
x  

"x  


, 7 C 

: 7:::0D:  7 0D 
 

00x 0  


x   

M   



=

‡ vi options
± we can change the behaviour of vi by setting some options.
± options are stored in the file $HOME/.exrc
  0 
   
   
  7  
7
  7  
7
   0? 7   
  ? 7   
  %0
  %

M   



==
‡ 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.

&%

% x 

   0

M   




‡ vi EDITORS
± There are various forms of vi.

M ,M M&M   M 


  "M 
 

M   



=
‡ SHELL Basics
± The Shell is the primary interface between the user and the OS.

M   



=D
‡ Metacharacters and Wildcards
± These are characters that the shell interprets as having a special
meaning.
± These should not be used as a part of any filename.
± Wildcards are used to search for and match file patterns.

M   




‡ Examples
 P
 x P 70 

 PP 0     
>


 Q
)>

 KL


M   




‡ Standard files and Redirection
± Three files are automatically opened for each process.

± standard input ( ) x default is keyboard ---- stdin <

± standard output (Ô) ---- stdout >


± x default is screen
± standard error (2) ---- stderr 2>

± These defaults can be changed by redirection.

  > x 


 
  x 

  7) x 


M   

Œ
‡ Pipes
± A pipe is a sequence of one or more commands where the
i  of one command becomes the i § of the next
command.
  7R&
)4
‡ Filters
± A filter is a command that reads from i §, processes it and
then writes it to i 

 & R R&

-M
M   

ŒÔ
‡ Tee
± The tee command reads i § and sends the data to both
i  and a file.

 & R:
: >R&

  
, "
,
MM 
 

:
: >
M   

Œ2
‡ command grouping
± Multiple commands can be entered on the same line seperated
by a semi-colon.
 &C >S 
‡ Line continuation
± \ can be used to continue a command on a seperate line.
± A µ>¶ prompt id issued by the shell to indicate line continuation.

 :
:
0:
 :
 )T
:
:9
:
:  >

M   



Œ

‡ 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.

 x  00

U!-#â   
8.Uâ        
' I
')I
'U#;;â   
.#C-â  
$

M   



Œ=
‡ Setting and Referencing Shell Variables

'U#;;I::7:7 x  %  


 %  7 

0I
0 x  %  7 


0 x   %  7 

0I 0

0

 0

M   



ŒŒ
‡ Commmand substitution
 
. 3!)343++) /
 I 

. 3!)343++) /

M   



Œ
‡ Quoting Metacharacters

± µ µ Single Quotes Ignores all metacharacters


between the quotes.
VU!-#
U!-#

± ³ ³ Double Quotes Ignore all metachar., except for


$,` and \
U!-#
:
:

± \Backslash Ignore the special meaning of
the following character
TU!-#
U!-#

M   



ŒD
‡ 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 Ô is always assigned to the §§ 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.

A< A<
  ) +
  ) 5 ) +
   ) 6 )


43+3

M   



Ό
‡ The Login Process
± When a user logs into a system a new process is started with a
PID that is randomly allocated by the Kernel.
± The program usr/bin/ksh is loaded into this process.

„[ ,

° M 

M   



Œ 
‡ Variables and Processes
± w §  iare part of the process environment
Processes
cannot access or change variables from another process.

I4
=



I
 ?

4
± 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.
M   


‡ Exporting variables

I4
0I5
0  M M
S0 
4
5
=


0 
5
0I  M M
 ?
0
5
M   


‡ 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.

  
 0 
 ÷ 

=  x 
 0-8 )) / )34
:
:

M   



2
‡ Invoking Shell Script
± The shell uses the PATH variable to find executable programs.
± The directory in which the script is stored must be defined in
the path variable.

  
 0 



  

  x 
 0-8 )) / )34
:
:

M   





‡ Invoking Shell Script


± Each Shell Script is executed in a subshell.
± Variables defined in a shell script cannot be passed back to the
parent shell.
± If the script is invoked with a .(dot) it runs in the current shell.

  
 0 
 

>  x 
 0-8 )) / )34
:
:

M   



=
‡ Exit Codes
± A command returns an exit value to the parent process.
± The environment variable $? contains the exit value of last
command.




-,. MMM 

M

::0
=::0

P

M   




‡ ps command
± The ps command displays process status information.
?
FA<A<A<>>>..W>>>!--8"<
9
) + >>>0 >>> 
9
) 5) +>>>0 >>> 

? x 2F;; 

? x  0 7%0


0

&  x ; 

&
+x  


+
M   


‡ Types of Processes
± Processes that are started from and require interaction with the
terminal are called -    iii.
± Processes that can run independently are called   
 iii

&>x 7 =

M   



D
‡ Terminating Processes

= ) )x .


  
= ?*) +x =  

M   




‡ Termination Signals
' - 

   


 

) A   ?




3 E  B=0


 ?T

* X  ^  

+ .
  <  

M   




‡ Running long processes
± The nohup command will prevent a process from being killed if
you log off the system before it completes.
± If you do not redirect output, nohup will redirect output to a file
nohup.out
± nohup tells the process to ignore signals Ô and
.

 &C: >Y


K L 34
$

 &C:
K L 34
>
$

M   



D
‡ Job control

97 x ;97
K LC &C: >

 ?D x ' 97

G x 97

7G x 977 =

= G x =  97

M   




‡ 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.

M   



D2
‡ User Environment ± Login Files
± The first file that the OS uses at login time is the
/etc/environment file which contains variables specifying the
basic environment for all processes.

± The second file is the /etc/profile file which controls system-


wide default variables.

± The third file is the .profile file which resides in a user¶s login
login directory and enables the user to customize their working
environment.

M   



D

‡ User Environment ± Login Files

M


 

M     

M


 

M    

M


 
/ #+0 M M

M   



D=
‡ sample /etc/environment
 ::%


Z18C"A",.  0 7 


Z%
%  7 >#



Z  0  7%
0   
Z D >

8.UI::7:::7::7::7:M :7
.[I#'.+#<.
;8",I
;!8.UI:: 7: : 
";'8.UI:: 7: :
:G;:G":: 7: :
:G;:G"> 

M   




‡ sample /etc/profile
 :: 

Z'0
? >8 %  7 
07
Z%70   >  
ZU!-#0>U% 

 7
Z    >

  0;!,"8-#

= ))
.-!F.I )
-8A;I:: :
 :;!,"8-#
-8A;-',IKW!FU8\#"#1-8A;L
.#C-?7
3 +

;!,"8-#-8A;-8A;-',.#C-.-!F.

M   



D
‡ sample .profile
 > 

8.UI:7::7:U!-#:7

' IV1<I

K?-8A; L

-8A;-',

#"\IU!-#:>= x   %0


 
= 

8.U' #"\

M   



DD
‡ Environment Variables
;!,"8-# x A  ? 0%  7  
0 
>
.-!F. x .
 
  
700
>
-8A; x U 
 0
 
>

.#C- x .
 0  >

.#C- x 8    


  



' x 
00

  

#"\ x    X 



M   


‡ sample .kshrc
 >=

Z

   0

&%

Z  
  IV ?
 IV?
 IV>>

± The difference between .profile and .kshrc is that .kshrc is read each
time a subshell is spawned whereas .profile is read once at login.

M   




‡ 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.
  IV?
   IV ?

  
0IV?
IV ?
IV?
IV&?

  


= 
M   

å
‡ ksh features-History
± The last Ô2å commands are stored in $HOME/.sh_history.
± The r command allows you to recall previously entered commands.

& x   5


):
: 
3 &
4&
+




"
 

3
???]& 9 34+ )3 )3+ 

M   



åÔ
‡ AIX Utilities

‡ find command (find path expression)


± Searches one or more dir structures recursively for files
meeting certain specified criteria and displays those filenames
or executes commands against them.

>&

?
>: :

>: :

M   



å2
‡ Executing commands with find
± The exec command executes a command on each of the files
found.

>&
V
Q & & ^_TS
???]& 9 4+ )3 3+ 
???& 9 45+ )3)3 >
?]& 9  ) )3 3 )

± 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.

M   



å

‡ Interactive command execution


± The ok option causes command execution on an interactive
basis.

>&

TQ&=
^_TS

>>>>: :
P0

>>>>: :

P0

>>>>:
P

M   



å=
‡ Additional Options
?0  x  0 
x 0

?D  x  7 =


? x 
 7 =
x B 7 =

?

  x

  0 
? x
   0 

?

x 




x 


 % 

? x  70


? x  

M   



åŒ
‡ find examples
>&
VQ &0&D)& & ^_TS
???]& 9 3+4+ )3 3+
>
??]& 9 4+43  )3 )>

>&
544&

4&
>:
 :


>&

&&


>: :

>:


:&
V0 &)>
:% :0
:: 7:0

M   



å
‡ find with the ±links option
:
&0& = R  & 

)6&???& 3
  +5)* ) +:
: 
)6&???& 3
  +5)* ) +:
: 0
)6&???& 3
  +5)* ) +:
: 0)

 ,   


 
‡ The ±links +Ô option lists the files that have more than one
link associated with them.

M   



åD
‡ grep command (grep [options] pattern [fileÔ file2....])
± Searches for lines matching specified pattern and also displays
the name of the file containing the pattern.

/ 
U  U1/ 3))?4+

&R


 + 4 3)+4  *+4++:   ?=

M   



åå
‡ grep with regular expressions
± When * is used with the grep command ti will match zero or
more occurences of the previous character.
\ 
   

> x 0   

Q x D

  
K 8L x #
  8

K ?L x 0 7 

` x 80   

D x 80   D


M   

å 
‡ grep examples
&R


 + 4 3)+4  *+4++:   ?=

V`H  ®,  M


H = 9
4+4?34 4

V+  /, 


8% H0 )+?45)+

V`K<UL 
<  % 
434?+543 1[ 2,  M 
U  U; 3))?4+

M   



 
‡ grep options

?% x   




? x  0  


 
?  x  0
  

 

? x 
7
 

?x  %0

? x    

M   



 Ô
‡ Other greps
‡ fgrep x fast grep x only fixed strings;no expressions
VU1 
U  U1 / 3))?34++x   0 

‡ egrep x Extended grep x allows multiple patterns

V/ R/ 6  x   0 


U  U1 / 3))?34++

9
/ 63))?3434

M   



 2
‡ sort command
± The sort command sorts lins and writes the result to standard
output.
  

>)
 >4
 77>6
 
   
 >4
>)
 77>6
  
R > 70 >O
 77>6
 >4
>)

M   



 

‡ head and tail commands


± head command can be used to view the first few lines of a file
or files.
± tail command displays a file beginning at a specified point and
displaying a specified number of lines.

 ?+ >x  + 

  ?) 
0 
  &:
:>x  0  
0   

M   



 =
‡ 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.

   
 
 )
 3
 4

   R &


   ) 3 4

M   



 Œ
‡ xargs more examples
± Here we create a list of files to be printed and queue them up for
printing through xargs.
  
 &B 
B   ) 3

 R &&A^_
%^_^_> 

%
 
 > 

± Here { } is called a placeholder and the ±I flag tells xargs to insert


each line of the ls directory listing where { } appears.

M   



 
‡ xargs,find and grep
± Using xargs is more efficient and easier to remember than the
find commanad

>&0&

3 R &


>:  >: )>: 3

>&0R && U 


& U >: 4>: 6>: 

M   



 D
‡ 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.

::7:


::7:


::7:

M   



 å
‡ 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.
 ::7:%
::7:% 7 CA''0
:5 79
 

 
   

 ::7
::7 0

M   



  
‡ diff (Differential File Comparator)
± The diff command works only with text files and and reports the
differences between the two files.



>      


 
! M
3 6
M
ü

5
4 + M
????
[ 
   + M
43
<
+ + a x indicates lines that should be appended to first file to
'
obtain the second file
d x indicates lines that are missing from second file.
c x indicates lines that are changed between the first file
and second file.

M   



Ô
‡ cmp (compare)
± The compare command works with all types of files and it
reads two files until it finds any differences and reports them.




> 


> 705O 


& 

> 
5 ) +
6 ) +4
>>>>
>>>>

#!2


± 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.

M   



Ô Ô
‡ Telnet
± The tn command allows to login to remote systems.



.0>>>



>>>

8AM\+
070AH-  */)O **5


M   



Ô 2
‡ FTP
± The ftp command allows us to transfer files in a network.






)) 2.% 0
"




+
 B
+>
 
)3 F
+ >


M 

M   



Ô

‡ FTP subcommands
± The most important ftp subcommands are





 ?


 K   L  :
: 

   K
 L:
: > >

 K7

L

B

M   



Ô =
‡ tar Backup and Restore files
± tar(tape archiver) saves files recursively and stores them as
one archive file.
 
 &%:%:
 >  &%:%:



 &%:%: > &%:%:


 &%:
:  > > &%:
:  > 

M   



Ô Œ
‡ tar more options
± If the .(dot) is specified then the files are saved relatively which
allows you to restore the files in a new directory.

.  

?  
?  7 
?% %7
?  

?  %
?  

. % 
 &%:%:


M   



Ô 
‡ compress,uncompress,zcat
± The compress command compresses a file and replaces the original
file with a .z appended to it.
 &  
)6&???& 3
  33+4 )* ) +:
: 


&% 
  
+5>**G     >D

 &  
)6&???& 3
 +6+5 )* ) +:
: 

D   >D x % 


 


  >D

 &  
)6&???& 3
  33+4 )* ) +:
: 
M   

Ô D
‡ Additional Shell Features---Important Shell Variables
± These variables are set by the shell or a shell script.
 x A<

 x 
 0 

Z x >O 
  

Q x 8 

?  


 

P x #%  



N x A< 7 =

M   



Ô å
‡ Positional Parameters
± Parameters can be passed to shell scripts as arguments on the
command line

  
 

 
)
 
3

 

 

 


 


M   



Ô  
‡ expr Utility
± The expr utility can be used to perform integer arithmetic.
± \* x multiplication 
±/ x integer divison
±% x remainder M

MM
±+ x addition
±- x subtraction "
I5
0I3
:0
)
?0
3
T0TQ4 x TT
35

M   



ÔÔ
‡ conditional execution
± The exit value from a command or a group of commands can be
used to determine whether to do the next command.


 -77
 .
§ 
 §  

 

 QYY
Q


 -88
 .
§ 
 §
  

 

: RR  

M   



ÔÔÔ
‡ test command
± The test command allows you to test for a given condition.

M
 1M2
 11M22

 §
  
 
#M M 9MM
$stringÔ = $string2 strings are equal
$stringÔ != $string2 strings are not equal

$numberÔ -eq $number2 numbres are equal


$numberÔ -ne $number2 numbers are not equal

-a $file file exists

-d $file file is a directory


-r $file file is readable
-w $file file is writeable
M   

ÔÔ2
‡ if command

M


MM



MM M 
  


‡ The exit statement is used to terminate a process.

M   



ÔÔ

‡ if command (example)

  %
 I 

KKZ? LL

 F'8,#



R :%:

  %
 
  %




M   



ÔÔ=
‡ read command
± The read command reads one line from stdin and assigns the values
of each field to a shell variable.
   

Z   
   

 

KK?
LL




 

  0 


± 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...

M   



ÔԌ
‡ for loop

M M  




 


   


$

%  >>  :
:Q
 
& %  
% 
 
 


) >
34>

M   



ÔÔ
‡ While loop

"M


 


 
I
 KK& *LL

 
 &R? 
 R?  
I 
 5


M   



ÔÔD
‡ command search order
‡ The shell looks for a in the following order.

Qualified pathname

Reserved word
if,then,else,while...etc.,

alias

built-in command
cd,pwd,umask,read...etc.,

Function

path variable

M   



ÔÔå
‡ 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.

M   



ÔÔ 
‡ X Window
± The X-window is a N/W based graphics system.

:,  9„!"M  9 ; M 

„!
9 ; M  9 ; MM
M   

Ô2
‡ 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.

M   



Ô2Ô
‡ X Clients
± X clients are the aplications which the users run under the X window
systemcommon X clients are

xterm x Standard terminal emulator

aixterm x IBM AIX terminal emulator

xclock x displays a clock

xcalc x displays a calculator

xwd x dumps the image of an x window

mwm x motif window manager

M   



Ô22
‡ X Clients
± standard X client command line options are

,   x specifies the color for window background

,   x specifies the color for window border

,"  x specifies window border in pixels

,  m m x Identifies the host server name and the X


server display number where the command is
to run.

,   x specifies the color for the window foreground

,  x specifies the normal sized text fontset.

M   



Ô2

‡ 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

M   



Ô2=
‡ Starting AIXwindow
± The  command is used to start the AIXwindows environment.

± If the workstation is not an X Station then  will execute the § §
command.

± By default startx starts three clients §  ,  and .

± Any errors occuring during will be logged in a file / #+0 MMM.

± 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.

M   



Ô2Œ
‡ The aixterm Window
± An aixterm can be started in two ways
± In SHELL x §
± Display ´

  and select §




± To create an additional aixterm window enter § at the


command prompt.

± The aixterm window can be closed by


± Type § or 

M   



Ô2
‡ Running a Client on Another System
± With AIXwindows it is possible to run a client on a remote system in
the network yet display the application window on your screen.

± we need to tell the client process where to display its window.

± AIXwindows uses the DISPLAY environment variable to indicate the


name of the server where it should display its output.

± To override this value we need to specify a value using the < 


flag when starting the client.

± The value is generally 


for local severs or sysfor a remote
server.

M   



Ô2D
‡ Running a Client on Another System
± Here sys2 runs the client application(aixterm) while sysÔ needs to
display the output.

.
-

0) 
& 00 

M  
 
 MM



 
M   

Ô2å
‡ 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/X .hosts.
± The X host command must be executed on the machine to which the
display is attached.

 x  0


  
M%


x  


& 
x 
% 


M   



Ô2 
‡ 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 user¶s
clients and then starts mwm.
± mwm starts Motif and tailors it according to files .Xdefaults and
.mwmrc.
± Xdefaults file contains a user¶s personal preferences like
colors,fonts etc., and can be found in the user¶s $HOME dir.
± mwmrc is used to customize things like Root menu etc.,

M   



Ô

‡ Customizing AIXwindows --- .xinitrc


± The startx first searches for a file specified by the user¶s XINITRC
environment variable.

± If it is not set (not set by default) then it searches the user¶s 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/XÔÔ/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/XÔÔ/rgb.txt contains a list of valid colors which we


can use while customizing AIXwindows files.

M   



Ô
Ô
‡ Customizing AIXwindows --- .Xdefaults
± Fonts are stored in /usr/lib/XÔÔ/fonts and can be listed using

?.
± Most of the customization is done through the use of i i.
± For example the bgcolor of aixterm,preferred focus policy are all
resources.
± Most of these resources are set in a user¶s .Xdefaults file and they
look like object*attribute value.

%U!-#:>M  
8
Q7 = 0
8
Q  %0
8
Q 

 =Q 
-
Q=07 2 0 

M   



Ô
2
‡ 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/XÔÔ/defaults/MotifÔ.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.

M   



Ô