 |
|
Oracle UNIX pwd Command
Oracle Tips by Burleson Consulting
|
|
Advanced Oracle Utilities: The Definitive Reference by
Rampant TechPress is written by the top Oracle
database experts (Bert Scalzo, Donald
Burleson, and Steve Callan). The following is an excerpt
from the book.
The UNIX pwd
command
The pwd command is
probably the most commonly used UNIX command.
It is short for Print Working Directory, and it tells where
the DBA is located in the UNIX tree structure.
For example, issue the pwd command to see the current
directory:
root>pwd
/export/home/oracle
The pwd command is
very important, and many Oracle DBAs and UNIX system
administrators place the output of the pwd command in their
command prompt so they always know their current directory.
This is done by setting the UNIX PS1 system variable:
PS1="
`hostname`*\${ORACLE_SID}-\${PWD}
>"
export PS1
With this setting,
the UNIX prompt will change to always show the hostname, the
$ORACLE_SID and the current working directory:
cheops*testsid-/u01/app/oracle/admin/testsid/pfile
>pwd
/u01/app/oracle/admin/testsid/pfile
The UNIX ls
command
Another very
frequently used UNIX command is the ls command.
Without any arguments, the ls command will show a list of
all files in the current directory:
root> ls
Mailbox
invalid.sql
run_rpt.ksh
ad.sql
kill_oracle_sessions.ksh
run_trunc.lst
adamf_techeops
l.ksh
run_trunc.sql
admin
list.lst
schools.dmp
afiedt.buf
list2.lst
scripts
arsd.dmp
lockee.txt
sql
bksel.lst
lst.lst
sqlnet.log
When the –a and –l
arguments are added, all of the details for each file in the
current working directory are shown:
root> ls –al
total 928188
drwxr-xr-x 21 oracle
dba 2048
Aug 22 20:47 .
drwxr-xr-x 10 root
root
512 Jul 26 08:49 ..
-rw-------
1 oracle
qmail
437 Aug 12 20:43 .bash_history
drwxr-xr-x 11 oracle
qmail
512 Sep
3
2000 .dt
-rwxr-xr-x
1 oracle
qmail
4381 Jul 16 13:20 .profile
-rwxr-xr-x
1 oracle
qmail
3648 Sep
1
2000 .profile_old
-rw-------
1 oracle
dba
2264 Sep 3
08:06 .sh_history
drwxr-xr-x 2
oracle dba
512 May 10 11:10 .ssh
-rw-------
1 oracle
dba
3861 May 29 06:03 Mailbox
-rw-r--r--
1 oracle
dba
12632 Apr 11 16:09 ad.sql
drwxr-xr-x 2
oracle dba
512 Jan 26
2001
adamf_techeops
drwxr-xr-x 5
oracle dba
512 Sep
4
2000 admin
-rwxr-xr-x
1 oracle
dba
55 Aug 22 11:56 afiedt.buf
Below is a listing
of each of the columns in the ls –al command so their meaning is
understood.
Column
|
Data
|
1
|
File
permissions
|
3
|
file owner
|
4
|
file group
|
5
|
file size
|
6
|
last
modified date
|
7
|
file name
|
Table 2.5:
The Columns in the ls –al UNIX Command
The first column
in the ls –al command shows the file permissions.
The permissions are a set of letters arranged in a group of
three, one for the file owner, one for the file group and another
for the world (Figure 1-3).
The third and fourth columns of the
ls –al
command lists the owner and group of the file.
Note that if there is super-user authority (root), change
the owner and group of any file with the
chown
command. The fifth column is the
file size in bytes, the sixth column lists the last modified date
and the last column is the name of the file.
Displaying
“Dot” files in UNIX
The –a option of
the ls command is used to display the “dot” files, which are not
normally seen with the ls command.
“dot” files are those files whose name begins with a period
(“.”). Some “dot”
files that are of special interest to the Oracle DBA:
Command history
files – These file keep a complete audit of each and every UNIX
command issued by the UNIX user. These include .sh_history, .bash_history
and .ksh_history.
Login files –
These files contain login scripts that are executed every time the
user signs on to UNIX.
These include .profile, .cshrc, .kshrc and .bshrc,.
 |
Fo r more details on Oracle utilities, see the book "Advanced
Oracle Utilities" by Bert Scalzo, Donald K. Burleson, and Steve Callan.
You can buy it direct from the publisher for 30% off directly from
Rampant TechPress.
|
|