Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
vyvarya0608
Discoverer
0 Kudos

Part 1 link:- https://community.sap.com/t5/technology-blogs-by-members/part-1-sap-basis-os-support-on-suse-linux-f...

 

Basic commands

Linux administrator can login with tools like putty or kitty or other applications available in market or allowed by customer, with either root or sidadm. Whereas both the IDs have different rights W.R.T  OS and sap application. ​

CLEAR:- The clear command will clear the terminal screen. This command can be useful if you worked for quite a while on one and the same terminal. You might want to clean it because your screen might seem “messy”. Just run clear – this lets you “wipe out” all words in the terminal.

SU and SUDO:- The su command can help you to switch to superuser. The superuser is the system user who has all permissions to be able to perform administrative tasks. Some commands require superuser privileges. As an example, only the superuser can shut down the computer. When you use the command sudo as prefix, you can promote your privileges to superuser temporarily. As an example, you can type sudo poweroff to run the command to shut down the computer.

POWEROFF and REBOOT:- The command poweroff shuts down the running system, while the command reboot cares for a reset of your system. Both commands require superuser privileges.

 

ZYPPER Commands​​

Zypper and YaST are the Package Manager for SUSE Linux, which works on top of RPM

YaST which stands for Yet another Setup Tool is a tool that works on OpenSUSE and SUSE Enterprise edition to administer, setup and configure SUSE Linux.

Zypper is the command line interface of ZYpp package manager for installing, removing and updating SUSE. ZYpp is the package management engine that powers both Zypper and YaST

 

Run zypper without any option, will give you a list of all global options and commands.

vyvarya0608_0-1712664394015.png

To open zypper shell session run the below command.

vyvarya0608_1-1712664449932.png

 

 

To get help on a specific command say ‘in’ (install), run the below commands

vyvarya0608_2-1712664449935.png

 

Search for a package (say gnome-desktop) before installing.

vyvarya0608_3-1712664449940.png

 

Use zypper repos or zypper lr commands to list all the defined repositories.

vyvarya0608_4-1712664449943.png

 

Use commands zypper refresh or zypper ref to refresh zypper repositories.

vyvarya0608_5-1712664449945.png

 

To refresh a specific repository say ‘repo-non-oss‘, type:

vyvarya0608_6-1712664449946.png

 

 

We use ‘zypper modifyrepo‘ or ‘zypper mr‘ commands to disable, enable zypper repositories.

Before disabling repository, you must know that in Zypper, every repository has its own unique number, that is used to disable or enable a repository.

Let’s say you want to disable/enable any repository, to do the same first you need to its number by typing following command.

For example we need to disable/enable “repo-oss” so its number is “6”.

vyvarya0608_7-1712664449948.png

 

 

To disable

vyvarya0608_8-1712664449949.png

 

To enable

vyvarya0608_9-1712664449949.png

 

Install a Package with Zypper

With Zypper, we can install packages based upon capability name. For example, to install a package (say Mozilla Firefox) using capability name. use “zypper in <full package name>”  or    “zipper install <full package name>

vyvarya0608_10-1712664449952.png

 

 

File Permission in Linux

Every file and directory on your Unix/Linux system is assigned 3 types of owner, given below.

  • User ( user is the owner of the file. By default, the person who created a file becomes its owner)
  • Group (A user- group can contain multiple users)
  • Other (Any other user who has access to a file. This person has neither created the file, nor he belongs to a usergroup who could own the file. Practically, it means everybody else)

 

Permissions

Every file and directory in your Linux system has following 3 permissions defined for all the 3 owners discussed above

  • Read (4)
  • Write (2)
  • Execute (1)
  • Sticky bit (t) (A Sticky bit is a permission bit that is set on a file or a directory that lets only the owner of the file/directory or the root user to delete or rename the file. No other user is given privileges to delete the file created by some other user.)
  •  CHMOD command is used to change the permission of a file or directory

       E.g : chmod 777 fil1 (adding read+write_execute permission)

                 

                 chmod u-w file1 (removing write permission from user )

  •  CHOWN command is used to change the group of a file or directory

 

       e.g : chown root : root file1.txt

 

Add stickbit to file or directory

# chmod +t <directory name>/

vyvarya0608_11-1712664449952.png

 

Remove stickbit to file or directory

# chmod -t <directory name>/

vyvarya0608_12-1712664449953.png

 

 

  • Grep command is used to search pattern in file or directory

      grep B file1

     grep –r sid hosts ( to search recursively for pattern in directory )

  •  date  ( Show the current date and time )

vyvarya0608_13-1712664449953.png

 

 

  • Uptime

vyvarya0608_14-1712664449954.png

 

Combination:- 

vyvarya0608_15-1712664449954.png

 

 

  • cal (Show this month's calendar)

vyvarya0608_16-1712664449954.png

 

 

  • w (Display who is online)

vyvarya0608_17-1712664449955.png

 

 

  • whoami (Who you are logged in as)

vyvarya0608_18-1712664449955.png

 

 

  • CRONTAB Situation

How to schedule tasks, commands, or scripts to execute at specific times or intervals.Then crontab is the solution at Linux level. In SUSE linux crontab, cron.hourly, cron.daily,or cron.monthly allow scripts or commands to be run at specific times or intervals.

Cron jobs can be scheduled in many different methods with the most common being using /etc/crontab to schedule the script or command. This file is separated into seven columns with the format and description as follows:

vyvarya0608_19-1712664449956.png

 

 

  • Minute an integer from 0 to 59
  • Hour an integer from 0 to 23 (a 24 hour clock is used)
  • Day an integer from 1 to 31 (this must be a valid day for the given month. For exampleFeb 31will not work)
  • Month an integer from 1 to 12
  • Dayofweek integer from 0 to 7 where both 0 and 7 represent Sunday
  • User the user who cron will use to execute the command
  • Command the desired command to execute. This can be a script or a normal command like hwinfo >> hardware.txt

NOTE:- Crontab is very vast and we can perform and schedule many jobs and alerting at Linux level for the same.

 

OS Monitoring Commands​​

  • df –h (file system monitoring )​

vyvarya0608_20-1712664449957.png

 

  • du –sh ( shows the current directory size)

vyvarya0608_21-1712664449957.png

 

  • du –sh <directory> ( shows the mentioned directory size)

vyvarya0608_22-1712664449958.png

 

  • du –sh *  (shows the size of all files and

              subdirectories in current directory)​

vyvarya0608_23-1712664449958.png

 

 

  • top ( Current running processes(os level), memory , swap and cache … etc monitoring)

vyvarya0608_24-1712664449960.png

 

 

  • free –m or free –h ( Memory consumption analysis )

vyvarya0608_25-1712664449961.png

 

 

  • ps –ef ( Shows all the currently running work processes at os level )​
  •  ps –ef | grep sidadm ( shows processes running with particular sid , since there are other processes are also run at os level like hana related)

vyvarya0608_26-1712664449962.png

 

vyvarya0608_27-1712664449963.png

 

vyvarya0608_28-1712664449964.png

 

vyvarya0608_29-1712664449964.png

 

vyvarya0608_30-1712664449965.png

 

vyvarya0608_31-1712664449966.png

 

vyvarya0608_32-1712664449966.png

 

vyvarya0608_33-1712664449966.png

 

vyvarya0608_34-1712664449967.png

 

vyvarya0608_35-1712664449967.png

 

vyvarya0608_36-1712664449968.png

 

vyvarya0608_37-1712664449969.png

 

vyvarya0608_38-1712664449970.png

 

vyvarya0608_39-1712664449971.png

 

vyvarya0608_40-1712664449971.png

 

vyvarya0608_41-1712664449971.png

 

vyvarya0608_42-1712664449971.png

 

 

  • /sys/block :- Contains subdirectories for each block device discovered in the system. Generally, these are mostly disk type devices.

vyvarya0608_43-1712664449972.png

 

 

  • /sys/bus :- Contains subdirectories for each physical bus type

vyvarya0608_44-1712664449973.png

 

 

/sys/class :- Contains subdirectories grouped together as a functional types of devices (like graphics, net, printer, etc.)

vyvarya0608_45-1712664449974.png

 

 

/sys/device :- Contains the global device hierarchy.

vyvarya0608_46-1712664449975.png

 

sar 5 10 :- System Idle % statistics.

Here 5 is seconds

10 is instances/entries in every 5 secs

Both can be increased and decreased as per requirement

vyvarya0608_47-1712664449975.png

 

 

vmstat 5 10 :- Display virtual memory statistics.

Here 5 is seconds

10 is instances/entries in every 5 secs

Both can be increased and decreased as per requirement.

 

vyvarya0608_48-1712664449976.png

 

 

iostat:- Display input/output statistics.

vyvarya0608_49-1712664449977.png

 

 

Uname –a :- System Name and Kernel Information

 

vyvarya0608_50-1712664449977.png

 

 

finger user:- Display the information of any currently logged in users from the terminal. It is a command-line utility that can provide users login time, tty (name), idle time, home directory, shell name, etc.. Finger command with “-l” option displays all of the information described for the “-s” option as well as the user's home directory, home phone number, login shell, mail status, etc.

vyvarya0608_51-1712664449977.png

 

vyvarya0608_52-1712664449978.png

 

Whereis <app>:- Show possible locations of any app. Locate the binary, source and manual pagefiles of a command.

 

vyvarya0608_53-1712664449978.png

 

 

Network Status tools

Ip                                                                    basic network diagnostics

Nethogs                                                         network usage of processes

Ss                                                                    shows network status

Ethtool                                                          ethernet cards details

We can run on system to check as they are with vast details of network. Mainly used by linux network administrators only.

 

Env :- Shows the existing OS environmental variables. In Suse normally all the environment variables are set by default as per SAP system if we have selected SUSE for SAP media during installation.

vyvarya0608_54-1712664449979.png

 

If we want to Change or Set Environment Variable

You can use the following command to change the environment variable for the current session as per your shell. Check for .bashrc, .cshrc, .bash_profile. .profile files on server for user ID only (not available for root user as root uses default environment variables).

Search specific variable:-

vyvarya0608_55-1712664449980.png

 

For Korn shell (KSH)

The syntax is as follows:

vyvarya0608_56-1712664449980.png

Example To set JAVA_PATH, enter:

vyvarya0608_57-1712664449980.png

For Bourne shell (sh and bash)

The syntax is as follows:

vyvarya0608_58-1712664449981.png

Example To set PATH, enter:

vyvarya0608_59-1712664449981.png

For C shell (csh or tcsh)

The syntax is as follows:

vyvarya0608_60-1712664714535.png

Example Set EDITOR to vim, enter:

vyvarya0608_61-1712664714536.png

LETS CONNECT PART 3 OF THIS KNOWLEDGE SHARING TO EXPLORE MORE COMMANDS……

Any suggestions and corrections are most welcome.

 

Labels in this area