Friday, February 14, 2014

Most Commonly Used UNIX command


change directory - cd /u02/oracle/admin
open a specific file - vi Employee.txt
List all the files and directories - ls -ltr
To get the Present working directory - pwd
To search all the files for a specific string - grep 'Echo' *.*
Issue Sudo command - sudo su - adfadmin
Clear the screen - clear
Remove specific file - rm Employee.log
How to tail specific file - tail -f Employee.log
How to close a file in VI mode without saving - Esc :q!
How to save a file in VI mode - Esc:wq!
How to reach last line of file in vi Mode - Esc : $ Enter

How to search from bottom of the file to Top of the file ?
Answer : open file in vi mode, Hit 'Esc : $' and press enter - enter '/<search string>' hit enter - Hold Shift +n

How to find a specific file in by file name ?
$ find . -name 'config.cmd'

How to find a specific directory/folder in linux by name
Answer : $ find / -type d -name 'foldername'

How to Monitor performance of CPU, Memory
Answer : $ top
How to find Virtual Memory statistics ?
Answer : $ vmstat

How to change permissions to a specific file ?
chmod 644 ravi.txt

Below is the description for each file
7 = 4+2+1 (read/write/execute)
6 = 4+2 (read/write)
5 = 4+1 (read/execute)
4 = 4 (read)
3 = 2+1 (write/execute)
2 = 2 (write)
1 = 1 (execute)

chmod 666 ravi.txt read/write by anybody! (the devil loves this one!)
chmod 755 ravi.txt rwx for owner, rx for group and rx for the world
chmod 777 ravi.txt read, write, execute for all! (may not be the best plan in the world...)

How to telnet a specific port 
Eg : telnet <server_name> <portNum> eg : telnet uxunt540 4444

- Follow below command to see all the properties and configuration parameters for a specific server instance

       ps -eaf | grep WC_CustomPortal1

- Follow below command to grep for specific string
      find . -type f -exec grep "=jdk" {} \;

- Follow below command to copy a specific file with different name
      $ cp setDomainEnv.sh setDomainEnv_07-72014.sh
Ref : http://www.tecmint.com/command-line-tools-to-monitor-linux-performance/

- Follow below command to execute shell script
   ./<script_name>.sh
  Also , bash test.sh

- How to take Thread Pool Dump in Unix.
      - Issue below command : ps - ef | grep java , Which will give you process ID (pid) as shown below
   - Once determining pid using above step, then issue below command
                kill -3 <pid> , This will generate thread dump in server STDOUT.
- To all the running processes
                   ps –ef | grep java

 - To Kill any specific running process
          Kill -9 pid
- To see installed Lunix s/w
        uname -a
- To see memory on linux 
           grep MemTotal /proc/meminfo
           grep SwapTotal /proc/meminfo
           df -h /tmp
- Search for all the groups exists in Linux
   cat  /etc/group

- How to create  a new group ?
        groupadd -g 800 dba

- To find specific user details
          id <user name > example : id oracle
- How to install a JAR file in linux environment ?
           java -jar installer.jar

-How to install specific missing RPM ?
           yum install <rpm name>

- How to install a rpm ?
      rpm -i <rpm Name> to install any rpm

- How to perform Update on linux machine ?
     yup update

- How to reboot Linux machine ?
       reboot
- Installing Oracle Fusion Middleware installers on linux machine
  ./runInstallaer -jreLoc usr/java/jdk... (Enter)

-How to set Display attributes in Linux machine
   DISPLAY 111.111.45.254:0.0; export DISPLAY

Ref : http://middlewaremagic.com/weblogic/?p=823

No comments:

Post a Comment