Linux/Unix Basics

ROOT‘ on linux is the centre of all power. This account/user is the system administrator who has the access to all files & folders & can add or delete users or change their passwords.

Some of the basic commands used on linux useful for Oracle Apps DBA’s are:

1. useradd
The general syntax for the useradd command is :

useradd -d home_directory -e expire_date -g initial_group -p password login_name

home_directory : Is the main directory within which the user is expected to store all his files and subdirectories.
For a user named ‘neha’ the home directory generally is /home/neha
expire_date : This is the date on which the user’s account expires and he/she cannot access the computer anymore unless the account is renewed.
initial_group : Every user in Linux belongs to a group which affects his file permissions. The initial group must be a group which already exists.
Password : This will be the user’s password to access his account
login_name : This will be the user name with which the user will access his account.

Eg :

useradd -d /home/neha -e 2009-12-03 -g root -p talent123 neha

creates a user named neha on my computer.

Home directory for user Neha is /home/neha
Expirty date is 3rd december,2009
Belongs to the ‘root’ group
Password is talent123

Incase you do not enter one of the parameters group, home, expire or shell they are replaced by their default values. These default values can be viewed using the “ useradd -D” command and can also be changed.

2) ls
The ls command is equivalent of the DOS dir command. It lists the files and subdirectories contained within the present directory.

Some possible flags which can be used with the ls command are :

ls -l 

Uses a long listing format,which contains lots of useful information,like the exact size of file,who owns the file , who has the right to look at it & when it was last modified.
ls -a

List all files including the one’s starting with ‘.’ (Some configuration files starting with a dot ‘.’ are otherwise not listed).

ls | more

Lists files and directories page after page on keystroke. The above command actually is a combination of two commands. It introduces a new concept called ‘Piping’.  In Linux it is possible to give the output of one command to another command as an input.The ls command lists files & subdirectories and the more commands divides its input into page length views. Thus piping the ls output to more results in page length views of files and subdirectories.

ls -R

It lists the files and subdirectories of a directory and further lists the contents of each subdirectory recursively.

3) pwd
The pwd or the present working directory command gives you the path to the directory in which you presently are. It is used without flags simply as ‘pwd’

4) su

Many a times you might have logged in as a normal user and might need to be root (or any other user) to install a software or for some other small task. You could logout then login as that particular user, complete the work logout and login back as a normal user. Instead, you can just use the su command. The format is :

su {username}

eg : su root

when you ‘su’ to become root from a normal user, you are asked for the root password. But if you are root, you can use ‘su’ to become any user without using a password. Once your work is finished, use ‘exit’ to become yourself.

* Check for – (hyphen) with su command

5) whoami
Will tell you which user you are logged in as. Useful when you have used ‘su’ many times and now don’t know who you are.

6) cp
This one copies files / directories from one place to another .It’s syntax is

cp source_file_path destination_path

eg : cp /home/neha/abctxt  /ftp/xyz

The cp command can be used with some useful flags also :

cp -i

Interactive copying, prompts before overwriting files or directories

cp -l source_file_with_path destination_path

Makes a link (shortcut) to the source_file at the destination path instead of actually copying it there.

cp -p

Preserve file attributes while copying if possible

cp -R

Copy Recursively . Used when copying directories. This command also copies the contents of the subdirectories.

cp -u

Update i.e. Copy only if the source file is newer than the destination file or the destination file does not exist.

7) rm
The rm command is used to remove or delete files or directories. Its general syntax is:

rm -flag file_or_directory_with_path

eg : rm /home/neha/scrap.txt

Some flags which can be used with the rm command are

rm -v file.txt

Remove verbosely, explain what is being done.

rm -r my_directory

Remove the directory and its contents recursively.

8) mkdir

This command is used to create new a new directory. Its syntax is

mkdir -optional_flag directory_name

The possible flags are

mkdir -v directory_name

Tell what is going on.mkdir -p directory_with_path

 Suppose you need a directory named ABC within another directory called XYZ in /usr/local and the parent directory XYZ itself does not exist, then you can use :

mkdir -p /usr/local/XYZ/ABC

This command creates the XYZ directory and the ABC subdirectory in one go.

9) man
Suppose you have not understood fully one of the above commands or want to find out about a new command you have learnt , the man command provides a manual for that command. The syntax is:

man command_name


man cp

will show you a manual on the cp command and so on

More on linux basics coming soon ….


Share This Post with Your Friends over Social Media!

About the Author Neha Mittal

Leave a Comment:

subbu says January 9, 2008

good work friend…keep it up

Neha Mittal says January 15, 2008

Thanks alot subbu for the nice words….

Neha Mittal

lakshmikanthan says May 14, 2008

HI all,
when am running autoconfig this error will occured.

AutoConfig is configuring the Database environment…

AutoConfig will consider the custom templates if present.
Using ORACLE_HOME location : /ften/r02/oracle/ftendb/9.2.0
ERROR: OA_JRE_TOP isn’t available at either of the following locations
JDK – /ften/r02/oracle/ftendb/9.2.0/jdk
JRE – /ften/r02/oracle/ftendb/9.2.0/jdk
Pass option ‘java’ on command line
ERROR: OA_JRE_TOP isn’t available at either of the following locations
JDK – /ften/r02/oracle/ftendb/9.2.0/jdk
JRE – /ften/r02/oracle/ftendb/9.2.0/jdk
Pass option ‘java’ on command line
ERROR in setting Environment variable ADJREOPTS


lrwxrwxrwx 1 venkatesan applften 17 Dec 29 12:38 jdk -> /usr/opt/jdk1.3.1

lrwxrwxrwx 1 venkatesan applften 10 Dec 29 12:30 JRE -> appsjre118

lrwxrwxrwx 1 venkatesan applften 5 Dec 29 12:35 oui21 -> oui22

Add Your Reply