Thursday, 17 September 2020

Dorothy K. Gordon Joins the Linux Professional Institute (LPI) Board of Directors

LPI Exam Prep, LPI Learning, LPI Tutorial and Material, LPI Guides

I am very happy to introduce Ms. Dorothy K. Gordon as the latest Board Director for the Linux Professional Institute.

Born in Ghana, Dorothy also spent much of her early life in the United Kingdom and Nigeria.  She is fluent in English and French, and is currently studying Spanish and Russian.

Dorothy has extensive experience with various organisations within the United Nations since 1987.

From 2003 to 2016 Dorothy was the founding director-general of the Ghana-India Kofi Annan Centre of Excellence in ICT (AITI), located in Accra, Ghana. Over a little more than 12 years, she built a record of progressive achievement and advancement to establish and strategically position AITI as a Centre of Excellence in ICT with a global reputation and strong leadership within Africa on technology for development issues.

She moved the center from total dependence on government funding to financial sustainability through consistent growth and an expansion of activity in areas of training, consulting, community engagement, and advisory services with thousands of organisations and individuals benifitted from the work of the Centre over the years of her tenure. The Centre was run exclusively on Open Source technologies.

I first met Dorothy in 2008 when she invited me to IDLELO in Senegal, a meeting produced by the Free Software and Open Source Foundation for Africa (FOSSFA), a group in which she played an active role.

In August of 2009 I was invited to an IT development conference (WITFOR) held in Hanoi, Vietnam. This was not my first time to Hanoi (the first was in 1995 and the second in 2005), but I was able to be active in the conference due to Dorothy's invitation to attend.  I showed the conference how to make live and installable special distributions on DVDs and USB flash drives.

I also learned to enjoy “Fresh Beer”, unique to Hanoi, while attending the conference.

LPI Exam Prep, LPI Learning, LPI Tutorial and Material, LPI Guides
At Dorothy’s invitation, I attended another IDLELO conference in Accra in 2010. I brought copies of Linux Pro Magazine, a book called “Internet Blackout” (a Hackerteen book written by my friend Marcelo Marques and donated by O'Reilly), and about 160 Hackerteen T-shirt    s of different sizes to give away to the attendees. The latter caused a lot of consternation getting through customs since I had no documentation on the cost of the shirts (they were given to me) or the price of the shirts (I was giving them away). We finally determined that the proper customs duty was one large T-shirt for the customs inspector and three more T-shirts in small and medium sizes for her children.

The conference was a great success, and I was impressed with what Dorothy was doing with the Centre of Excellence in ICT.

Dorothy had also brought in several other International speakers, including a gentleman from Thailand who was setting up Internet infrastructure in Thailand.   I learned a lot from John over “beer talk” and we exchanged stories about Free and Open Source Software, “telecenters,” and “small industry”.

It was also the trip that I traveled to “Cape Coast Castle” on the coast of Ghana and learned about its infamous part in the slave trade, a visit I will never, ever forget.

I had one more customs issue with that trip. Red Hat had sent 500 DVDs with Fedora on it, and had marked them as worth 500 US dollars, which generated a 250 USD customs duty. I went to the Post Office and managed to convince them that 400 DVDs (100 had “disappeared”) were really worth about five cents each and had “free software” on them, so the 400 remaining were worth about 20 USD.  I personally paid the 5 USD in customs duties.

Dorothy was impressed with my negotiating skills.

During her distinguished career, Dorothy has provided strategic and operational leadership to diverse consulting teams for major consulting assignments, including disaster preparedness and post-crisis training for specialized teams in the Economic Community of West African States (ECOWAS). She gave support to e-government initiatives in health, education, agriculture and public service reform, and provided training on open source solutions for development as a tool for growth and business creation in Sub-Saharan Africa.

She has continued to focus on these topics while she demonstrated technology leadership through the introduction of emerging technologies and related new training products and methodologies, including high performance computing (HPC); cognitive computing; data analytics and Big Data; 3D printing; IPv6 labs; mobile application innovation; cloud solutions; financial technology ; cybersecurity; and strategic use of licensing regimes including Creative Commons and the GPL.

Dorothy formulated strong partnerships in development with leading global IT companies such as Google, IBM, Oracle, and several major companies in Ghana, as well as the start-up community. She has received multiple awards for her work from civic groups.

AITI is a model for best practices for India's IT diplomacy and South-South cooperation. The Centre has inspired the establishment of many similar Centres globally.

Dorothy is on the Advisory council of Creative Commons Global and continues to support FOSSFA. She has degrees from the University of Ghana and the University of Sussex - Institute of Development Studies.

Dorothy continues to be one of my main linkages with the continent of Africa, and I am happy and proud to have her on the Board of Directors.

Source: lpi.org

Tuesday, 15 September 2020

The Unix compress command

Unix compress command, LPI Tutorial and Material, LPI Exam Prep, LPI Guides

The Unix compress command is rarely used any more, and has largely been replaced by the Unix/Linux gzip and bzip2 commands. However, on some Unix systems the compress command is still used, so for them, here are a few examples of how to use it.

Unix compress command examples


The following command will compress the file named foo.tar into a new file named foo.tar.Z:

compress foo.tar

This command compresses the file named foo.tar, and replaces it will a file named foo.tar.Z. (Very important note: Your original foo.tar file will no longer exist.)

You can also use the -v argument to get more output information during the file compression process, like this:

compress -v foo.tar

This compress command works just like the previous example, but gives more verbose output during the compression process. This is useful if you like to see the compression ratio you're getting with this utility.

Saturday, 12 September 2020

Zigging while others are zagging

These days, at least in the US, it’s common for airline safety announcement to conclude with something like, “We know you have a choice of carriers and we appreciate that you chose us today”. It’s a nice sentiment, but it would be great if that message wasn’t so often undermined by the usually miserable experience of getting on the plane.

LPI Certifications, LPI Learning, LPI Tutorials and Material, LPI Study Materials

I’m mindful of that message, though, as I look at the current landscape of IT certification in which LPI resides. Someone looking  for a career in information technology, and specifically open source technology, has an abundance of choices. Some of these choices drew their inspiration from us and a few even started out as LPI partners.

It’s only natural that LPI’s global success has attracted the eye of some who see certification as a path to revenue. Indeed, for many IT programs the certification exams themselves may not be highly income-producing, but the official courses and training materials certainly are. Other programs also apply marketing strategy invented by Novell (the deceased spiritual leader of most IT certifications). Under the Novell strategy, certification itself may not be profitable, but its promotion of vendor lock-in (or at least vendor bias) more than compensates. After all, once you’re hired and able to influence a purchase decision you would very likely stick with the products in which you were certified.

These tactics certainly work for many certification programs, but they’re not ours. In fact, LPI was, from the very beginning, an attempt to disrupt conventional IT certification much as open source software development has been disrupting the IT market.

For starters, we intended to disrupt the use of certification as a path to vendor lock-in. From the very start, LPI has been adamantly neutral towards specific distributions, or other elements of Linux diversity. In the beginning, we actually had a choice of exams for LPIC-1 depending on whether you wanted to be tested using the Red Hat “rpm” or Debian “deb” systems for software installation and upgrade management. (We’ve since figured out how to merge them into a single exam that tests both but doesn’t penalize you for knowing only one.) Recently we have started to implement the BSD certification exam so our support for open source diversity extends not only to Linux distributions but to the operating systems themselves.

This striving for neutrality extends to training methods as well. LPI has never had, and will not have by policy, a single “approved” training path. Our global network of partners assists those who need support through various means. As well, we provide a full and detailed list of objectives for each exam for the benefit of those who choose self-study. Traditionally, LPI never became involved in developing learning materials, but has done so recently at the request of our community, to support our academic partners that need something they can work with. These materials, which will soon call learning.lpi.org their home, will be made freely available to all.

The other thing that separates LPI is our desire to make our programs more accessible. While the trend has been to gradually increase prices for certification exams, LPI is actively looking at ways to reduce them. For us, the end goal is maximizing the open source talent pool rather than maximizing revenue. Our short-term accessibility effort takes the form of lower pricing in developing economies, and even lower pricing when we are able to do classroom-type “exam labs” at events around the world. Yes, this means resorting to pencils and paper forms in some instances, but consider that this way -- for now -- enables us to minimize the expense and thus the price. Going forward we are actively engaging in R&D to lower the cost to take exams even further; exciting and innovative results lie ahead.

And then there’s the new LPI membership program coming this year. Members will be able to participate in the governance of LPI, while using professional development activity (rather that just retaking exams) to maintain active status. In this respect, LPI is going to evolve into a body that more resembles a lawyer’s association or engineering society rather than a conventional IT certification. The certified professionals will have a voice in the direction of the body that sets their skills standards.

I think that what all this points to is the reality that LPI is cut from a different cloth than that used by most other IT certifications, even the other nonprofits. Consider LPI’s recently-refined mission statement:

“LPI exists to advance the use of open source software by elevating the people who work with it.”

That statement doesn’t even mention certification, because that’s not what we are at our core.

To us, certification is a means to an end -- more people finding and succeeding in open source careers -- rather than the end in itself. That perspective guides us to make different choices in strategy and tactics. We are not primarily concerned with selling as many certifications as possible to the exclusion of any greater social goal.

Read More: LPI Certifications

I’m looking forward to LPI’s coming years of membership, making our exams more affordable, and continuing to advocate for the use of open source in business, government, NGOs, and other non-profit organisations. This is a clearly a different direction than the certification mainstream, and one that I’m proud to be part of. To all the hundreds of thousands who have worked with LPI and entrusted us to help support your careers in open source, I know you had a choice and sincerely thank you for choosing LPI. Going forward, we will continue to earn that trust, helping our old friends, and making new ones along the way.

Thursday, 10 September 2020

uniq Command in LINUX with examples

Uniq Command, Linux Study Material, Linux Exam Prep, Linux Tutorial and Material, LPI Certification

The uniq command in Linux is a command line utility that reports or filters out the repeated lines in a file.

In simple words, uniq is the tool that helps to detect the adjacent duplicate lines and also deletes the duplicate lines. uniq filters out the adjacent matching lines from the input file(that is required as an argument) and writes the filtered data to the output file.

Syntax of uniq Command :


 //...syntax of uniq...// 
$uniq [OPTION] [INPUT[OUTPUT]]

The syntax of this is quite easy to understand. Here, INPUT refers to the input file in which repeated lines need to be filtered out and if INPUT isn’t specified then uniq reads from the standard input. OUTPUT refers to the output file in which you can store the filtered output generated by uniq command and as in case of INPUT if OUTPUT isn’t specified then uniq writes to the standard output.

Now, let’s understand the use of this with the help of an example. Suppose you have a text file named kt.txt which contains repeated lines that needs to be omitted. This can simply be done with uniq.

//displaying contents of kt.txt//

$cat kt.txt
I love music.
I love music.
I love music.

I love music of Kartik.
I love music of Kartik.

Thanks.

Now, as we can see that the above file contains multiple duplicate lines. Now, lets’s use uniq command to remove them:

//...using uniq command.../

$uniq kt.txt
I love music.

I love music of Kartik.

Thanks.

/* with the use of uniq all
the repeated lines are removed*/

As you can see that we just used the name of input file in the above uniq example and as we didn’t use any output file to store the produced output, the uniq command displayed the filtered output on the standard output with all the duplicate lines removed.

Note: uniq isn’t able to detect the duplicate lines unless they are adjacent. The content in the file must be therefore sorted before using uniq or you can simply use sort -u instead f uniq.

Options For uniq Command:


1. -c – -count : It tells how many times a line was repeated by displaying a number as a prefix with the line.

2. -d – -repeated : It only prints the repeated lines and not the lines which aren’t repeated.

3. -D – -all-repeated[=METHOD] : It prints all duplicate lines and METHOD can be any of the following:

◉ none : Do not delimit duplicate lines at all. This is the default.

◉ prepend : Insert a blank line before each set of duplicated lines.

◉ separate : Insert a blank line between each set of duplicated lines.

4. -f N – -skip-fields(N) : It allows you to skip N fields(a field is a group of characters, delimited by whitespace) of a line before determining uniqueness of a line.

5. -i – -ignore case : By default, comparisons done are case sensitive but with this option case insensitive comparisons can be made.

6. -s N – -skip-chars(N) : It doesn’t compares the first N characters of each line while determining uniqueness. This is like the -f option, but it skips individual characters rather than fields.

7. -u – -unique : It allows you to print only unique lines.

8. -z – -zero-terminated : It will make a line end with 0 byte(NULL), instead of a newline.

9. -w N – -check-chars(N) : It only compares N characters in a line.

10. – – help : It displays a help message and exit.

11. – – version : It displays version information and exit.

Examples of uniq with Options


1. Using -c option: It tells the number of times a line was repeated.

//using uniq with -c//

$uniq -c kt.txt
3 I love music.
1
2 I love music of Kartik.
1
1 Thanks.

/*at the starting of each 
line its repeated number is
displayed*/

2. Using -d option : It only prints the repeated lines.

//using uniq with -d//

$uniq -d kt.txt
I love music.
I love music of Kartik.

/*it only displayed one
 duplicate line per group*/

3. Using -D option: It also prints only duplicate lines but not one per group.

//using -D option//

$uniq -D kt.txt
I love music.
I love music.
I love music.
I love music of Kartik.
I love music of Kartik.

/* all the duplicate lines 
are displayed*/

4. Using -u option: It prints only the unique lines.

//using -u option//

$uniq -u kt.txt
Thanks.

/*only unique lines are
displayed*/

5. Using -f N option: As told above, this allows the N fields to be skipped while comparing uniqueness of the lines. This option is helpful when the lines are numbered as shown in the example below:

//displaying contents of f1.txt//

$cat f1.txt
1. I love music.
2. I love music.
3. I love music of Kartik.
4. I love music of Kartik.

//now using uniq with -f N option//

$uniq -f 2 f1.txt
1. I love music.
3. I love music of Kartik.

/*2 is used cause we needed to
compare the lines after the
numbering 1,2.. and after dots*/

6. Using -s N option: This is similar to -f N option but it skips N characters but not N fields.

//displaying content of f2.txt//

$cat f2.txt
#%@I love music.
^&(I love music.
*-!@thanks.
#%@!thanks.

//now using -s N option//

$uniq -s 3 f2.txt
#%@I love music.
*-!@thanks.
#%@!thanks.

/*lines same after skipping
3 characters are filtered*/

7. Using -w option: Similar to the way of skipping characters, we can also ask uniq to limit the comparison to a set number of characters. For this, -w command line option is used.

//displaying content of f3.txt//

$cat f3.txt
How it is possible?
How it can be done?
How to use it?

//now using -w option//

$uniq -w 3 f3.txt
How

/*as the first 3 characters
of all the 3 lines are same
that's why uniq treated all these
as duplicates and gave output 
accordingly*/

8. Using -i option: It is used to make the comparison case-insensitive.

//displaying contents of f4.txt//

$cat f4.txt
I LOVE MUSIC
i love music
THANKS

//using uniq command//
$uniq f4.txt
I LOVE MUSIC
i love music
THANKS

/*the lines aren't treated
as duplicates with simple 
use of uniq*/

//now using -i option//

$uniq -i f4.txt
I LOVE MUSIC
THANKS

/*now second line is removed
when -i option is used*/

9. Using -z option: By default, the output uniq produces is newline terminated. However, if you want, you want to have a NULL terminated output instead (useful while dealing with uniq in scripts). This can be made possible using the -z command line option.

Syntax:

//syntax of using uniq
with -z option//

$uniq -z file-name

Tuesday, 8 September 2020

tar gzip example - How to work with files that are tar'd and gzip'd

LPI tar gzip, LPI Exam Prep, LPI Tutorial and Material, LPI Cert Exam, LPI Certifications

tar gzip FAQ: How do I work with tar archives that have been created with tar and gzip?


When you work on Unix, Linux, and Mac OS X systems, you'll quickly find that tools like tar and gzip are your good friends, so learning how to work with them is very important. Here's a quick look at how to work with the most common tar/gzip scenarios.

1) Create a tar'd and gzip'd archive of a directory


A lot of times you'll have a directory that you want to either (a) make a backup copy of, or (b) share with other people. The most common way to do that these days is to create an archive that is "tar'd and gzip'd".

Here's how you create a tar'd and gzip'd archive of a directory (i.e., a "tar tgz" file) in your current folder named mydirectory:

tar czvf mydirectory.tgz mydirectory

A few quick notes about this tar/gzip example:

1. I've included four options with the tar command:

      1. c - create a new archive.
      2. z - gzip'd the archive.
      3. v - work verbosely, showing me the name of each file you add. This is optional.
      4. f - specifies that you want to use the following filename (mydirectory.tgz) as the name of the archive.

2. When creating an archive that has been tar'd and gzip'd, this is considered a "tar tgz" file, so it's common practice to end your filename with the extension tgz (though you can call it whatever you want).

2) Extract the contents of a tar/gzip (tar tgz) archive


Now imagine that you have just received a tar/gzip archive like this from someone else. To extract the contents of the archive issue a very similar command, this time using an x (for "eXtract") instead of the c argument, like this:

tar xzvf mydirectory.tgz

This command extracts whatever was in that tar'd and gzip'd archive to your filesystem.

3) List the contents of a tar/gzip archive


If that previous command sounded scary, maybe it should be. If this is an archive you just received from someone else, you may want to look at its contents before just extracting it to your filesystem.

Fortunately you can list the contents of an archive very easily, using the t option ("lisT") instead of the x argument, like this:

tar tzvf mydirectory.tgz

This command lists the contents of the archive, but does not extract the files in the archive to your filesystem.

4) How to gzip an existing tar file


As you work in the Unix world you'll also run into files named with a "tar.gz" extension, like this:

foo.tar.gz

When you see this ".tar.gz" file extension, it indicates that the file has probably been tar'd first, and then gzip'd second. This is a two-step process -- and the way I used to do this -- that works like this:

# step 1
tar cvf mydirectory.tar mydirectory

# step 2
gzip mydirectory.tar

As a practical matter you can treat a tar.gz file just like a tgz file, and extract its contents using the same command that was shown earlier:

tar xzvf mydirectory.tar.gz

Once I learned that I could tar and gzip a file with one command I stopped using this two-step process, but again, either way will work.

Thursday, 3 September 2020

LPI: Perl printing examples

LPI Exam Prep, LPI Tutorial and Material, LPI Study Materials, LPI Learning, LPI Guides, LPI Certification

Perl printing FAQ: Can you share some Perl printing examples?

There are several different ways to print in Perl, and I thought I'd share some examples here today.

The Perl print function


Generally you'll print simple output with the Perl print function. As a simple example, you can print a string literal using the Perl print function, like this:

print "Hello, world.\n";

Also Read: LPI Certifications


Notice that you need to supply the newline character at the end of your string. If you don't supply that newline character, and print multiple lines, they'll all end up on one long line of output, like this:

Hello, world.Hello, world.Hello, world.

So, when using the Perl print function, don't forget the newline character at the end of the string you're printing.

Printing Perl variables with print


In any real-world Perl script you'll need to print the value of your Perl variables. To print a variable as part of a a string, just use the Perl printing syntax as shown in this example:

$name = 'LPICentral';
print "Hello, world, from $name.\n";

When you run this Perl script, you'll see the following output:

Hello, world, from LPICentral.

Perl does the work of replacing the variable $name with the value of that variable, LPICentral.

Perl printing - Double and single quotes


One important thing to note in this example is the use of double quotes with that Perl print statement. In Perl, when you place a variable inside of double quotes, Perl can replace the value of the variable name. This is called "variable interpolation", and it works when you use double quotes, but it does not work when you use single quotes.

The Perl print function is essentially blind to anything you place inside single quotes, and will just print whatever you put in between single quotes without giving it a second thought. For example, if you try that same Perl print statement with single quotes, like this:

# this won't work as desired:
print 'Hello, world, from $name.\n';

In this example, Perl can't see inside the single quotes, so it can't replace $name with LPICentral, and it ends up printing $name instead, as shown here:

Hello, world, from $name\n

I forgot to mention the \n character, but as you can see in that output, when you use single quotes, the Perl print function also can't see the \n character, so it just prints the two characters \ and n, instead of actually seeing that character and printing a newline character in its place.

Perl printing - Other ways to print Perl variables


I could have also printed that previous example as shown here:

$name = 'LPICentral';
print "Hello, world, from " . $name . ".\n";

The result is the same, but I don't care for this Perl printing approach very much. For me, it's much harder to read, especially when you need to print more than one variable at a time.