Wednesday, 10 February 2016

Usefull Unix commands for SAP basis Consultant

Below are few useful UNIX command which can be used in your daily task. Unix commands are case sensitive and be careful while running any of these command.Listing of files:

  • ls -lt | more  : list of files, sort by date
  • ls -lR | more : list of files including sub directories (recursive mode).
  • ls -l | sort +4nr | more : List of files sort by size.
  • Space administration:
  • bdf . : Current file system usage.
  • bdf : List of the moutpoint with utilization and free space.
  • df -k : same as above but with more details.
  • df -k . : Current filesystem usage.
  • du -k : List of file with current utilization including sub directories.
  • du -k . : List of files with size in the current directory.
  • Create / Copy /  Move / ftp files:
  • vi <file_name> : Edit / change the file content. And also the same command is used for creating the new file.
  • mv <source_file> <target_path and target_file> : move a file from one location to other or same location. Ex. (mv abc.txt pqr.txt) (mv /home/abc.txt /home/Q47/abc.txt. Be careful while running this command.       
  • cp <source_file> <target_path and target_file> : Make a copy of a file from one location to other or same location. Ex. (cp abc.txt pqr.txt) (cp /home/abc.txt /home/Q47/abc.txt. Be careful while running this command.
  • ftp <host_name> : Copy local files from windows machine to Unix server. Ex. below:
    • ftp sapux003
    • Will prompted user name and password and then it will connect to the UNIX server.
    • bin : Enable the binary mode.
    • hash : Enable the (#) mode.
    • put <file_name>
  • General Commands:
  • last : List of the users who logged into the system, ordered by current date.
  • top : List of process which are using high CPU, memory etc..
  • date : today's date.
  • tail -f <file_name> : Will show the last few lines of the file, and also will update if the file is being modified.
  • tail -<last_line_numbers> <file_name> : same as above but will display the lines which you have mentioned in the option. Ex. tail -100 <file_name>.
  • pwd : show current directory.
  • uptime : System Uptime, from when the system is up.
  • ps -eaf | grep <process> : Process are running with the <text> Ex. ps -eaf | grep ora
  • w : currently logged on users.
  • whoami : Show which user you are logged in.
  • env : Show environment variables.
  • echo $<variable_name> : Show the variable output. Ex. echo $ORACLE_HOME.
  • Useful commands while working with SAP under UNIX:
  • dpmon : Work process list at OS level as SM50.
  • disp+work -V | more : Current version of the disp+work file.
  • R3trans -d <SID> : Check whether the R/3 is able to connect to the DB, the log will be generated at OS level in same directory as "trans.log".
  • R3trans -x <SID> : Check whether the R/3 is able to connect to the DB, the detailed log will be generated at OS level in same directory as "trans.log".
  • tp connect <SID> : Check whether the tp is able to connect to the DB or not.
  • SAPCAR -xvf <car/sar_file> : Uncar the SAR/CAR files.
  • Use the <SID>adm for SAP related activity.
  • Use the ora<SID> for oracle related activity.

1 comment: