BASISWORLD

Start, Learn and work on SAP Basis.

Showing posts with label SAP BASIS UNIX. Show all posts
Showing posts with label SAP BASIS UNIX. Show all posts

Thursday, October 25, 2018


 Useful Unix commands for basis consultant



                                 CREATING AND DELETING FILES

cat  > filename
              file will be created
cat >> filename
             append contents to existing file.
touch file1 file2
       no.of files will be created.
rm filename
       file will be deleted.





CREATING AND REMOVING DIRECTORIES


mkdir dir1 dir2
        no.of directories will be created.
rmdir dir1 dir2
        no.of empty directories will be deleted
rm –rf dir1
        it removes directories with contents.
cd
        to change one directory to another directory







pwd
    to know present working directory.
ps –ef
    to know all processes.
kill pid
    to kill particular process.
kill –9 pid
    to kill process forcefully.
vi filename
    to edit file in vi.




ls filename
              Lists all files and directories.
ls –l
             it gives full information of files and directories.
ls –a
             it displays hidden files
ls –p
             shows difference b/w files and directories.
ls –i
            Displys inode no of files and directories.





File permissions


We have two ways to assign permissions to files
          1. Numeric mode
          2. Symbolic mode or relative mode



Numeric mode

We assign numerics to permissions like
       read       4
       write      2
       execute  1
chmod 777 filename/dirname
        assign full permissions to all users.
chmod 666 filename/dirname
         it assigns read and write permissions to all users



chgrp newgroupname file/directory
      it changes groupname for file or directory.


chown newownername file/directory
               it changes owner for file or directory.

Symbolic mode or relative mode


     Here we assign symbols to users.
    owner     u
    group      g
    others      o
    all            a
    read          r
    write        w
    execute     x
    adding permissions        +
    removing permissions    -


To assign permissions

    chmod ugo+rwx file/dir.


      To remove permissions

    chmod ugo-rwx file/dir.



                                        Network communication


In hetrogenous and homogenous environment
     
     telnet  ipaddress
          it connets to remote system
      ftp  ipaddress
      scp /dir  ipaddress:/dir
           it copies date from source system to target  system
      ssh  ipaddress:mkdir /dir
           it executes commands in remote system.      
 


Only in homogenous environment
  
     rlogin ipaddress

     rcp /dir  ipaddress:/dir

     rsh ipaddress:rm /file

                                     User commads

useradd –u uid –g gid –G gid –d  homedirecory –m –s sh username
           it adds user g for primary group
                              G for secondary group
                              d,m for  homedirecoty
                               s  for default shell
                               u  user id
 su – username
          to swith from one user to another user.



who
       displays all users who are currently logged in system.
who am I
       displays detailed information about current logged in user.
last
       displays information about when system is lastly rebooted,who,time.
finger
       information about current logged in user.



                           filesystems



df
              it displays all filesystems with sizes
df –h
              it displays all filesystems with human readable form.

du         to know disk utilization




Shutdown commands

                           


shutdown
init 0      
      like shutdown
init 1
      single user mode
init 6
       like  reboot
reboot
poweroff


                           copy or move

To copy a file
            cp sourcefile targetfile
 To copy empty directory
            cp sourcedir targetdir
 To copy directory with all contents
            cp –r sourcedir targetdir
To move file
            mv sourcefile targetfile
To move directory
            mv sourcdir targetdir         



                                  creating links


To link file or directory in same filesystem
       ln soucefile/dir  targerfile/dir
    this is called hard mounting
If you link souce file or dir with another file which is in different file system that is called soft mounting
     ln –s sourcefile/dir targetfile/dir
For help
     man command




Pattern search


To seach for a single word in a file
     grep word filename
     it displays all lines which contains this word
To seach multiple words
     egrep word1 | word2 filename
To seach for a text
     fgrep text filename



                   find

searches in current directory for file or directory.

find . –name “<file>/<directory>” –type f/d  -print


type options:

              b      block (buffered) special
 
              c      character (unbuffered) special
 
              d      directory
 
              p      named pipe (FIFO)
 
              f      regular file
 
              l      symbolic link 

to search files exact n th day old from now


find . –name “<file>/<directory>” –mtime n –print


to search files morethan  n days old from now.


find . –name “<file>/<directory>” –mtime +n –print


to search files from n days old from now.

find . –name “<file>/<directory>” –mtime -n –print


for searched files in range( from more than 64 days old to 95 days old)

find . -name "*" -a "(" -mtime +64 -a -mtime -95 ")" -exec ll {} \;



to know files in current directory which are more than 10M size.

find . -type f -size +10M -exec ls -l {} \;       (for files)
                                        or

find . -xdev -size +10000000c -exec ls -l {} \;                          (for files and directories)


             `b'    for 512-byte blocks (this is the default if no suffix                
                    used)
 
              `c'    for bytes
 
              `w'    for two-byte words
 
              `k'    for Kilobytes (units of 1024 bytes)
 
              `M'    for Megabytes (units of 1048576 bytes)
 
              `G'    for Gigabytes (units of 1073741824 bytes)



If you want to see if you have any directories with world write permission, use:
find . -type d -perm 777 –print













Saturday, November 12, 2016

CREATING AND DELETING FILES


•cat  > filename
      file will be created
•cat >> filename
     append contents to existing file.
•touch file1 file2
       no.of files will be created.
•rm filename
       file will be deleted.

CREATING AND REMOVING DIRECTORIES
•mkdir dir1 dir2
        no.of directories will be created.
•rmdir dir1 dir2
        no.of empty directories will be deleted
•rm –rf dir1
        it removes directories with contents.
•cd
        to change one directory to another directory
       
•pwd
    to know present working directory.
•ps –ef
    to know all processes.
•kill pid
    to kill particular process.
•kill –9 pid
    to kill process forcefully.
•vi filename
    to edit file in vi.

•ls filename
    Lists all files and directories.
•ls –l
   it gives full information of files and directories.
•ls –a
   it displays hidden files
•ls –p
   shows difference b/w files and directories.
•ls –i
  Displys inode no of files and directories.

File permissions

We have two ways to assign permissions to files
          1. Numeric mode
          2. Symbolic mode

Numeric mode

•We assign numerics to permissions like
       read       4
       write      2
       execute  1
•chmod 777 filename/dirname
        assign full permissions to all users.
•chmod 666 filename/dirname
         it assigns read and write permissions to all users


•chgrp newgroupname file/directory
      it changes groupname for file or directory.
•chown newownername file/directory
     it changes owner for file or directory.
example; chown sidadm:sapsys newdir
Symbolic mode
     Here we assign symbols to users.
•    owner     u
•    group      g
•    others      o
•    all            a
•    read          r
•    write        w
•    execute     x
•    adding permissions        +
•    removing permissions    -


     To assign permissions
•    chmod ugo+rwx file/dir.
example chmod 755 newdir
      To remove permissions
•    chmod ugo-rwx file/dir.

Network communication

In hetrogenous and homogenous environment
     
•     telnet  ipaddress
          it connets to remote system
•      ftp  ipaddress
•      scp /dir  ipaddress:/dir
           it copies date from source system to target  system
•      ssh  ipaddress:mkdir /dir
           it executes commands in remote system.      
 

      Only in homogenous environment
  
•     rlogin ipaddress
•     rcp /dir  ipaddress:/dir
•     rsh ipaddress:rm /file


User commads

useradd –u uid –g gid –G gid –d  homedirecory –m –s sh username
           it adds user g for primary group
                              G for secondary group
                              d,m for  homedirecoty
                               s  for default shell
                               u  user id
su – username
          to swith from one user to another user.


Users monitoring

•who
       displays all users who are currently logged in system.
•who am I
       displays detailed information about current logged in user.
•last
       displays information about when system is lastly rebooted,who,time.
•finger
       information about current logged in user.

•df
    it displays all filesystems with sizes
•df –h
    it displays all filesystems with human readable form.


Shutdown commands

•shutdown
•init 0      
      like shutdown
•init 1
      single user mode
•init 6
       like  reboot
•reboot
•poweroff


To copy a file
            cp sourcefile targetfile
 To copy empty directory
            cp sourcedir targetdir
 To copy directory with all contents
            cp –r sourcedir targetdir
To move file/ rename file
            mv sourcefile targetfile
To move directory rename directory
            mv sourcdir targetdir          



Tuesday, November 8, 2016

Today, I'm going to introduce the concept of mount points. Mount points are, in essence, folders in which external filesystems are mounted (their contents are dropped into that folder). We'll be going into that in a bit more detail in just a second. First of all, the obligatory Wikipedia definition:
A mount point is a term used to describe where the computer puts the files in a file system on Unix-like systems. For example, many modern Linux distributions automatically mount the CD drive as /mnt/cdrom, so the contents of the CD drive will appear in the /mnt/cdrom directory. A device can be mounted anywhere on the directory structure. Normally only the root user can mount a new file system but systems are often configured so that users may mount pre-set devices. A file system can be mounted by running the mount utility.
Windows, OS/2 and other operating systems that have their heritage in DOS and the old days of the IBM PC, use a drive letter structure to access different devices on the system. I'm sure you're aware of the idea of the C drive under Windows.
Well, Unix-like operating systems don't work anything like that, I'm afraid.
Let's have a quick example. I've got a 512 MB USB stick and I plug it into my PC running Linux. Behind the scenes, the operating system does the following:
Creates a folder called /media/PETER512 (PETER512 is the volume name of my USB stick).
Mounts the USB stick's contents inside this new folder
Fairly simple. So what does it actually do when it mounts the contents? Think of it as taking the contents of the device and dropping them into that folder. Now, if you browse to that folder, you can read and write the contents of the actual device, just as if it was a normal folder on your hard drive.
The folder (which is the mount point - the point where that device is mounted) can be anywhere, but it's a convention that you use /media or /mnt. Equally, it doesn't have to be a USB stick. CDs, DVDs, network drives, removable hard drives, even .iso image files, can be mounted so you can access them and interact with them.
And finally, a quick command line practical exercise. You will need to know the device string of whatever you want to mount, which unfortunately makes this process a bit geeky and difficult. In this example, I'm using /dev/sda1 (which is what most USB devices are if you have IDE hard drive).
In most cases, you also need administrator/root privileges to mount and unmount.
# mkdir /mnt/mymountpoint
# mount /dev/sda1 /mnt/mymountpoint
When you're done, you can unmount the device with umount (optionally, you could also rmdir the folder if you don't need it).
# umount /mnt/mymountpoint
Peter Upfold - http://peter.upfold.org.uk/
Peter Upfold is a technology enthusiast from the UK. Peter’s interest in Linux stems back to 2003, when curiosity got the better of him and he began using SUSE 9.0. Now he runs Linux Mint 9 on the desktop, runs a CentOS-based web server from home for his personal website and dabbles in all sorts of technology things across the Windows, Mac and open source worlds.


Maintaining the Transport Directory 
Procedure
For tp, the transport directory must fulfill the following requirements (depending on the operating system):
UNIX
In a transport network, there must be a single physical transport directory that can be reached from each host with the same path.
In UNIX systems, this directory can be a soft link, pointing to the correct transport directory or mount point.
You must store the chosen path in two parameters:
  • Parameter DIR_TRANS for the SAP System in the instance profile
The default value for the transport directory is /usr/sap/trans in UNIX.

Windows
Transport groups comprised of Windows systems, or of Windows and UNIX systems are supported.
For more information on creating a heterogeneous transport group, see Transport Control under Windows.
SAP allows you to name a central transport host on the Domain Name Server that is valid for all Windows systems.
For more information on specifying a central transport host on the domain name server, see Specifying the Central Transport Host.
Each transport group must have a single physical transport directory that can be accessed by all machines.
This directory is described by the parameters:
  • transdir (transport profile)
  • DIR_TRANS (instance-specific profile)
If you have entered a transport host on the domain name server, the directory is under \\$(SAPTRANSHOST)\sapmnt\trans by default.
Otherwise it is under \\$(SAPGLOBALHOST)\sapmnt\trans .
The transport directory is described by the following parameters:
  • SAPTRANSHOST
Name of the host configured as the central transport host on the domain name server
  • SAPGLOBALHOST
Name of the host on which the central system is installed
  • sapmnt
Global share that points to the \usr\sap file tree on the central instance
Note the different naming conventions used for the parameters transdir and DIR_TRANS:
The path entered for the parameter DIR_TRANS does not end with a "\", whereas the path entered for the parameter transdir does end with a "\":
DIR_TRANS = T:
transdir = T:\
The DIR_TRANS profile parameter that you set and the parameter transdir in the transport profile must point to the same transport directory.
IBM eServer iSeries
In a transport network, there must be a single physical transport directory that can be reached from each host with the same path.
In iSeries systems, this directory can be a soft link, pointing to the correct transport directory or mount point.
You must store the chosen path in two parameters:
  • Parameter DIR_TRANS for the SAP System in the instance profile
The default value for the transport directory is /usr/sap/trans in iSeries.