Applications
Shell
kernel
H/W
ravi_aix@yahoo.com
2
• Kernel
– The Kernel interfaces directly with the hardware devices and
controls their access.
– It also controls the processes that are started by users.
ravi_aix@yahoo.com
3
• Logging In
$ login: team01
team01’s Password:
$
• Logging In
$ <ctrl+d> (or)
$exit (or)
$logout
ravi_aix@yahoo.com
4
• Passwd
– Passwd command is used to change the user password.
$ passwd
$ _
ravi_aix@yahoo.com
5
• Command Format
– The general format of an AIX command is
– command option (s) argument (s)
$ lsvg –l rootvg
ravi_aix@yahoo.com
6
• Date,Cal commands
$ date
Sat Jan 12 09:11:15 GMT 2008
$ cal 5 2008
May 2008
Sun Mon Tue Wed Thu Fri Sat
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
ravi_aix@yahoo.com
7
• Clear,echo and banner
– The Clear command clears the terminal window.
$ clear
$
$ echo dinner is at 20:00
$ dinner is at 20:00
$
$ banner hello
$
$
ravi_aix@yahoo.com
8
• Who, Finger commands
– The Who and Finger commands are used to find information
about the users.
$ who
root lft0 Aug 5 05:45
jim pts/0 Aug 5 07:40
$ who am i
jim pts/0 Aug 5 07:40
$ finger jim
Login name: jim
Directory: /home/jim Shell: /user/bin/ksh
On since Mar 04 13:23:32 on tty3
No Plan.
ravi_aix@yahoo.com
9
• 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>
ravi_aix@yahoo.com
10
• write
– write provides a conversation like communication with each
user alternatively sending and recieving messages.
$ write jim
<enter>
reboot sys2 at noon <enter> sam’s terminal
o <enter> o means over
$ write sam
I’ll do that <enter> jim’s terminal
oo <enter> oo means over and out
<ctrl-d> to end session
ravi_aix@yahoo.com
11
• wall
– The wall command writes to all terminals and useful to notify all
users of a system event.
$ talk fred
Usually represent
contains text or code contains a list of files. devices used by the
data system.eg., /dev/cd0
ravi_aix@yahoo.com
13
• File Structure
– AIX has a Hierarchial File Structure.
ravi_aix@yahoo.com
14
• File Structure
– AIX has a Hierarchial File Structure.
ravi_aix@yahoo.com
15
• File Structure
– AIX has a Hierarchial File Structure.
ravi_aix@yahoo.com
16
• File Structure
– AIX has a Hierarchial File Structure.
ravi_aix@yahoo.com
17
• pwd command
– The print working directory prints your current directory
$ pwd
/home/team01
ravi_aix@yahoo.com
18
• list command ls [ directory ]
– The list command is used to list the contents of a directory.
$ ls
bb manuals dec.out
$ ls -a
. .. .profile bb manuals dec.out
$ ls –l
total 3
drwxrwxr-x 2 team01 staff 1024 Jan 15 10:45 abc
-rwxrwxr-x 2 team01 staff 512 Aug 18 15:40 ssa
ravi_aix@yahoo.com
19
• cd command cd [ directory ]
– The cd command changes our current directory.
ravi_aix@yahoo.com
20
• mkdir command mkdir [ directory ]
– The mkdir command creates one or more new directories.
$ mkdir test
ravi_aix@yahoo.com
21
• rmdir command rmdir [ directory ]
– The rmdir command removes a directory.
$ rmdir /home/team01/aaa
$ cd home
$ rmdir team01
rmdir: team01 not empty
$ rmdir –p dir1/dir2/dir3
ravi_aix@yahoo.com
22
• rmdir command rmdir [ directory ]
– The rmdir command removes a directory.
$ rmdir /home/team01/aaa
$ cd home
ravi_aix@yahoo.com
23
• display directory info
– The istat command displays the i-node information for a
particular file or dir.
– Every file has an associated i-node number.
– 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
Subdir1 4 4 dir 755 2 jim staff jan 10 512
myfile 10 9:15
$ vi myfile
ravi_aix@yahoo.com
24
$ istat mydir
Inode 51 on device 10/8 Directory
Protection: rwxr-xr-x
ravi_aix@yahoo.com
25
• 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
ravi_aix@yahoo.com
26
• copy command cp source target cp file1 file2 ... target_dir
– The cp command can be used to copy files and directories.
$ pwd
/home/team01
$ cp /home/team02/aa bb
$ cp –R /home/team01 Recursive copy
ravi_aix@yahoo.com
27
• move command mv source target
– The mv command can be used to move files and directories
and also rename them.
$ pwd
/home/team01
$ mv test test.out
ravi_aix@yahoo.com
28
• 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 Enter and one screen at a
time by pressing the space bar.
$ 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
• 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.
$ wc -lcw abc_file
15 154 996 abc_file
words
Characters
Lines
$ pwd
/home/team01
$ ln abc /home/team02/xyz
ravi_aix@yahoo.com
31
• print command qprt filename1 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.
$ qchk
Queue Dev Status Job Files User PP% Blks Cp Rnk
lp0 lp0 Running 99 aa jim 1 1 1 1
$ qcan 23
job number
ravi_aix@yahoo.com
32
• File protection/permissions
$ ls -l
-rwxr-xr-x 2 team01 staff 1024 jan 12 10:35 test
ravi_aix@yahoo.com
33
• File protection/permissions
$ ls -l
-rwxr-xr-x 2 team01 staff 1024 jan 12 10:35 test
Permission bits
Others
r ---- read Owner
Owner’s (o)
(u)
w ---- write Group
(g)
x ---- execute
all
(a)
ravi_aix@yahoo.com
34
• Changing permissions
ravi_aix@yahoo.com
35
• symbolic notation; chmod mod filename
$ ls -l
-rwxr-xr-x 2 team01 staff 1024 jan 12 10:35 test
u --- owner
g --- owner’s group a --- all
o --- others
ravi_aix@yahoo.com
36
• octal notation; chmod mod filename U g O
r ---- 4 rwx r-x rw-
w ---- 2
x ---- 1
4+2+1=7 4+2=6
4+1=5
$ ls -l
-rwxr-xrw- 2 team01 staff 1024 jan 12 10:35 test
To change permissions so that group also has write perm., and others do not have
write perm:
ravi_aix@yahoo.com
37
• 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
ravi_aix@yahoo.com
38
• The Vi editor
$ vi tstfile
~
~
~
~
~
~
“tstfile” [New file]
ravi_aix@yahoo.com
39
• The Vi editor
$ vi tstfile
~ ~ represents empty lines
~
~ The editor starts in command mode
~
~
~
“tstfile” [New file]
ravi_aix@yahoo.com
40
commands
• The Vi editor
$ vi tstfile a -- add text after cursor
~ A -- add text to the end of line
~ i -- insert text at the cursor
~ I -- insert text at the start of line
~
~ To exit TEXT MODE press <Esc>
~
“tstfile” [New file]
k
Cursor Movement
h l
j
ravi_aix@yahoo.com
41
• The Vi editor more commands
Global Replacement
:g/abc/s//xyz/g replaces “abc” with “xyz”
throughout the entire file
yy copy a line
p paste the copied line
ravi_aix@yahoo.com
43
• vi options
– we can change the behaviour of vi by setting some options.
– options are stored in the file $HOME/.exrc
:set all display all settings
:set ai set autoindent on
:set noai set autoindent off
:set nu enable line numbers
:set nonu disable line numbers
:set list displays non-printable characters
:set nolist hide non-printable characters
:set ic ignore case sensitivity
:set noic case sensitive
ravi_aix@yahoo.com
44
• 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.
$ set –o vi
ravi_aix@yahoo.com
45
• vi EDITORS
– There are various forms of vi.
ravi_aix@yahoo.com
46
• SHELL Basics
– The Shell is the primary interface between the user and the OS.
ravi_aix@yahoo.com
47
• 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.
ravi_aix@yahoo.com
48
• Examples
$ ls ne?
net new ? is expanded by the shell to match
$ ls ?e? any single character in a filename.
few new den
$ ls n*
net new no node2.out
$ ls ne[stw]
net new
ravi_aix@yahoo.com
49
• Standard files and Redirection
– Three files are automatically opened for each process.
$ ls –l | grep “d” | wc –l
Filter
ravi_aix@yahoo.com
51
• Tee
– The tee command reads stdin and sends the data to both
stdout and a file.
$ ls –l | tee /tmp/ls.out | wc –l
mail.txt tee
ls -l wc -l
err.out
ast.pdf
/tmp/ls.out
ravi_aix@yahoo.com
52
• command grouping
– Multiple commands can be entered on the same line seperated
by a semi-colon.
$ ls –R > ls.out ; cat aa
• Line continuation
– \ can be used to continue a command on a seperate line.
– A ‘>’ prompt id issued by the shell to indicate line continuation.
$ cat /home/mydir/mails/mail2 \
> /home/jim/imp/data.txt
ravi_aix@yahoo.com
53
• 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.
HOME=/home/team01
PATH=/bin:/usr/bin:/etc:/home/team01/bin:
PS1=$
PS2=>
SHELL=/usr/bin/ksh
TERM=ibm3151
$_
ravi_aix@yahoo.com
54
• Setting and Referencing Shell Variables
$ xy=hi friends
$ echo $xy referencing a variable
hi friends
$ xy=day
$ echo tomorrow is sun$xy
tomorrow is sunday
ravi_aix@yahoo.com
55
• Commmand substitution
$ date
Thu 13 Oct 23:43:55 2008
$ now=$(date)
$ echo $now
Thu 13 Oct 23:43:55 2008
ravi_aix@yahoo.com
56
• Quoting Metacharacters
ravi_aix@yahoo.com
57
• 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.
PID PPID
$ ls 205 1
$date 206 205
$clear 207 20
$echo $$
4353
ravi_aix@yahoo.com
58
• 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.
PID=345 -ksh
ravi_aix@yahoo.com
59
• Variables and Processes
– variables are part of the process environment.Processes
cannot access or change variables from another process.
$ x=4
$ ksh
$echo $x
Subshell
$x=1
$<ctrl-d>
$echo $x
4
$ x=4
$ y=6
$ export y variable is exported to
$echo $x; echo $y subshell
4
6
$ksh
$echo $x
$echo $y Subshell
6
$y=11 variable is not exported
<ctrl-d>
$echo $y
6
ravi_aix@yahoo.com
61
• 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 Subshell
ravi_aix@yahoo.com
62
• 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.
$ cat hello
echo “hi friends today is $(date)”
pwd
ravi_aix@yahoo.com
63
• 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.
$ cat hello
echo “hi friends today is $(date)”
pwd Subshell
ravi_aix@yahoo.com
64
• Exit Codes
– A command returns an exit value to the parent process.
– The environment variable $? contains the exit value of last
command.
0 = Success
1-255 = An error has occured
$ cd /etc/security
ksh: /etc/security: permission denied
$ echo $?
1
ravi_aix@yahoo.com
65
• ps command
– The ps command displays process status information.
$ps -f
UID PID PPID ... TTY ... COMMAND
jim 205 1 ... tty0 ... ls
jim 206 205 ... tty0 ... date
ravi_aix@yahoo.com
67
• Terminating Processes
ravi_aix@yahoo.com
68
• Termination Signals
Signal Meaning
ravi_aix@yahoo.com
69
• 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 01 and 03.
$nohup ls –R /
[1] 34
sending output to nohup.out
$_
ravi_aix@yahoo.com
70
• Job control
ravi_aix@yahoo.com
71
• 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.
ravi_aix@yahoo.com
72
• 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 third file is the .profile file which resides in a user’s login
login directory and enables the user to customize their working
environment.
ravi_aix@yahoo.com
73
• User Environment – Login Files
root
can only be changed
/etc/environment by system admin
root
can only be changed
/etc/profile by system admin
User
can be changed by the
$HOME/.profile user
ravi_aix@yahoo.com
74
• sample /etc/environment
$ cat /etc/environment
PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin
TZ=EST5EDT
LANG=C
LOCPATH=/usr/lib/nls/loc
NLSPATH=/usr/lib/nls/msg/%L/%N:/usr/lib/nls/msg/%L/%N.cat
ravi_aix@yahoo.com
75
• sample /etc/profile
$ cat /etc/profile
readonly LOGNAME
umask 022
TMOUT=120
MAIL=/usr/spool/mail/$LOGNAME
MAILMSG=“[YOU HAVE NEW MAIL]”
TERM-ibm3151
ravi_aix@yahoo.com
76
• sample .profile
$ cat .profile
PATH=/bin:/usr/bin:/etc:$HOME/bin:
PS1=‘ $PWD=> ’
if [ -s “$MAIL” ]
then
echo “$MAILMSG”
ravi_aix@yahoo.com
77
• Environment Variables
set –o vi
# set up aliases
alias l=‘ls -l’
alias p=‘ps -f’
alias 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.
ravi_aix@yahoo.com
79
• 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
ravi_aix@yahoo.com
80
• ksh features-History
– The last 128 commands are stored in $HOME/.sh_history.
– The r command allows you to recall previously entered commands.
$ r m
No mail for team01
$ r 3
-rw-r-—r– john staff 345 aug 23 12:35 fileout
ravi_aix@yahoo.com
81
• AIX Utilities
ravi_aix@yahoo.com
82
• Executing commands with find
– The exec command executes a command on each of the files
found.
ravi_aix@yahoo.com
83
• Interactive command execution
– The ok option causes command execution on an interactive
basis.
ravi_aix@yahoo.com
84
• Additional Options
-type f ordinary file
d directory
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
ravi_aix@yahoo.com
86
• find with the –links option
$ find /home –type f –links +1 | xargs ls –li
• The –links +1 option lists the files that have more than one
link associated with them.
ravi_aix@yahoo.com
87
• grep command (grep [options] pattern [file1 file2....])
– Searches for lines matching specified pattern and also displays
the name of the file containing the pattern.
ravi_aix@yahoo.com
88
• grep with regular expressions
– When * is used with the grep command ti will match zero or
more occurences of the previous character.
Valid metacharacters
ravi_aix@yahoo.com
90
• grep options
ravi_aix@yahoo.com
91
• Other greps
• fgrep fast grep only fixed strings;no expressions
$fgrep ‘HW’ phone1
Hotline HW 800 322-3455 slightly faster
ravi_aix@yahoo.com
92
• 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 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.
ravi_aix@yahoo.com
94
• 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
ravi_aix@yahoo.com
95
• xargs more examples
– Here we create a list of files to be printed and queue them up for
printing through xargs.
ravi_aix@yahoo.com
96
• xargs,find and grep
– Using xargs is more efficient and easier to remember than the
find commanad
ravi_aix@yahoo.com
97
• 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.
$ which find
/usr/bin/find
$ whereis find
/usr/bin/find
$ whence find
/usr/bin/find
ravi_aix@yahoo.com
98
• 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
ravi_aix@yahoo.com
99
• diff (Differential File Comparator)
– The diff command works only with text files and and reports the
differences between the two files.
>
$ diff names names.old names names.old
<
< Carol
Jim Mary
---- Don Sam
>Caroline Mary
4d3
< Don
5a5 a indicates lines that should be appended to first file to
> Sam 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.
ravi_aix@yahoo.com
100
• cmp (compare)
– The compare command works with all types of files and it
reads two files until it finds any differences and reports them.
– 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.
ravi_aix@yahoo.com
101
• Telnet
– The tn command allows to login to remote systems.
$tn miami
Trying ...
connected to miami
...
AIX Version 5
(C) Copyright by IBM and others 1982,1996
login: team01
ravi_aix@yahoo.com
102
• 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> quit
ravi_aix@yahoo.com
104
• tar: Backup and Restore files
– tar(tape archiver) saves files recursively and stores them as
one archive file.
tape
tar –cvf /dev/rmt0 . tar –xvf /dev/rmt0
floppy
tar –cvf /dev/fd0 . tar –xvf /dev/fd0
disk
tar –cvf /tmp/file1.tar . tar –xvf /tmp/file1.tar
ravi_aix@yahoo.com
105
• 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.
-c create
-t table of contents
-v verbose
-f filename
-r extend archive
-x extract
ravi_aix@yahoo.com
106
• 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
$ uncompress filel.z
$ ls –l file1
127 –rw-r--r– 3 team01 staff 13354 oct 29 12:15 /home/file1
ravi_aix@yahoo.com
107
• Additional Shell Features---Important Shell Variables
– These variables are set by the shell or a shell script.
$$ PID
ravi_aix@yahoo.com
108
• 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
ravi_aix@yahoo.com
109
• 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
ravi_aix@yahoo.com
110
• conditional execution
– The exit value from a command or a group of commands can be
used to determine whether to do the next command.
$ ls s* && rm s*
command1 || command2
if command1 is not succesful then do command2
ravi_aix@yahoo.com
111
• test command
– The test command allows you to test for a given condition.
ravi_aix@yahoo.com
113
• if command (example)
$ cat active
usage=“$0: userid”
if [[ $# -ne 1 ]]
then
echo “proper usage: $USAGE”
exit 1
fi
exit0
ravi_aix@yahoo.com
114
• 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...
ravi_aix@yahoo.com
115
• for loop
ravi_aix@yahoo.com
116
• 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
ravi_aix@yahoo.com
117
• command search order
• The shell looks for a in the following order.
ravi_aix@yahoo.com
118
• X Window
– The X-window is a N/W based graphics system.
– It enables us to work with multiple items simultaneously.
– So the graphic application can run on one system, yet display its
output on another system.
– X window is platform independent.
ravi_aix@yahoo.com
119
• X Window
– The X-window is a N/W based graphics system.
Intel PC
RS/6000 Workstation RS/6000 server
ravi_aix@yahoo.com
120
• 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.
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
ravi_aix@yahoo.com
122
• X Clients
– standard X client command line options are:
ravi_aix@yahoo.com
123
• X Server
– Each X server controls one keyboard. one mouse and one or more
screens.
ravi_aix@yahoo.com
124
• 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.
ravi_aix@yahoo.com
125
• The aixterm Window
– An aixterm can be started in two ways:
– In SHELL aixterm
– Display Root menu and select New Window
ravi_aix@yahoo.com
126
• 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.
– The value is generally :0.0 for local severs or sys1:0:0 for a remote
server.
ravi_aix@yahoo.com
127
• Running a Client on Another System
– Here sys2 runs the client application(aixterm) while sys1 needs to
display the output.
sys2
sys1
ravi_aix@yahoo.com
129
• 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.,
ravi_aix@yahoo.com
130
• 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.
$ vi $HOME/.Xdefaults
Aixterm*background: grey
Aixterm*foreground: navy
Aixterm*font: rom10
xclock*update: 1
Mwm*keyboardFocusPolicy: explicit
ravi_aix@yahoo.com
132
• 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.
ravi_aix@yahoo.com
133