DBA Hub

📋Steps in this guide1/35

UNIX Commands For DBAs

A selection of UNIX commands including those for monitoring performance.

oracle miscconfigurationintermediate
by OracleDba
11 views
1

Basic File Navigation

The "pwd" command displays the current directory. The "ls" command lists all files and directories in the specified directory. If no location is defined it acts on the current directory. The "-a" flag lists hidden "." files. The "-l" flag lists file details. The "cd" command is used to change directories. The "touch" command is used to create a new empty file with the default permissions. The "rm" command is used to delete files and directories. The "-R" flag tells the command to recurse through subdirectories. The "mv" command is used to move or rename files and directories. The "." represents the current directory. The "cp" command is used to copy files and directories. The "mkdir" command is used to create new directories. The "rmdir" command is used to delete directories. The "find" command can be used to find the location of specific files. The "/" flag represents the staring directory for the search. Wildcards such as "dbms*" can be used for the filename. The "which" command can be used to find the location of an executable you are using. The "which" command searches your PATH setting for occurrences of the specified executable.

Code/Command (click line numbers to comment):

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
32
root> pwd
/u01/app/oracle/product/9.2.0.1.0

root> ls
root> ls /u01
root> ls -al

root> cd /u01/app/oracle

root> touch my.log

root> rm my.log
root> rm -R /archive

root> mv [from] [to]
root> mv my.log my1.log
root> mv * /archive
root> mv /archive/* .

root> cp [from] [to]
root> cp my.log my1.log
root> cp * /archive
root> cp /archive/* .

root> mkdir archive

root> rmdir archive

root> find / -name dbmspool.sql
root> find / -print | grep -i dbmspool.sql

oracle> which sqlplus
2

File Permissions

See Linux Files, Directories and Permissions . The "umask" command can be used to read or set default file permissions for the current user. The umask value is subtracted from the default permissions (666) to give the final permission. The "chmod" command is used to alter file permissions after the file has been created. Character eqivalents can be used in the chmod command. The "chown" command is used to reset the ownership of files after creation. The "-R" flag causes the command ro recurse through any subdirectories.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
root> umask 022

666 : Default permission
022 : - umask value
644 : final permission

root> chmod 777 *.log

Owner      Group      World      Permission
=========  =========  =========  ======================
7 (u+rwx)  7 (g+rwx)  7 (o+rwx)  read + write + execute
6 (u+rw)   6 (g+rw)   6 (o+rw)   read + write
5 (u+rx)   5 (g+rx)   5 (o+rx)   read + execute
4 (u+r)    4 (g+r)    4 (o+r)    read only
2 (u+w)    2 (g+w)    2 (o+w)    write only
1 (u+x)    1 (g+x)    1 (o+x)    execute only

root> chmod o+rwx *.log
root> chmod g+r   *.log
root> chmod -Rx   *.log

root> chown -R oinstall.dba *
3

OS Users Management

See Linux Groups and Users . The "useradd" command is used to add OS users. - The "-G" flag specifies the primary group. - The "-g" flag specifies the secondary group. - The "-d" flag specifies the default directory. - The "-m" flag creates the default directory. - The "-s" flag specifies the default shell. The "usermod" command is used to modify the user settings after a user has been created. The "userdel" command is used to delete existing users. The "-r" flag removes the default directory. The "passwd" command is used to set, or reset, the users login password. The "who" command can be used to list all users who have OS connections. - The "head -5" command restricts the output to the first 5 lines of the who command. - The "tail -5" command restricts the output to the last 5 lines of the who command. - The "grep -i ora" command restricts the output to lines containing "ora". - The "wc -l" command returns the number of lines from "who", and hence the number of connected users.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
root> useradd -G oinstall -g dba -d /usr/users/my_user -m -s /bin/ksh my_user

root> usermod -s /bin/csh my_user

root> userdel -r my_user

root> passwd my_user

root> who
root> who | head -5
root> who | tail -5
root> who | grep -i ora
root> who | wc -l
4

Process Management

See Linux Process Management (ps, top, renice, kill) . The "ps" command lists current process information. Specific processes can be killed by specifying the process id in the kill command. You can kill multiple processes using a single command by combining "kill" with the "ps" and "awk" commands.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
# ps
# ps -ef | grep -i ora
# ps -ef | grep -i ora | grep -v grep
# ps -ef | grep -i [o]ra

# kill 12345
# kill -9 12345

# kill -9 `ps -ef | grep ora | awk '{print $2}'`
5

uname and hostname

The "uname" and "hostname" commands can be used to get information about the host.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
root> uname -a
OSF1 oradb01.lynx.co.uk V5.1 2650 alpha

root> uname -a | awk '{ print $2 }'
oradb01.lynx.co.uk

root> hostname
oradb01.lynx.co.uk
6

Error Lines in Files

You can return the error lines in a file using. The "grep -i ORA-" command limits the output to lines containing "ORA-". The "-i" flag makes the comparison case insensitive. A count of the error lines can be returned using the "wc" command. This normally give a word count, but the "-l" flag alteres it to give a line count.

Code/Command (click line numbers to comment):

1
2
3
root> cat alert_LIN1.log | grep -i ORA-

root> cat alert_LIN1.log | grep -i ORA- | wc -l
7

Remove Old Files

The command can be used to supply a list of files to the command or the "-delete" command can be used directly.

Code/Command (click line numbers to comment):

1
2
3
4
5
find /backup/logs/ -name daily_backup* -mtime +21 -exec rm -f {} ;

find /backup/logs/daily_backup* -mtime +5 -exec rm -f {} \;

find /backup/logs/daily_backup* -mtime +5 -delete;
8

File Exists Check

The Bash shell allows you to check for the presence of a file using the "[ -e filepath ]" comparison. In the following script a backup log is renamed if it is present and files older than 30 days are deleted are deleted. This is one example of a log rotation, where the most current log doesn't include the date in it's name.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
#!/bin/bash
if [ -e /tmp/backup.log ]; then
  DATE_SUFFIX=`date +"%Y"-"%m"-"%d"`
  mv /tmp/backup.log /tmp/backup-$DATE_SUFFIX.log
fi

# Delete old log files.
find /tmp/backup*.log -mtime +30 -delete;
9

Rotate Log Files

See the previous section for another variant on log rotation. The following script provides an example of how to manage a log rotation using the Bash shell. The log file includes the date in the file name. Files older than 30 days are deleted.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
#!/bin/bash
DATE_SUFFIX=`date +"%Y"-"%m"-"%d"`
LOG_FILE=/tmp/backup-$DATE_SUFFIX.log

# Do something that needs logging.
echo "Send this to log" >> $LOG_FILE 2>&1

# Delete old log files.
find /tmp/backup*.log -mtime +30 -delete;
10

Find Big Files

Find the top 20 biggest files recursively from this directory.

Code/Command (click line numbers to comment):

1
$ find . -type f -print0 | xargs -0 du -h | sort -hr | head -20
11

Perform Action for Every File in a Directory

The following scripts shows two methods for performing an action for each file in a directory.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
#!/bin/bash
for FILE in `ls /tmp/`; do
  # Do something with the file name.
  echo $FILE;
done

# Or this.

for FILE in $( ls /tmp/ ); do
  echo $FILE
done
12

Perform Action for Every Line in a File

The following scripts shows a method for performing an action for each line in a file.

Code/Command (click line numbers to comment):

1
2
3
4
5
#!/bin/bash
while read LINE; do
  # Do something with the line.
  echo $LINE;
done < /tmp/myfile.txt
13

alias

An alias is a named shortcut for a longer command using the following format. For example, if you require sudo access for a specific command, you might want to include this as an alias so you don't have to remember to type it.

Code/Command (click line numbers to comment):

1
2
3
alias name='command'

alias myscript='sudo -u oracle /path/to/myscript'
14

Remove DOS CR/LFs (^M)

Remove DOS style CR/LF characters (^M) from UNIX files using. The newly created tempfile should have the ^M character removed. Where available, it is probably better to use the and commands.

Code/Command (click line numbers to comment):

1
sed -e 's/^M$//' filename > tempfile
15

Run Commands As Oracle User From Root

The following scripts shows how a number of commands can be run as the "oracle" user the "root" user. This is often necessary where CRON jobs are run from the root user rather than the oracle user.

Code/Command (click line numbers to comment):

1
2
3
4
5
#!/bin/ksh
su - oracle <<EOF
ORACLE_SID=LIN1; export ORACLE_SID
rman catalog=rman/rman@w2k1 target=/ cmdfile=my_cmdfile log=my_logfile append 
EOF
16

Compress Files

See Linux Archive Tools (tar, star, gzip, bzip2, zip, cpio) . In order to save space on the filesystem you may wish to compress files such as archived redo logs. This can be using either the or the commands. The command results in a compressed copy of the original file with a ".gz" extension. The command reverses this process. The command results in a compressed copy of the original file with a ".Z" extension. The command reverses this process.

Code/Command (click line numbers to comment):

1
2
3
4
5
gzip myfile
gunzip myfile.gz

compress myfile
uncompress myfile
17

vmstat

Reports virtual memory statistics. See the vmstat man page .

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
# vmstat 5 3
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0      0 1060608  24372 739080    0    0  1334    63 1018 1571 14 11 66 10  0
 0  0      0 995244  24392 799656    0    0  6302   160 1221 1962 10 10 62 18  0
 0  0      0 992376  24400 799784    0    0     1    28  992 1886  3  2 95  0  0
#
18

free

Reports the current memory usage. The "-/+ buffers/cache:" line represents the true used and free memory, ignoring the Linux file system cache.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
# free
             total       used       free     shared    buffers     cached
Mem:       8178884    4669760    3509124          0     324056    1717756
-/+ buffers/cache:    2627948    5550936
Swap:     10289148          0   10289148
#
19

iostat

Reports I/O statistics.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
# iostat
Linux 3.2.10-3.fc16.x86_64 (maggie.localdomain) 	03/19/2012 	_x86_64_(4 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           2.02    0.23    0.51    0.78    0.00   96.46

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
sda               9.23       100.55        62.99    1796672    1125538
dm-0             13.60       100.31        62.99    1792386    1125524
dm-1              0.02         0.08         0.00       1432          0

#
20

CPU Usage

See Linux Process Management (ps, top, renice, kill) .
21

sar

On Linux systems sar (System Activity Reporter) is probably one of the simplest and most versatile tools for reporting system utilization including CPU, memory, disk and network activity. It automatically collects system activity statistics when installed using the following command. The command syntax takes the following form. The "options" parameters determine what is reported, which will be discussed later. The "interval" parameter indicates the time interval in seconds between samples. The "count" parameter indicates the number of samples that will be taken before the command ends. If "count" is omitted, the sampling will continue indefinitely. If both "interval" and "count" are omitted, the command will report the values from the 10 minute samples taken since the machine was last restarted. As seen in the sar man page , there are lots of available options, but some starting points you may find interesting include: - CPU: Basic CPU: sar [-u] [interval [count]] Load Average: sar -q [interval [count]] - Basic CPU: sar [-u] [interval [count]] - Load Average: sar -q [interval [count]] - Memory: Kernel Paging: sar -B [interval [count]] Unused Memory: sar -r [interval [count]] Swap Space: sar -S [interval [count]] - Kernel Paging: sar -B [interval [count]] - Unused Memory: sar -r [interval [count]] - Swap Space: sar -S [interval [count]] - Disk: Average Disk I/O: sar -b [interval [count]] Disk I/O: sar -dp [interval [count]] - Average Disk I/O: sar -b [interval [count]] - Disk I/O: sar -dp [interval [count]] - Network: Network: sar -n DEV [interval [count]] Network Errors: sar -n EDEV [interval [count]] - Network: sar -n DEV [interval [count]] - Network Errors: sar -n EDEV [interval [count]] Here is an example of the output from a CPU report.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# yum install sysstat

# sar [options] [interval [count]]

# sar -u 1 5
Linux 2.6.32-100.0.19.el5 (ol5-112.localdomain) 	06/27/2011

03:10:07 PM     CPU     %user     %nice   %system   %iowait    %steal     %idle
03:10:08 PM     all      0.00      1.01     23.23     75.76      0.00      0.00
03:10:09 PM     all      0.00      1.02     35.71     63.27      0.00      0.00
03:10:10 PM     all      0.98      3.92     35.29     59.80      0.00      0.00
03:10:11 PM     all      0.00      1.03     29.90     69.07      0.00      0.00
03:10:12 PM     all      0.00      2.00     35.00     63.00      0.00      0.00
Average:        all      0.20      1.81     31.85     66.13      0.00      0.00
#
22

mpstat

Reports processor related statistics. See the mpstat man page .

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
# mpstat 10 2
Linux 2.6.32-100.0.19.el5 (ol5-112.localdomain) 	06/27/2011

01:59:57 PM  CPU   %user   %nice    %sys %iowait    %irq   %soft  %steal   %idle    intr/s
02:00:07 PM  all    1.21    0.00    0.90    0.20    0.00    0.00    0.00   97.69    980.50
02:00:17 PM  all    0.70    0.00    0.40    0.00    0.00    0.10    0.00   98.79    973.77
Average:     all    0.95    0.00    0.65    0.10    0.00    0.05    0.00   98.24    977.14
#
23

top

Displays top tasks. The PID column can then be matched with the SPID column on the V$PROCESS view to provide more information on the process. See the top man page .

Code/Command (click line numbers to comment):

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
32
33
34
35
36
37
38
39
40
41
42
43
# top
top - 13:58:17 up 2 min,  1 user,  load average: 2.54, 1.11, 0.41
Tasks: 160 total,   6 running, 154 sleeping,   0 stopped,   0 zombie
Cpu(s): 77.1%us, 22.6%sy,  0.0%ni,  0.0%id,  0.0%wa,  0.3%hi,  0.0%si,  0.0%st
Mem:   2058872k total,   879072k used,  1179800k free,    23580k buffers
Swap:  4095992k total,        0k used,  4095992k free,   620116k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 2882 oracle    20   0  610m  64m  56m R 24.9  3.2   0:02.20 oracle
 2927 root      20   0 90328 3832 2604 R 24.6  0.2   0:00.89 Xorg
 2931 oracle    20   0  605m  34m  31m R 11.5  1.7   0:00.35 oracle
 2933 oracle    20   0  605m  34m  30m S  9.8  1.7   0:00.30 oracle
 2888 oracle    20   0  614m  52m  40m S  6.9  2.6   0:00.78 oracle
 2935 oracle    20   0  604m  22m  20m S  6.2  1.1   0:00.19 oracle
 2937 oracle    20   0  604m  19m  17m R  4.6  1.0   0:00.14 oracle
 2688 oracle    -2   0  603m  15m  13m S  4.3  0.8   0:01.08 oracle
 2685 oracle    20   0  603m  15m  13m S  0.7  0.8   0:00.22 oracle
 2939 oracle    20   0  217m 4084 3504 R  0.7  0.2   0:00.02 oracle
 2698 oracle    20   0  604m  18m  16m S  0.3  0.9   0:00.17 oracle
 2702 oracle    20   0  609m  22m  14m S  0.3  1.1   0:00.17 oracle
 2704 oracle    20   0  618m  21m  19m S  0.3  1.1   0:00.21 oracle
 2714 oracle    20   0  603m  20m  18m S  0.3  1.0   0:00.18 oracle
    1 root      20   0 10364  704  588 S  0.0  0.0   0:00.36 init
    2 root      20   0     0    0    0 S  0.0  0.0   0:00.00 kthreadd
    3 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 migration/0
    4 root      20   0     0    0    0 S  0.0  0.0   0:00.00 ksoftirqd/0
    5 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 watchdog/0
    6 root      20   0     0    0    0 S  0.0  0.0   0:00.03 events/0
    7 root      20   0     0    0    0 S  0.0  0.0   0:00.00 cpuset
    8 root      20   0     0    0    0 S  0.0  0.0   0:00.00 khelper
    9 root      20   0     0    0    0 S  0.0  0.0   0:00.00 netns
#

SELECT a.username, 
       a.osuser, 
       a.program, 
       spid, 
       sid, 
       a.serial#
FROM   v$session a,
       v$process b
WHERE  a.paddr = b.addr
AND    spid = '&pid';
24

Hide Passwords

You may be required to use passwords in scripts calling Oracle tools, like SQL*Plus, Export/Import and RMAN etc. One method to remove the credentials from the script itself is to create a credentials file to hold them. In this case I'm using "/home/oracle/.scottcred", which contains the following. Change the permissions to make sure the file is only visible to the owner. Now replace references to the credentials with the contents of the file. - Secure External Password Store - OS Authentication

Code/Command (click line numbers to comment):

1
2
3
4
5
scott/tiger

$ chmod 600 /home/oracle/.scottcred

$ expdp < /home/oracle/.scottcred schemas=SCOTT directory=DATA_PUMP_DIR dumpfile=SCOTT.dmp logfile=expdpSCOTT.log
25

Automatic Startup Scripts on Linux

This text has been replaced by a separate article here .
26

CRON

See CRON : Scheduling Tasks on Linux . There are two methods of editing the crontab file. First you can use the "crontab -l > filename" option to list the contents and pipe this to a file. Once you've editied the file you can then apply it using the "crontab filename". - Login as root - crontab -l > newcron - Edit newcron file. - crontab newcron Alternatively you can use the "crontab -e" option to edit the crontab file directly. The entries have the following elements. The first 5 fields can be specified using the following rules. The following entry runs a cleanup script a 01:00 each Sunday. Any output or errors from the script are piped to /dev/null to prevent a buildup of mails to root. To prevent a new job starting if the last run is still running, consider using flock. The job will only run if a lock can be obtained on the specified lockfile.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
field          allowed values
-----          --------------
minute         0-59
hour           0-23
day of month   1-31
month          1-12
day of week    0-7 (both 0 and 7 are Sunday)
user           Valid OS user
command        Valid command or script.

*       - All available values or "first-last".
3-4     - A single range representing each possible from the start to the end of the range inclusive.
1,2,5,6 - A specific list of values.
1-3,5-8 - A specific list of ranges.
0-23/2  - Every other value in the specified range.

0 1 * * 0 /u01/app/oracle/dba/weekly_cleanup > /dev/null 2>&1

From:
0 1 * * 0 /u01/app/oracle/dba/weekly_cleanup > /dev/null 2>&1

To:
0 1 * * 0 /usr/bin/flock -n /tmp/weekly_cleanup.lockfile /u01/app/oracle/dba/weekly_cleanup > /dev/null 2>&1
27

Cluster Wide CRON Jobs On Tru64

On clustered systems cron is node-specific. If you need a job to fire once per cluster, rather than once per node you need an alternative approach to the standard cron job. One approach is put forward in the HP best practices document ( Using cron in a TruCluster Server Cluster ), but in my opinion a more elegant solution is proposed by Jason Orendorf of HP Tru64 Unix Enterprise Team ( TruCluster Clustercron ). In his solution Jason creates a file called /bin/cronrun with the following contents. This script returns TRUE (0) only on the node which is the CFS serving cluster_root. All cluster wide jobs should have a crontab entry on each node of the cluster like. Although the cron jobs fire on all nodes, the "/bin/cronrun &&" part of the entry prevents the script from running on all nodes except the current CFS serving cluster_root.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
#!/bin/ksh
set -- $(/usr/sbin/cfsmgr -F raw /)
shift 12
[[ "$1" = "$(/bin/hostname -s)" ]] && exit 0
exit 1

5 * * * /bin/cronrun && /usr/local/bin/myjob
28

Background Tasks (nohup)

Running a script as a background task allows it to continue running if your terminal connection fails, or if you want to intentionally close the session. Put your command in a script. Then call the script using nohup, and rediect the output to a logfile. Nohup stands for "no hang up", which keep the process running if you disconnect. The ">>" redirects the output to the log file. The ">2&1" redirects standard error (stderr) to standard out (stdout), so both go to the log file. The "&" releases control back to your terminal. Just using "&" on its own makes the process run in the background, but it will still fail if your terminal session disconnects unless you include nohup. You check for output from the script by tailing the log file.

Code/Command (click line numbers to comment):

1
2
3
nohup ./my_long_running_script.sh >> /tmp/my_long_running_script.log >2&1 &

tail -f /tmp/my_long_running_script.log
29

NFS Mount (Sun)

The following deamons must be running for the share to be seen by a PC. - /usr/lib/nfs/nfsd -a - /usr/lib/nfs/mountd - /opt/SUNWpcnfs/sbin/rpc.pcnfsd To see a list of the nfs mounted drives already present type. First the mount point must be shared so it can be seen by remote machines. Next the share can be mounted on a remote machine by root using.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
exportfs

share -F nfs -o ro /cdrom

mkdir /cdrom#1
mount -o ro myhost:/cdrom /cdrom#1
30

NFS Mount (Tru64)

On the server machine, if NFS is not currently setup do the following. - Application Manager -> System Admin -> Configuration -> NFS - Select the "Configure system as an NFS server" option. - Accept all defaults. Create mount point directory. Append the following entry to the "/etc/exports" file. Make sure the correct permissions are granted on the directory. On the client machine, if NFS is not currently setup do the following. - Application Manager -> System Admin -> Configuration -> NFS - Select the "Configure system as an NFS client" option. - Accept all defaults. Create mount point directory. Append an following entry to the "/etc/fstab" file. Finally, mount the fileset. At this point you can start to use the mount point from your client machine. Thanks to Bryan Mills for his help with Tru64.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
mkdir /u04/backup

/u04/backup

chmod -R 777 /u04/backup

mkdir /backup

nfs-server-name:/u04/backup     /backup         nfs rw,bg,intr 0 0

mount /backup
31

Samba/CIFS Mount (Linux)

See Linux Samba Configuration . Create a directory to use for the mount point. Add the following line to the "/etc/fstab" file. Create a file called "/root/.smbcred" with the following contents. Change the permissions on the credentials file. Mount the share.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
# mkdir /host

//192.168.0.4/public	/host			cifs	rw,credentials=/root/.smbcred,uid=500,guid=500 0 0

username=myuser
password=mypassword

# chmod 600 /root/.smbcred

# mount /host
32

PC XStation Configuration

Download the CygWin setup.exe from http://www.cygwin.com . Install, making sure to select all the X11R6 (or XFree86 in older versions) optional packages. If you need root access add the following entry into the /etc/securettys file on each server. From the command promot on the PC do the following. The X environment should start in a new window. Many Linux distributions do not start XDMCP by default. To allow XDMCP access from Cygwin edit the "/etc/X11/gdm/gdm.conf" file. Under the "[xdmcp]" section set "Enable=true". If you are starting any X applications during the session you will need to set the DISPLAY environment variable. Remember, you are acting as an XStation, not the server itself, so this variable must be set as follows.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
<client-name>:0

set PATH=PATH;c:cygwinbin;c:cygwinusrX11R6bin
XWin.exe :0 -query <server-name>

DISPLAY=<client-name>:0.0; export DISPLAY
33

xauth (Magic Cookie)

Access to X servers can get broken when using and commands. The command provides a solution to this. The process involves the following stages: - Check your current display number. - Use to get a list of magic cookies. - Switch to the new user. - Use to set the magic cookie for your display number. - Make sure the display number is still set correctly. An example of this is shown below. You will now be able to access the X server, just as you could before the user switch.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
$ echo $DISPLAY
localhost:12.0
$ xauth list
ol6.localdomain/unix:12  MIT-MAGIC-COOKIE-1  be64852468ca3c334720b10bb3c4d3cb
$ sudo su oracle
$ xauth add ol6.localdomain/unix:12  MIT-MAGIC-COOKIE-1  be64852468ca3c334720b10bb3c4d3cb
$ export DISPLAY=localhost:12.0
34

Useful Profile Settings

See Linux Groups and Users : Important Files . The following ".profile" settings rely on the default shell for the user being set to the Korn shell (/bin/ksh). The backspace key can be configured by adding the following entry. The command line history can be accessed using the [Esc][k] by adding the following entry. Auto completion of paths using a double strike of the [Esc] key can be configured by adding the following entry.

Code/Command (click line numbers to comment):

1
2
3
4
5
stty erase "^H"

set -o vi

set filec
35

Useful Files

Here are some files that may be of use. For more information see: Hope this helps. Regards Tim...

Comments (0)

Please to add comments

No comments yet. Be the first to comment!