Most Frequently Used Unix Commands - The Complete Reference

Most Frequently Used Unix Commands For Oracle Apps Technical Consultants

unix commands bible,unix commands complete reference

cal - Calendar 2000
who - Who is logged on
finger - Details of logged on users
write - To send messages to users
Ctrl+D - End of file
mesg n - To deny talking
mesg - To know the status
Man - Help command
cat - Display multiple files.
clear - Clear screen.
Date - Displays the system date.
cd - Change directories.
chmod - Change security mode of a file or directory.
cp - copy files from one directory to another.
mv - Move or rename files.
cut - Select and extract columns or fields from a file.
echo - Display the specified Arguments on the output device.
find - Locate a file which meet the search criteria.
grep - Select lines or rows that match a specified pattern.
kill - End a process.
ln - Creates link directories between files,thereby allowing more than one name for a file.
lp - Print a file.
ls - lists a directory’s contents, including its files and subdirectories
mkdir - Make a new directory.
passwd - Change your Unix password.
pwd - Display your current path.
rm - Remove a file
rmdir - Remove a directory
sh - Execute a shell script.
sort - Sort and merge multiple files.
trap - Executes a command when a specified signal is received from the operating system.
Type cd and press enter to make sure you are in your home directory.
mkdir to make a new directory
ls to see the contents in your directory.
ll to see the contents in your directory.
cat to create a new file.
ctrl + z to save the file.

Basic commands
1. Log name - Displays the current logged user name
2. $Pwd --Displays current working directory
3 $Clear --For clearing the screen
4. $Exit – to logout from current user
5. $Date – Displays system date and time
      Ex: Sat mar 4 04:40:10 IST 2005
6. $Who am I – Displays current user name, terminal number, date and time at which used logged into the system
Tec no ty01 mar 4 09:30
7. $Who –To displays the information about all the users who have logged into the system
Currently. I.e., each user login name, terminal number, date and time when the user logged in
Tecno1 tty01 mar 4 09:30
Tecno2 tty05 mar 4 10:10
Tecno3 tty06 mar 4 10:15
i.e. Tecno1 – log name
Tty01 - terminal name
Mar 4 - date
09:30 -time
8. $Finger – Displays complete information about all the users who are logged in
9. $Cal – Displays previous month, current month and next month calendar
10. $cal year – it displays the given year calendar
Eg: $cal 2005 --it takes year from 1 t0 9999
11. $Cal month year – it displays the given month calendar only
12. #Init --to change system run levels
i. #Init 0 -to shutdown the system
ii. #Init 1 – to bring the system to single user mode
iii. #Init 2 –to bring the system to multi user mode with no resource shared.
iv. #Init 3 –to bring the system multi user mode with resource shared
v. #Init 6 – halt and reboot the system to the default run level.
13. $banner “Bayon” – it prints a message in large letters
Commands Related To File Creation 
There are two commands to create files 1. Touch and cat
1. Touch filename - it creates zero byte file size
Eg: $ touch samplefilename
The size of sample file is zero bytes. Touch does not allow you store anything in a file. It is used for creating several empty files quickly.
Eg: $ touch file1 file2 file3 file4 file5 command
i. $Cat >filename
E.g.: $cat >samplefilename
Ctrl+d (to close a file)
ii. $Cat >> samplefilename --to append data to the file
iii. $Cat file1 file2 file3 >file4
This would create file4 which contains contents of file1 followed by file2 and
Followed by that of file3. i.e., it concatenates file1, file2 and file3 contents and
Redirects to file4. If file4 already contains something it would be over written.
3. $ Cat <filename or $cat filename --to open a file
E.g: $cat sample --it displays sample file contents
E.g: $cat file1 file2 file3
-It displays file1 contents followed by file2 then followed by file3.
Commands for Removing files
4. Rm command -to removes the given file
Syntax: $rm filename
$Rm sample -it removes sample file
$Rm –I filename -it asks confirmation before deleting the file.
$Rm – sample
Remove sample? y –it removes
N – it won’t remove
$Rm file1 file2 file3 -it removes three files
$Rm * -it removes all files in current directory
Commands for Creating directories
5. Mkdir command -to make directory
Syntax: $mkdir directory name
e.g: mkdir techno
Creating multiple directories
$Mkdir dir1 dir2 dir3 …darn
Commands For Changing directories
Syntax: $cd directory name
$Cd oracleappsguy
$cd .. –to change into parent directory
$cd\ -to change to root directory
Commands For Removing  directories
1. $rmdir directory name -to delete a directory but directory should be empty
2. $rm –r directory name – it removes all files and sub directories, sub directory files
Including directory.

File and directory paths in UNIX use the forward slash "/" to separate directory Names in a path.
Examples: / "root" directory
/usr directory usr (sub-directory of / "root" directory)
/usr/STRIM100 STRIM100 is a subdirectory of /usr

Moving around the file system:
pwd Show the "present working directory", or current directory.
cd Change current directory to your HOME directory.
cd - go to previous directory(like undo).
cd /usr/STRIM100 Change current directory to /usr/STRIM100.
cd INIT Change current directory to INIT which is a sub-directory of the current
cd .. Change current directory to the parent directory of the current directory.
cd $STRMWORK Change current directory to the directory defined by the
environment variable 'STRMWORK'.
cd ~bob Change the current directory to the user bob's home directory (if you
have permission).

ls list a directory
ls -l list a directory in long ( detailed ) format
$ ls -l
drwxr-xr-x 4 cliff user 1024 Jun 18 09:40 WAITRON_EARNINGS
-rw-r--r-- 1 cliff user 767392 Jun 6 14:28 scanlib.tar.gz
| | | | | owner group size date time name
| | | | number of links to file or directory contents
| | | permissions for world
| | permissions for members of group
| permissions for owner of file: r = read, w = write, x = execute -=no permission
type of file: - = normal file, d=directory, l = symbolic link, and others...
drwxr-xr-x first 1 letter is indicate directiry or file, d is directory,- is file.
Next 9 letters are indicate owner(3), group(3), user(3) rights resp.
ls -a List the current directory including hidden files. Hidden files start with "."
ls -ld * List all the file and directory names in the current directory using long format.
Without the "d" option, ls would list the contents of any sub-directory of the
current. With the "d" option, ls just lists them like regular files.
ls t* list all directories or files which start with ‘t’

Changing file permissions and attributes:
chmod 755 file Changes the permissions of file to be rwx for the owner, and rx for
the group and the world.(7 = rwx = 111 binary. 5 = r-x = 101 binary)
chgrp user file Makes file belong to the group user.
chown cliff file Makes cliff the owner of file.
chown -R cliff dir Makes cliff the owner of dir and everything in its directory tree.
You must be the owner of the file/directory or be root before you can do any of these things.

Moving, renaming, and copying files:
cp file1 file2 copy a file(if file2 not exists it will create a new file)
mv file1 newname move or rename a file(rename)
mv file1 /AAA/bbb move file1 into sub-directory AAA in your home directory.
rm file1 [file2 ...] remove or delete a file
rmdir dir1 [dir2...] remove an empty directory
rm -r dir1 [dir2...] recursively remove a directory and its contents BE CAREFUL!
mkdir dir1 [dir2...] create directories
mkdir -p dirpath create the directory dirpath, including all implied directories in the
cmp [options] file1 file2 compare two files and list where differences occur
(text or binary files)
diff [options] file1 file2 compare the two files and display the differences
(text files only)
chsh (passwd -e/-susername login_shell change the user's login shell
(often only by the superuser)
date [options] report the current date and time
emacs [options] file full-screen editor
file [options] file classify the file type
ftp [options] host transfer file(s) using file transfer protocol
lpr [options] file or lp [options] file print to defined printer
passwd [options] set or change your password
wc file count number of lines/words/characters in file
who list users currently logged in

Viewing and editing files:
cat filename Dump a file to the screen in ascii.
more filename Progressively dump a file to the screen: ENTER = one line down
SPACEBAR = page down q=quit
less filename Like more, but you can use Page-Up too. Not on all systems.
vi filename Edit a file using the vi editor. All UNIX systems will have vi in some form.
emacs filename Edit a file using the emacs editor. Not all systems will have emacs.
head filename Show the first few lines of a file.
head -n filename Show the first n lines of a file.
tail filename Show the last few lines of a file.
tail -n filename Show the last n lines of a file.
The behavior of the command line interface will differ slightly depending on the shell program that is being used. Depending on the shell used, some extra behaviors can be quite nifty. You can find out what shell you are using by the command:
echo $SHELL
Of course you can create a file with a list of shell commands and execute it like a program to perform a task. This is called a shell script. This is in fact the primary purpose of most shells, not the interactive command line behavior.

Environment variables:
You can teach your shell to remember things for later using environment variables.
For example under the bash shell:
Export CASROOT=/usr/local/CAS3.0 Defines the variable CASROOT with the value
Export LD_LIBRARY_PATH=$CASROOT/Linux/lib Defines the variable
LD_LIBRARY_PATH with the value
Of CASROOT with /Linux/lib
ppended, or /usr/local/CAS3.0/Linux/lib
By prefixing $ to the variable name, you can evaluate it in any command:
cd $CASROOT Changes your present working directory to the value of CASROOT
echo $CASROOT Prints out the value of CASROOT, or /usr/local/CAS3.0
printenv CASROOT Does the same thing in bash and some other shells.

Interactive History:
A feature of bash and tcsh (and sometimes others) you can use the up-arrow keys to access your previous commands, edit them, and re-execute them.

Filename Completion:
A feature of bash and tcsh (and possibly others) you can use the TAB key to complete a partially typed filename. For example if you have a file called constantine-monks-and-willy-wonka.txt in your directory and want to edit it you can type 'vi const', hit the TAB key, and the shell will fill in the rest of the name for you (provided the completion is unique).

Bash is the way cool shell:
Bash will even complete the name of commands and environment variables. And if there are multiple completions, if you hit TAB twice bash will show you all the completions. Bash is the default user shell for most Linux systems.

grep string filename > newfile Redirects the output of the above grep
command to a file 'newfile'.
grep string filename >> existfile Appends the output of the grep command
to the end of 'existfile'.
The redirection directives, > and >> can be used on the output of most commands to direct their output to a file.

The pipe symbol "|" is used to direct the output of one command to the input of another.
For example:
ls -l | more This commands takes the output of the long format directory list command
"ls -l" and pipes it through the more command (also known as a filter).
In this case a very long list of files can be viewed a page at a time.
du -sc * | sort -n | tail
The command "du -sc" lists the sizes of all files and directories in the current working directory. That is piped through "sort -n" which orders the output from smallest to largest size. Finally, that output is piped through "tail" which displays only the last few (which just happen to be the largest) results.

Command Substitution:
You can use the output of one command as an input to another command in another way called command substitution. Command substitution is invoked when by enclosing the substituted command in backwards single quotes.
For example:
cat `find . -name aaa.txt`
which will cat ( dump to the screen ) all the files named aaa.txt that exist in the current
directory or in any subdirectory tree.

Searching for strings in files: The grep command
grep string filename prints all the lines in a file that contain the string

Searching for files : The find command
find search_path -name filename
find . -name aaa.txt Finds all the files named aaa.txt in the current directory or
any subdirectory tree.
find / -name vimrc Find all the files named 'vimrc' anywhere on the system.
find /usr/local/games -name "*xpilot*"
Find all files whose names contain the string 'xpilot' which exist within the '/usr/local/games' directory tree.

Reading and writing tapes, backups, and archives: The tar command
The tar command stands for "tape archive". It is the "standard" way to read and write archives (collections of files and whole directory trees).
Often you will find archives of stuff with names like stuff.tar, or stuff.tar.gz. This is stuff in a tar archive, and stuff in a tar archive which has been compressed using the gzip compression program respectivly.
Chances are that if someone gives you a tape written on a UNIX system, it will be in tar format,and you will use tar (and your tape drive) to read it.
Likewise, if you want to write a tape to give to someone else, you should probably use tar as well.
Tar examples:
tar xv Extracts (x) files from the default tape drive while listing (v = verbose)
the file names to the screen.
tar tv Lists the files from the default tape device without extracting them.
tar cv file1 file2 Write files 'file1' and 'file2' to the default tape device.
tar cvf archive.tar file1 [file2...] Create a tar archive as a file "archive.tar" containing
file1, file2...etc.
tar xvf archive.tar extract from the archive file
tar cvfz archive.tar.gz dname Create a gzip compressed tar archive containing
everything in the directory 'dname'. This does not
work with all versions of tar.
tar xvfz archive.tar.gz Extract a gzip compressed tar archive. Does not work with all
versions of tar.
tar cvfI archive.tar.bz2 dname Create a bz2 compressed tar archive. Does not work
with all versions of tar.

File compression: compressgzip, and bzip2
The standard UNIX compression commands are compress and uncompress. Compressed files have a suffix .Z added to their name.
For example:
compress part.igs Creates a compressed file part.igs.Z
uncompress part.igs Uncompresseis part.igs from the compressed file part.igs.Z.
Note the .Z is not required.
Another common compression utility is gzip (and gunzip). These are the GNU compress and uncompress utilities. gzip usually gives better compression than standard ompress, but may not be installed on all systems. The suffix for gzipped files is .gz
gzip part.igs Creates a compressed file part.igs.gz
gunzip part.igs Extracts the original file from part.igs.gz
The bzip2 utility has (in general) even better compression than gzip, but at the cost of longer times to compress and uncompress the files. It is not as common a utility as gzip, but is becoming more generally available.
bzip2 part.igs Create a compressed Iges file part.igs.bz2
bunzip2 part.igs.bz2 Uncompress the compressed iges file.

Looking for help: The man and apropos commands
Most of the commands have a manual page which give sometimes useful, often more or less detailed, sometimes cryptic and unfathomable discriptions of their usage. Some say they are called man pages because they are only for real men.
man ls Shows the manual page for the ls command You can search through the man
pages using apropos
apropos build Shows a list of all the man pages whose discriptions contain the word
Do a man apropos for detailed help on apropos.



Advance Table In OAF,1,AOL Concepts,18,AP Holds,1,Apps Initialization,1,Blanket Purchase Orders,1,Blanket Releases,1,Careers,9,Common Errors and Solutions,2,Concurrent Programs,10,Contract Purchase Orders,1,Corporate Culture,3,Corporate Ladder,3,Customer Interface,3,Customization,1,De-Normalization,1,EAM,1,EBS Tutorials,10,Education,16,Emterprise Asset Management,1,English,1,Enterprise Asset Management,1,Entrepreneur,1,Error Fixes,1,Executables,2,Extension,1,fnd_user,1,FNDLOAD,1,Global Agreements,1,Guest Posts,7,Handy Scripts,63,Health Tips,1,Important Apps Queries,1,Infographic,3,Interview Preparation,57,Interview Q/A,57,Inventory Org ID,1,Iproc,4,Iprocurement,4,IT,3,jDeveloper,1,Job Search,1,Key Tables In Oracle Apps,5,Learning English,1,MDS,1,Metadata Tables,2,Multi Org Architecture,2,Normalization,1,O2C,1,OAF Interview,49,OAF Personalization,1,OAF Tutorials,52,Operating Unit,1,Oracle Alerts,1,Oracle AP,11,Oracle APIs,4,Oracle Application Object Library,19,Oracle Applications,10,Oracle Apps,2,Oracle Apps Interviews,29,Oracle Apps Tips,8,Oracle Apps Tutorials,97,Oracle AR,18,Oracle Assets,2,Oracle Dabase Structure,2,Oracle Database Architecture,2,Oracle Database Key Tables,3,Oracle EAM,2,Oracle EBS,5,Oracle Financials,2,Oracle Forms And Reports,17,Oracle Forms Interview Questions,6,Oracle Forms Tutorials,6,Oracle GL,4,Oracle Holds,1,Oracle HRMS,10,Oracle Human Resources,1,Oracle Inventory,4,Oracle Payables,1,Oracle Payroll,1,Oracle POTutorials,1,Oracle Purchasing,7,Oracle Reports Interview,9,Oracle Reports Tutorials,3,Oracle System Administrator,4,Oracle Workflow,3,Order Management,2,Organization ID,3,Organizations,3,Performance Tuning,2,Personalization,1,PL/SQL Block,1,PL/SQL Interview Questions,11,PL/SQL Scripts,44,PL/SQL Tutorials,53,Planned Purchase Orders,1,PO,1,PO Action History,1,PO_ACTION_HISTORY,1,POracle Purchasing,1,PR,1,Procedures And Functions,2,Profile Options,2,Purchase Orders,1,Purchase Requisition,2,Receipts,1,Request Groups,1,Responsibility,1,Shell Script,1,SOA Tutorials,4,Social Media,1,Software Industry,2,Software Tools,1,SQL And PL/SQL Interview,38,SQL Interview,51,SQL Scripts,38,SQL Tutorials,43,Standard Purchase Orders,1,Troubleshooting,1,Unexpected error,1,Unix/Linux Commands,3,User,1,Value Sets,1,Weblogic,1,XML Publisher,3,
Oracle Apps Guy: Most Frequently Used Unix Commands - The Complete Reference
Most Frequently Used Unix Commands - The Complete Reference
Most Frequently Used Unix Commands - The Complete Reference
Oracle Apps Guy
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy