(Linux) - Unix/Linix Commands
(Linux) - Unix/Linix Commands
43$ nohup <cmd_name> &nohup is very useful command. it runs the command even the telnet
connection is closed/broken.& is used for running command in background.
44$ uptimewill show how long the system has been up and also shows cpu load, number of
users logged in etc.
45$ lastWill show the users logged in/out informationlast <user_name> shows particular user
logins/logoutslast reboot shows all the system boots
46$ idshows current user's UID, username and GID and group name
47$ hostidshows unique identifier of host
48$ uname -awill show system name, solaris version, platform and some more information
49$ isainfo -vshows supported platforms (32-bit, 64-bit)
50$ hostnamewill give your system name.
51$ envList the environmental variables set to your current session
52$ rm - <-filename>for deleting special files$ rm "<file name>"delete file names with spaces
in between
53$ useradd <username>Adding a user to the system$ userdel <username>Deleting a user
from the system
54$ echo $TERMShows terminal type like vt100, vt220 etc.($PATH, $ORACLE_HOME etc
can be used with echo)
55$ du sk <dir/file name>Display the size of the files/folder
56$ df -kwill show all the mounted filesystems.
57$ mountwill show all mounted file systems with additional info like large filesystem support
etc
58$ pkginfo Gives/shows info about installed packages/software on system
59$ showrev pshows all patches installed on system
60$ init 0will shutdown the system
61$ init 6will reboot the system (other init options are 1, 2, 3, 5 and S)
62$ alias l='ls -l'alias dir='ls -l|grep "^d"'alias p='pwd'alias c='clear'Short cuts for commonly
used commands
63tar -cvf allfile.tar /<directory_name> copies all files under directory to allfile.tar$ tar -xvf
allfile.tar /homeretrieves tar files to /home directory$ tar -tvf allfile.tar reads contents of
allfile.tar
64$ /usr/sbin/ifconfig -aWill show the ip-address of the system.lo0 : loopback interfacehme0 :
hundred MBPS n/w interfaceqfe0 : quad ehternet interface
65$ ping <hostname>will ping and test connectivity between your system and the hostname you
give in the ping.you can also give ping <ip-address>
66$ set -o viWhile your shell is set to KSH use this command to display history of commands
you are typingPress ESCAPE and k for showing previous commands
67$ ifconfig unplumb hme0 will disable ehternet interface hme0
68$ ifconfig plumb hme0 will enable hme
069$ mount will show the disks mounted and all partitions
70$ top shows all process and memory, cpu etc utilisation
71$ prtconf shows h/w, cpu, memory conf
72$ cd /usr/platform/sun4u/sbin/prtdiag -v shows additional configuration of memory, cpu
speed etc..
73$ sysdef shows system h/w, memory, and other internal configurable/tunable paramters
74$ sar A system archive report, gives total system report for cpu, memory, disk, etcc
75$ mpstat shows multi cpu statistics like load on each cpu.
76$ iostat disk utilisation, cpu, io wait etc (iostat -xcM gives extented statistics of disk activity,
cpu etc)
77$ vmstat memory and virtual memory utilization
78$ prstat shows process related statistics (present from solaris 2.7 and above)
79$ netstat shows network statistics
80$ lsof -p <pid>List the opened files for the process
81$ psrinfo gives processor/s information (online/offline)
82$ truss -p <PID>shows system calls and signals (useful when debugging process)
83$ stty erase ^Hsets backspace for deleting typed character
84$ strings <file_name>shows printable strings in any type of file (binary, object, text etc)
85$ formatwill show all the disks configuration and partitions
86$ prtvtoc shows disk partition/geometry info
87$ uadmin 2 0 stops system immediately within 5 seconds(BE CAREFUL-- has to be to root)
88$ halthalts processor and reboots machine (BECAREFUL -- has to be root)
89$ adb debugging tool (for reading/debugging corefiles)
90$ dos2unix <filename>Convert dos formatted file to unix format
91$ mkfile 60m <swap file name>creates a filename of size 60mb which can be used for adding
to swap space
92$ swap -a <swap file name>attaches the 60mb file to swap space (Very useful when swap
space is running out)
93$ swap -l lists the swap contents
94$ sleep 5waits for 5 seconds (useful in shell scripts)
95$ cat <file_name> |awk '{print $1}'Prints the first field of the filed ($1, $2... can be used to
display more fields)
96:1,$s/<old>/<new>/guse the above for global replacement of text in ascii files using vi editor
97:1,$s/^M//gremove Ctrl M character in text files using vi editor
98$ ksh x <file name.sh>Will compile the shell file line by line
99PS1=[$(hostname)]'$ORACLE_SID@$PWD>'Add this entry on .profile , you can view the hostname ,
$VARIABLE,current directort path
/etc/passwd it will show all the logins, home directories of the users.
/etc/shadow shows password encryption info and other user related info (only root has access
to this file)
/etc/system This file has all n/w, h/w, memory etc tunable parameters
/values/etc/inittab This file defines the default run level of the system.
/etc/hosts This file contains the list of hosts/IP address
/etc/services This file contains the port/service Name
/etc/nsswitch.conf This file is used to configure which services are to be used to determine
information such as hostnames, password files, and group
/etc/ntpd.conf This file is used to configure Network Time Deamon
/etc/inetd.conf This file tells which ports to listen to and what server to start for each port
/etc/syslog.conf This file have the configuration log file location and rotation sequence
/etc/sudoers contains the list of user names with the command allowed to execute by the user
with additional privileges
/etc/fstab This file contains the list of file system and it mount points
/etc/resolv.conf contains the DNS server names for the name resolution
gunzip file_name
3) To run the strings for the spawand program:------------------------------------------------------------strings -a (shell_script_file_name) > (logfile.log)
Example:strings -a GLPURGE > /home/partners-home/hex/preddy/phani1.log
3.1) Basic grep command:----------------------------------Example:grep 'DROP index' adwork001.log > /home/partnershome/xyz/preddy/dropindex.txt
Note:- grep command is just like the search for some specfic word in yourwindows file.
In Windows Operating System, we use the (CTRL+F) and then we give the word we
want to search. Similarly, grep is used for UNIX or LINUX Operating system. In the
above Example, I am searching for the 'DROP index' Word in adwork001.log file. And I
want all the finding of this search stored in some file. So, I have given the path and file
name where it should save.
4) Specfic to some project:-------------------------------------To check the number lst files:----------------------------------------Example:ls -altr *.lst | wc -l
Note:- If some folder have some specfic extension files, then we can count the number
of that specfic extension files then we can use the above command. In the above
example, I am searching for the 'lst' extension files count.To check the number of sql
files with hit files :-----------------------------------------------------------grep '\.sql' *.lst | wc -l
Note:- Say, we have some .sql files names in all the lst files in some folder. Then we can
use the grep command to count the sql file names.To check the number of files with
hits in the lst file:-----------------------------------------------------------------grep 'Number of files with hits : [1-9]' *.lst
Note:- You can also give the count of the files with the range. In the above example, I
have givne the range from 1 to 9. If it find any number from this range then, it will get
in the count.To create the file of the complete module :-------------------------------------------------------grep '\.sql' *.lst > lst_sql_'module_name'.txt
Example:grep '\.sql' *.lst > lst_sql_gl.txt
Note:- The above example to do the search and to the search results in some given file
name.
5) To find the file in the current folder and subfolder:--------------------------------------------------------------------find . -name file_name*.sql -print
Example:find -i . -name 'poXWFUNT*.sql' -print
Note:- POXWFUNT.sql is the file name which I want to search. 'i' in the above
command indicates that, search should not be based on case sensitive.
6) To grep the file for a specific word:------------------------------------------------grep -i 'WORD' FILE_NAME > log_file_name
Example:grep -i 'ALTER table' adwork001.log > altertable.txt
8) To know the path of the log and out files of the application:----------------------------------------------------------------------------->>cd $APPLCSF
There you will have the log and out folders.
You can also try the following command to know the value of the APPLCSF variable.
env | grep log
9) Turn-on the application server:---------------------------------------------./oraWebAndForms.sh start Instance name
Example:./oraWebAndForms.sh start XYZ12
Note:-----1) XYZ12 is the Instane name.
2) After turnning the Database and concurrent manager up. still the application front
end will not open. The you need to run the above script from the applmgr user
To login to different user:-----------------------------sudo su - applmgr
Note:- applmgr is the superuser name. This username can depends on the DBA, what
they have given at your Instance.
9.1) If you are getting 500 Internal error message after bounce back then try this:----------------------------------------------------------------------------------------------------Try to restart your application and restart your manage and see if it resolve the issue.
For the 12 Release, the above solution may not work. After you cleared _pages in R12,
you'll need to recompile because the default mode is 'justrun' instead of 'recompile' as
was in 11i.
I did the following while applmgr in my Instance XYZ12 env and the login now works:
1. cd $FND_TOP/patch/115/bin
2. ./ojspCompile.pl --compile --flush -p 2
(You can check if you are able to open the application or not). If you are still facing the
issue then try rebounce the application and see if it resolve the issue).
15) Admin utility to compile all the invalid objects:----------------------------------------------------------------i) This utility is avilable for the applmgr user. Use the following command to login with
applmgr user.
>>sudo su - applmgr
ii) Choose the Intance and then use the following command to run the adadmin utility.
>>adadmin
{ Note:- It will ask for the $APPL_TOP path. If the default path is not the correct one
then provide the correct path.
It will ask for the Log file name. (Default name willl be (adadmin.log)).
It will ask if you can be notified by email if a failure occurs. (Default will be set for NO).
It will ask for the Batchsize (Default is 1000).
19) DF:- To find out how much space is left on the fileserver, use the following
command. > df .
20) DU:-The du command outputs the number of kilobyes used by each subdirectory.
Useful if you have gone over quota and you want to find out which directory has the
most files. From your home-directory, use the following command.
> du -s *
The -s flag will display only a summary (total size) and the * means all files and
directories.
21) GZIP:--------------This reduces the size of a file, thus freeing valuable disk space. This is compress the file.
Is it similar to the Winzip in the Windows Operating system.
Example:> ls -l phani.txt
note the size of the file using ls -l , then to compress phani.txt, use the following
command.
> gzip phani.txt
This will compress the file and place it in a file called phani.txt.gz
To see the change in size, use ls -l again.
To expand the file, use the gunzip command.
> gunzip phani.txt.gz
This is similar to the Unzip the file in your Windows Operating system.
22) ZCAT:---------------zcat will read gzipped files without needing to uncompress them first.
> zcat phani.txt.gz
If the text scrolls too fast for you, pipe the output though less .
> zcat phani.txt.gz | less
23) FILE:File classifies the named files according to the type of data they contain, for example
ascii (text), pictures, compressed data, etc.. To report on all files in your home directory,
use the following command.
> file *
24) DIFF:---------------This command compares the contents of two files and displays the differences. Say you
have a file called file1 and you edit some part of it and save it as file2. To see the
differences use the following command.
> diff file1 file2
25) ECHO:-----------------echo $variable_value
The value of the environment variable can get from the echo command.
Example:echo $APPL_TOP
In the above command we get the APPL_TOP variable value set in the environment file.
APPL_TOP is the environment variable in the environment file.
26) General Commands:-----------------------------Command
Meaning
ls
ls -a
mkdir
make a directory
cd directory
cd
change to home-directory
cd ~
change to home-directory
cd ..
pwd
cp file1 file2
mv file1 file2
rm file
remove a file
rmdir directory
remove a directory
cat file
display a file
less file
head file
tail file
wc file
command1 |command2
sort
sort data
who
man command
whatis command
apropos keyword
ls -lag
command &
^C
^Z
bg
jobs
fg %1
kill %1
ps
kill 26152