Linux – What is yum?

Linux

Linux

In simple terms, yum is a, command-line interface, package manager utility for computers running the Linux operating system, which augments the RPM Package Manager capabilities. yum is the primary tool for getting, installing, deleting, querying, and managing RPM software packages. Alos, yum is used in Red Hat Enterprise Linux (RHEL) versions 5 and later.

 

Linux – how to display file system disk space statistics

Linux

Linux

In Linux there are lot of ways to disk size and/or space, but the ‘Disk Filesystem’ (df) command is old reliable and has been around a long time.   The ‘df’ command provides a summary of disk space and free space, which I find myself coming back to time after time.

Basic Command Format

DF -<<Option>>   <<File>>

Example ‘Disk Filesystem’, Command

df -h

  • -h = Human readable in Mega Bytes

For more details in Linux

df –help

 

Example Command Output

root@BlogSrvr1 /]# df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/mapper/vg_BlogSrvr1-lv_root

36G   34G   16M 100% /

tmpfs                 3.9G     0  3.9G   0% /dev/shm

/dev/sda1             477M   33M  419M   8% /boot

/dev/mapper/vg_BlogSrvr1-LogVol03

11G   27M  9.9G   1% /data

/dev/mapper/vg_BloSrvr1-lv_home

4.8G   33M  4.6G   1% /home

/dev/mapper/vg_BlogSrvr1-LogVol04

25G   13G   11G  55% /opt/IBM

/dev/mapper/vg_BlogSrvr1-LogVol05

11G  6.0G  3.7G  62% /scratch

/dev/mapper/vg_BlogSrvr1-LogVol06

11G   27M  9.9G   1% /tmp/dev/shm

Linux – How to compress an entire directory

Linux

Linux

From time to time there is a need to package up a folder for any number of reasons which may include things like:

  • Migration
  • Movement to a new location
  • Movement to a new server
  • To keep a backup
  • Or simply to save space

Compressing a folder is folder can be very useful, but for those of us who don’t do it all the time, it is nice to have a pattern to follow.  Also, even an experienced user can get brain cramp, if they have not had a reason to compress a folder in a while. So, here is a simple pattern to follow to compress a folder and its contents.

Basic Command Format

tar -zcvf <<archive-name>>.tar.gz <<directory-name>>

Example Compress Command

tar -zcvf  blog_files_backup.tar.gz   sqlfiles

Linux tar command line options used here

  • -z = Compress archive using gzip program
  • -c = Create archive
  • -v = Verbose i.e display progress while creating archive
  • -f = Archive File name

For help with the tar command in Linux

To get additional detail on the tar command in Linux, just need to type:

 tar -?

 

How to stop and restart Cognos Service from Linux command line

stop and restart cognos service from linux command line

stop and restart cognos service from linux command line

I don’t do this very often, but recent had to look this up to help out a project.  Stopping and restarting a Cognos from a Linux command line is relatively simple, just a couple of commands.

  • Log on to the reporting server as Root user or a non-root user with administrative privileges.
  • Find the path to install bin directory.  I use this find command, but you can do what works for you:   find . -name “cogconfig.sh”
  • Launch an and navigate to the bin directory as follows: <Cognos_Home>/bin64
  • Where <Cognos_Home> is the installation location of the Cognos® application.
  • Do the following one or both of the following, according to what you are attempting to do:
    • To start the service, enter the following command: ./cogconfig.sh -s
    • To stop the service, enter the following command: ./cogconfig.sh -stop

 

Related References

 

Productivity Tip – Quickly create a new surrogate key file

Linux

Linux

This productivity tip, is how we can quickly create a new surrogate key file in Linux.  This example is leveraging native capabilities of Red Hat Enterprise Linux (RHEL) to skip a few commands, by using an existing surrogate key file to create a new surrogate file with a minimum of keys strokes and command line entries.

Creating a New Surrogate Key File From an Existing File

The basic process consists of just a few steps:

  1. Navigate to the location of your existing surrogate key files
  2. Copy an existing surrogate file
  3. Empty the new surrogate key file

Navigate to the location of your existing surrogate key files

This step is preparatory step; you will need to look at the path variable for the project you are working with to know where to go.  The actual path to the surrogate files your project can vary by project.

Copy an existing surrogate file

Assuming you have existing surrogate key files configured as needed, the use of the copy (cp) command can and the interactive and preserve options can eliminate the need to create the file, then set groups and permissions.   The interactive (-i) option prevent you from overwriting an existing files, in case you made a filename typo and the preserver (-p) option preserve the specified attributes (e.g. ownership, and permissions).

Basic Command

  • Here is the command formats with interactive and preserve, either format works
    • cp -ip <<FileName to Be Copied>> <<New Filename>>
  • Here is the command formats with only preserve
    • cp -p <<FileName to Be Copied>> <<New Filename>>

Example Command

  • cp -ip srky  blogexampl.srky
Copy Surrogate Key With Permissions

Copy Surrogate Key With Permissions

Empty the new surrogate key file

Setting the newly create surrogate key file to null will empty the file, so, DataStage can begin from the point configure in your DataStage job.

Basic Command

  • cat /dev/null > <<FileName>>

Example Command

  • cat /dev/null > blogexample.srky
Empty Surrogate Key File

Empty Surrogate Key File

Related References

 

Productivity Tip – Changing Owner and Groups on Surrogate Key File

Linux

Linux

 

This practice tip, is how we quickly update surrogate key file owner and group in Linux.  This example is leveraging native capabilities of Red Hat Enterprise Linux (RHEL) to skip a few commands, by using a combined command to set both the owner and group of a surrogate key file in a single command.

Surrogate Key File Owners and Groups

To ensure the DataStage has access to the path and Surrogate files, ensure the ‘dsadm’ (owner) and ‘dstage’ (group) have access to the surrogate key files

Setting Surrogate Key File Owners and Groups

You can change the ownership and group of a surrogate file at the same time, in Linux, with the change owner command. To do this navigate the surrogate key path containing the file, then execute the chown combined command.

Command chown basic format

  • chown <<OWNER>>:<<Group>> <<File Name>>

Example chown command

  • chown dsadm:dstage Blogexampl.txt
Chown On Surrogate Key File

Chown On Surrogate Key File

Related Reference

 

 

How to clear a Surrogate Key file using Linux

Linux - Ho to Empty Surrogate Key File

Linux – Ho to Empty Surrogate Key File

Occasionally, the question comes up about how to clear/reset the surrogate key file from the Linux command line.  It is a simple process really, but it should be done with care and, only, if you need the keys in the dimension to be reset to the beginning.   A complete reset would require:

  • The target table to be truncated and,
  • All keys in use in facts to be removed, or reset after the fact, and/or the table truncated and reloaded,
  • The Surrogate Key file emptied, and
  • The ETL rerun.

Basic Command

  • cat /dev/null > <<FileName>>

Example Command

  • cat /dev/null > Season.srky

Related Links

Linux – Locate Command

Linux

Linux

While working with a Linux admin, he introduced me to the Linux ‘Locate’ command, which until now I had not seen or used.  The ‘locate’ command works much like the ‘find’ and is a quick and easy way to find files on the system.  We were using ‘locate’ to discover files within the server and the commands simplicity proved useful to me.

When the locate command is used without any options, the locate command displays every absolute pathname for which the user has access permission that contains any of the names of files and/or directories for the identified file.  So, it is important to know what rights your user has or better yet user the command as root or root sudo.  Otherwise, existing files can be omitted do to permissions restrictions. Also, the scope of the results is broader than and, usually, more complete than the find command.

Syntax for locate command

  • locate [options] name(s)

Example Locate command

When run as root this command returns all occurrences of the ‘odbc.ini’ file and their absolute path.

  • Locate odbc.ini

Locate Command Results

Linux Locate Command Results

Linux Locate Command Results

Same Search Utilizing the Find Command

Not only is the find command more complex for the purpose, but the results are more narrow in there information return.

Example Find command

  • find -type f -name odbc.ini

Find command Results

Linux Find Command Results

Linux Find Command Results

 

 

How to Schedule an Infosphere Datastage Job in crontab

This is a quick, easy, shortcut way to schedule an InfoSphere DataStage job in Linux crontab to take advantage of capabilities within crontab not available in the InfoSphere graphical user interface (GUI).

For this example, the job has been adjusted from the stand InfoSphere scheduler graphical user interface (GUI) setting to run every 15 minutes, which is not available in the GUI.

The Basic crontab Scheduling Process

  • Schedule the job in DataStage Director
  • Login into Linux as the user, who created the schedule
  • Run ‘crontab -e’ command
Linux crontab -e

Linux crontab -e

  • Edit crontab command line using VI commands
Edited InfoSphere Crontab Command 5 minute Intervals

Edited InfoSphere Crontab Command 15 minute Intervals

  • Saves changes

 

Note: The revised schedule if different from the InfoSphere scheduler GUI standard setting will not display as changed in the GUI.  However, the jobs will run as scheduled, if edited correctly, and can be verified in the Director Client.

Related links:

What is a Pluggable Authentication Module (PAM)

Pluggable Authentication Module, PAM

Acronyms, Abbreviations, Terms, And Definitions

Pluggable Authentication Module

PAM (Pluggable Authentication Module) was originally developed in 1995 and provides a library, which is a generalized API for authentication-related services.  PAM allows a system administrator to add new authentication methods simply by installing new PAM modules, and to modify authentication policies by editing configuration files.

Simply stated, PAM it provides and interface for the interfacing of LDAP

PAM provides

  • a common authentication scheme that can be used with a wide variety of applications.
  •  significant flexibility and control over authentication for both system administrators and application developers.
  •  a single, fully-documented library which allows developers to write programs without having to create their own authentication schemes.

Related References

 

Linux – How to only list directories in an LS Command?

Linux, LS Command, How to only list directories in an LS Command

Linux, LS Command

Occasionally, there is a need to view only a list of directories.  This is relatively easy, depending on your need.  Here are a couple of commands to pull a list of only the directories in the current folder.

LS Command for Directory list, which provides details

List approach give the list of classic details of the ls command, but only returns directories in the list.

ls -l | grep “^d”

 

LS Command for Directory list with no extras

This approach can be useful, when needing a list without unnecessary content for scripts.

ls -d */

Related References