Thursday 30 July 2020

The value of open source to universities: UC Santa Cruz tests the water

LPI Tutorial and Material, LPI Certification, LPI Exam Prep, LPI Prep, LPI Guides
In addition to providing the world with its most enduring and valuable software--Internet protocol stacks, Linux, and more--free and open source software offers immense educational benefits. The gap between producing a nice prime number generator for a professor and contributing to real-life production code is huge, and numerous programmers can attest that free and open source projects helped them cross the chasm.

A few universities have recognized the value they can provide to their own students and to the world at large by sponsoring open source projects. I talked recently to Dr. Carlos Maltzahn, Adjunct Professor for Computer Science & Engineering at University of California, Santa Cruz, and the founder and director of the Center for Research in Open Source Software (CROSS). Our wide-ranging discussion covered many ways that open source works with university programs.

Over its five-year existence, CROSS found that students are eager to join the program, that people around the world with no formal connection to UCSC sign up to work on projects, and that sponsors are willing to support the projects with substantial donations. Sustainability--especially financial stability--is still hard to achieve, and CROSS has been experimenting with multiple ways to raise funds to ensure that projects can show their independence after a few years.

Other universities that reach out and build communities around open source include the University of California, Berkeley (around Spark), Stanford University (around Open vSwitch), University of Indiana, Urbana-Champaign (around LLVM and Clang), and Boston University, through a partnership with Red Hat that I have written about. Red Hat, along with the National Science Foundation, also launched a web resource called Professors' Open Source Software Experience (POSSE) that teaches teachers how to incorporate open source into education. Here I will discuss only CROSS and the implications of its work for other universities.

Education for free software


Every successful computer science student, whether or not they want to work on free software, has to cross the gap I mentioned earlier between class exercises and work environments. The gap encompasses everything the programmer has to do before writing code and after writing code. Before coding, they have to assess user needs, choose useful tasks, and get buy-in from teams. After coding, they have to carry out testing and integration, submit code for review, accept feedback, remain responsible for maintenance, and stay in touch with their team generally. Free software projects provide excellent communities to learn these skills.

Furthermore, computer science programs don't usually teach students how to read other people's code. They don't get to see what professional, production-ready projects look like. The free and open source projects are rich sources of high-quality code, which UCSC students study as part of their immersion in open source.

Some of the training in open source for UCSC computer science students is classroom-based. They learn how to work on Github, the dynamics of free software communities, and the history of two major communities: the Linux kernel, and FreeBSD. But they also get an unusual hands-on project they must complete in order to get a passing grade: they must get a patch to the Linux kernel accepted. Their patch can be trivial, such as a documentation change, but the assignment requires them to engage in the community.

CROSS projects

CROSS awards fellowships for work on research and incubator projects. Research fellows are UCSC Ph.D. students who are working on cutting-edge innovation with a plausible path to generate open source software projects. Incubator fellows are postdocs who are building a developer community around an open source research prototype.

CROSS calls for research and incubator proposals twice a year and tries to start at least two new projects per year, subject to availability of funding. CROSS, together with its industry sponsors and advisory committee (which includes Doug Cutting, Sage Weil, Karen Sandler, Nissa Strottman, and James Davis), reviews all projects twice a year and expects to fund each fellow for 2-4 years. The organization helps incubator fellows seed their developer community through the Open Source Research Experience program, which encourages students to work on project ideas authored and mentored by CROSS fellows. Thus, CROSS is both a research facility and an incubator. The https://cross.ucsc.edu/projects/index.html current list of CROSS projects is available online.

Given that CROSS has been in existence for five years, the oldest incubator project is nearing completion of its fourth year and is facing the challenge of making the project sustainable outside of CROSS. Incubator fellows are doing a lot of grant proposal writing right now, while making their projects attractive to well-established open source software communities.

CROSS support includes paying incubator fellows, giving them time to recruit and mentor new developers, and guiding them as they connect to well-established open source projects and outside sources of financial support. Incubator applicants must demonstrate interest by well-known developer communities outside of UCSC when proposing their incubator project. We'll see in the next section what's in it for these outsiders.

Working on a CROSS project is not lucrative. Maltzahn says that an incubator fellow could probably earn four times as much money getting a typical coding job in the nearby Silicon Valley. So students are working on the projects out of a passion to make them successful, something of a start-up mentality.

The sterling model for a student open source project is Ceph, the most popular open source software for object storage. It was developed by Sage Weil as a UC Santa Cruz grad student. He spun out a company around Ceph, eventually selling it to Red Hat while Ceph remained open source. Weil then became an advisor to UCSC in its creation of CROSS.

Corporate sponsors have played a key role in CROSS from the start. It began with three sponsors, and typically gets about $100,000 from a sponsor each year, for a total earning of $300,000 to $600,000 per year. Companies sign on because open source helps them create and shape new markets, look for opportunities to network with talent and potential recruits, and track and influence education, research, and next-generation open source software ecosystems.

But the money is only one important benefit offered by a sponsor. They advise the students on real-life, business requirements that affect their projects.

For instance, one CROSS project called SkyhookDM adds smart computations (such as distributed queries) to Ceph. Some companies that manufacture computer storage devices support the project because they have narrow profit margins and prefer to outsource high-risk, pre-competitive research to universities. But they can be a reality check for the SkyhookDM developers, by explaining how far they can impose new costs on the storage products. SkyhookDM is furthest along, of all CROSS projects, toward developing a sustainable funding model.

Outside volunteers


CROSS measures the success of an open source project largely by the health of the community that forms around it: not only the number of contributors is important, but also the number of different organizations they come from. As we have seen, the project must have developers unaffiliated with UCSC even before getting CROSS approval. The organization has found that its projects appeal to a lot of programmers around the world: Mexico, Guatemala, Nigeria, and India, for instance.

Some of these are volunteers; others are paid during summer sessions and sometimes continue to be paid if there is left-over money in the Fall. This summer, CROSS is employing 11 students, all undergrad, of which five are at UCSC and six from elsewhere.

Maltzahn believes that money is not the prime motivator, because about half stay on as volunteers after the payments end. They stay because they can learn from illustrious mentors at UCSC, getting training that is not available in their local communities. He has seen the experience these students get in CROSS projects helps them into degree programs.

Getting the university's act together


To adequately support free and open source projects, university lawyers and administrators have to learn a lot more about their licenses and communities. Maltzahn points out that academic institutions have spent a lot on expertise about publishing, patenting, launching businesses, and other laws and logistics in the proprietary world, but have to catch up on learning about open source strategies to amplify their impact on society.

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

Students and professors report that open source computer science is valuable. For instance, students learn to go find the tools they need, rather than just working in the environment set up by the professor. This lets them become "productively lost," in the phrase attributed to David Humphrey of Seneca College. Graduates report that the skills they learned, particularly how to work with other people, have made it easier to get jobs and success, whether or not the job involves open source.

Maltzahn recommends that research universities create open source program offices (OSPOs), mirroring the "Talk Openly, Develop Openly" network of big corporations' OSPOs. He'd also love to see universities tracking their impact on society through the production of open source software, such as Ceph. I have a sense that such research would attract attention to free and open source software, and prompt a lot more colleges to make it a part of computer science curriculum.

Source: lpi.org

Tuesday 28 July 2020

The Linux cd command

Linux cd Command, Linux Tutorial and Material, Linux Exam Prep, Linux Study Material

The Linux cd command is used to navigate around the Linux filesystem. In this post I'll show the most common uses of the cd command.

To move to another directory on the filesystem just use the Linux cd command to move to the desired directory. For instance, this command:

cd /tmp

moves you to the /tmp directory, and this command:

cd /foo/bar

would move you to a directory named /foo/bar, assuming that directory existed.

cd - going home


Wherever you are in a Unix filesystem if you type the cd command by itself, like this:

cd

you'll move to your home directory. (If you're already in your home directory it may look like nothing happened.)

cd - going back


To move back to whatever your previous directory was, just type this:

cd -

That's a very nice shortcut, and I thank whoever came up with that one initially. :)

Moving up


If you want to move up one directory level type this:

cd ..

Unlike the DOS "cd" command, the space after the cd is important, so make sure you include it, or you'll get a "command not found" error message. To move up two directories you type this:

cd ../..

and to move up three directories you type this:

cd ../../..

and so on.

If you had a directory named html that was up three levels from your current location you could type this to move there in one command:

cd ../../../html

Going down


If instead you want to move down through a set of subdirectories named level1/level2/level3/level4 you can just type this:

cd level1/level2/level3/level4

And don't forget the command-line expansion stuff. Rarely do you need to type something out fully. Often you can just type a few characters and then use the [Tab] key to fill in the rest for you. Instead of typing that previous command out fully, odds are I could have just typed this instead:

cd le[Tab]le[Tab]le[Tab]le[Tab]

Assuming that I have no other subdirectories beginning with the letters le, my Unix system would replace le[Tab] with level1/ the first time I hit the [Tab] key, etc.

Saturday 25 July 2020

Read command line arguments - Unix / Linux Bash Script

Q) How to read the arguments or parameters passed to a shell script from the command line?

In general the command line arguments are passed to the bash or shell script to change the behavior of the script. In this article, I am going to provide a simple shell script to read and print the command line parameters.

Also Read: 201-450: Linux Engineer - 201 (LPIC-2 201)

Unix / Linux Bash Script, Unix Guides, LPI Study Materials, LPI Certifications

Take a look at the following unix shell script:

> cat OS_Print.sh
#!/bin/bash
echo "Script execution starts"
echo "$@"
echo "$0"
echo "$1"
echo "$2"
echo "$#"
echo "Script execution ends"

The basic functionality of the above script is to print the values stored in the $ variables. Now we will run the above script by passing some arguments.

> OS_Print.sh unix linux
Script execution starts
unix linux
OS_Print.sh
unix
linux
2
Script execution ends

You can see, the command line arguments passed here are unix and linux. Command line arguments are a list of parameters separated by space delimiters passed to the shell script.

Explanation of $ variables:


◈ $@ : contains all the arguments
◈ $0 : contains script name
◈ $1 : First argument
◈ $2 : Second argument
◈ $n : Nth argument
◈ $# : Count of arguments passed.

Examples:


1. Script to iterate through arguments.

The following script prints the parameters using for loop.

#!/bin/bash

for value in $@
do
  echo $value
done

2. Print only the last argument.

There are many ways to display the last argument. The following script shows the different ways of printing the last argument.

#!/bin/bash

echo "${@: -1}"
echo "${BASH_ARGV[0]}"
echo "${@: $#}"
echo "${!#}"

for value in $@; do :; done
echo $value

Thursday 23 July 2020

Linux and empowerment go together for non-neurotypical

Linux Study Material, LPI Exam Prep, LPI Tutorial and Material, LPI Guides
An impressive achievement was reported to Linux Professional Institute (LPI) this past June: all 12 students in the computer program at the Structuurklas Project, in Rotterdam, the Netherlands, had taken the Linux Essentials exam and passed. Even more impressive: the Structuurklas Project has offered this exam every year for the past three years, and all except one student has passed it. Some of the more proficient students also took the LPIC-1 exam.

Oh, one more thing: the Structuurklas Project serves exclusively students diagnosed with autism.

This news offers us a number of encouraging lessons: the achievement potential of diverse populations who don't thrive in conventional institutions, the employment opportunities provided by computing to those who don't easily fit in, and the inspiration that Linux and free/open source software offer to bold individuals willing to explore. We'll explore all these in this article, after a bit of background.

First, autism is extremely prevalent, and few educational institutions know how to deal effectively with the people who live with it. We now know that autism displays itself in many different ways, and that it can be associated with severe developmental problems as well as academic excellence and amazing achievements. (As just one example, climate leader Greta Thunberg, who identifies as autistic, re-energized the global movement for preserving our climate at age 15.) Although our understanding of autism and other "non-neurotypical" mental states has gotten more sophisticated, the fact remains that thousands of people with autism--even in a sophisticated and educationally advanced country such as the Netherlands--can't succeed in standard schools.

This is where the Structuurklas Project comes in. It's part of a network of schools in the Netherlands that serve people from the ages of about 17 through 21. These schools sit between secondary schools and colleges. In official terminology, the schools cover levels 1 through 4. Graduates of the schools enter the workforce in some 700 professions ranging from baking or car repair to network administration. Some go on to level 5, which is the start of a university education.

The 24 students who attend the Structuurklas Project each year are all diagnosed with autism, and were failing or unable to get the support they needed in conventional schools. The Structuurklas Project focuses on finding out what each student needs and making sure they can understand what is expected of them. During their first year, they meet for about six hours a week with social workers.

It's hard for neurotypical people to realize how much we depend, in every interaction, on implicit understandings that we convey through ambiguous statements, hand gestures, and so on. A lot of the support that helps people with autism succeed involves making these implicit communications more explicit. In addition, a school can enlist the students' innate love of taking things apart and looking inside. The managers' attitude is: if a student isn't learning, the fault lies with the school.

The gender and racial diversity at the school matches those of the Netherlands, with fewer girls than boys because girls get diagnosed with autism much less often.

Linux Study Material, LPI Exam Prep, LPI Tutorial and Material, LPI Guides
Structuurklas students working on computers.

To give each student intense guidance and attention, the Structuurklas Project keeps class sizes down to 12 students. In the computer sciences classes that have aced the Linux Essentials exam, students are thrown into difficult tasks from day one. They start with a working Microsoft Windows computer--with which most are familiar--but are told to assemble a second computer from components and install the GNU/Linux operating system on it. They go on to learn the wonders of the Bash command line, C programming, and networking. The latter is particularly popular among students, which is fortunate, because the prevalence of data centers--particularly in the Netherlands--makes networking a lucrative profession.

Who put together this intrepid educational program? Nico Berg, the docent of ICT at the Structuurklas Project and now 59 years old, is a fascinating case study of his own. I had a chance to speak to him for this article.

Although he ran a pet shop for seven years, Berg always had a keen interest in computing, and particularly in GNU/Linux. This right away tells us something about the inspiring power of free software, and of GNU/Linux in particular. Inquisitive people gravitate toward these technologies, because there is so much they can learn with just their own imagination and determination.

Berg was also a professional educator for a long time, getting a four-year teacher's degree and teaching social studies.

When regulatory changes forced Berg to close his pet shop, he came into the orbit of the Structuurklas Project and learned, at age 54, that he himself has a diagnosis of autism. Asked to set up their computer program, he knew he would be teaching Linux. In addition to setting up the hands-on challenges for his students, he puts together learning materials from material that is freely available on the Internet.

The change from Windows to Linux meets resistance from many students, who tend not to like change of any sort. But they come to love Linux. They delve into the hidden riches of the command-line tools, appreciating that not everything is handed to them in a simple graphical, menu-based interface.

They also form collegial bonds and help each other meet the educational challenges that the program threw at them. Berg estimates that 20% of his students don't start out liking computers; they chose his course because they couldn't find anything else they could do. And yet, with all the students working to help each other, the course achieved near-100% success. Most graduates who entered the workforce are successful there. Every single one who applied to college was accepted.

When Berg instituted his Linux-based program three years ago, an administrator contacted the Central European office of LPI and asked if they could quickly arrange for exams to be offered at the school. Aida Rosenthal in that office worked nearly 24/7 with the administrator to set up the partnership. The final paperwork went through the day before the first exams were held.

What's next? The government of the Netherlands has recently cast a new spotlight on Linux as a crucial technology. Thanks to the importance of networked, embedded devices, also known as the Internet of Things or IoT, the government recognizes that Linux is commonly used in that setting and declared last year that all computer students must learn Linux along with some other free software technologies such as Apache, PHP, and WordPress.

Source: lpi.org

Tuesday 21 July 2020

Record your Linux command line with the script command

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

Linux command line FAQ: How can I record the input and output of my Linux command line (i.e., the Linux commands I type, and the output from those commands)?

Record Linux command line input/output with the script command


Today I was installing a product from the command line on a Unix/Linux system, and they asked if I could let them know how the installation went. I said "Yes, I can let you know exactly how it goes", because I knew that I could record my entire command line login session using the Unix/Linux/BSD script command.

The script command is usually a no-brainer to use. When you're ready to start recording the input/output of your login session, just type

script

at the command line. You'll get a message back from the operating system that looks like this:

Script started, file is typescript

This is the system's way of telling you that it is now recording everything you type, and everything that is displayed on your console. When you're finished recording whatever it is that you want to record, type [Ctrl]-d or exit, and your script session will end. (Make sure you only do an exit command once to exit the script environment, because if you do it twice, the second "exit" command you issue will log you out of your system.)

When you do so, you'll see a message that looks like this:

Script done, file is typescript

If you'll now look at this file named typescript, you'll see that it contains everything you typed, and everything that the system printed out, as promised. Depending on what you do at the command line it may also contain a bunch of control characters, but those are easily weeded out so you can get back to plain ASCII text. I'll show how to do that in another blog entry.

Note that the script command should be available for recording your login session on most Unix systems, including vanilla Unix, Linux, BSD/freeBSD, Solaris, AIX, and others.

Saturday 18 July 2020

The Linux ping command

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

Linux command FAQ: Can you share some examples of the Linux ping command?


You typically use the Linux ping command to test to see whether a remote server is up and running, or to test problems with a network. For instance, my internet connection here in Alaska tends to get flaky from time to time, and when things appear to be going bad, I use the ping command to verify the problem.

Basic ping example


In its basic use, you just issue the ping command followed by the name of a server or website, like this:

ping www.google.com

The ping command then sends little packets of information to the remote server, and if all goes well, they are acknowledged by that remote server. (From a security perspective, that remote server must also be configured to respond to ping requests. Some Linux administrators disable this feature.)

For instance, when my network connection is working fine, here's what the ping command results look like when I ping Google:

$ ping www.google.com

PING www.l.google.com (72.14.213.99): 56 data bytes
64 bytes from 72.14.213.99: icmp_seq=0 ttl=50 time=48.582 ms
64 bytes from 72.14.213.99: icmp_seq=1 ttl=50 time=48.655 ms
64 bytes from 72.14.213.99: icmp_seq=2 ttl=50 time=49.171 ms
64 bytes from 72.14.213.99: icmp_seq=3 ttl=50 time=50.554 ms
^C
--- www.l.google.com ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max/stddev = 48.582/49.204/50.554/0.691 ms

The thing I always look at is the "time" information, shown at the end of each line of output. For me, anything under 50 msec usually indicates that my network connection is working fine. When my network connection goes bad, the output of that time field fluctuates drastically (at which point I call my internet service provider).

One important thing to note: When you issue the ping command as shown, you normally use the [Control][c] key sequence to stop the command. That's how you do things on Linux, Unix, and Mac OS X systems; the last time I tried this on Windows the ping command ran for only a few times and then stopped itself, so things may still be different there.

The Linux ping command - Controlling the number of pings


If you remember the movie The Hunt for Red October, there's a point at which Sean Connery is in the submarine, and he tells the other man, "Give me one ping." This was a pretty funny moment for Unix administrators like myself who had used the ping command for so many years, because it was a great, real world description of the ping command.

It also demonstrated something else: There are times when you don't want the ping command to run forever, you may just want to issue one ping, five pings, or ten pings, etc. In that case, you use the -c option ("count") of the ping command to control the number of pings issued, like this:

$ ping -c 5 www.google.com

PING www.l.google.com (74.125.53.105): 56 data bytes
64 bytes from 74.125.53.105: icmp_seq=0 ttl=50 time=49.198 ms
64 bytes from 74.125.53.105: icmp_seq=1 ttl=50 time=46.662 ms
64 bytes from 74.125.53.105: icmp_seq=2 ttl=50 time=52.202 ms
64 bytes from 74.125.53.105: icmp_seq=3 ttl=50 time=50.108 ms
64 bytes from 74.125.53.105: icmp_seq=4 ttl=50 time=51.690 ms

--- www.l.google.com ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max/stddev = 46.662/49.972/52.202/1.975 ms

Ping a specific port


You can also use the ping command to ping a port on a Unix or Linux system. Here's the description from the Linux ping man page:

-p port

Set the base UDP port number used in probes. This
option  is  used  with the -U option. The default
base port  number  is  33434.  The  ping  utility
starts setting the destination port number of UDP
packets to this base and increments it by one  at
each probe.

Honestly, I don't know much about this, and I don't have a need for this, so I'll leave it at that. One writer suggested using a port-scanning tool named nmap if you need to "ping" a port. nmap lets you see whether ports are "open" (listening), and I use it to test open ports on firewall setups, so in regards to trying to "ping a port", that's a good suggestion.

More Unix/Linux ping command information


There are more things you can do with the Unix/Linux ping command, but far and away these are the most common ping command options I use. For more information, use the Unix man command to get more information on the ping command, like this:

man ping

One final note about the ping command: It has become much more common for Unix and Linux administrators to turn off the ping command on their servers. So, if you can't ping one of your own servers, make sure you have the ping service enabled on that server, or that a firewall isn't blocking your ping attempts.

Thursday 16 July 2020

Linux `sort` command examples

Sort Command, LPI Exam Prep, LPI Study Materials, LPI Learning, LPI Guides, Linux Command, Unix Command

Linux sort command FAQ: Can you share some examples of the Unix/Linux sort command?

As its name implies, the Unix/Linux sort command lets you sort text information. This article shares several examples of the Linux sort command.

Sorting `ls` command output


You can use the Linux sort command to sort all kinds of output from other commands. For instance, here's an example where I sort the output of the ls -al command:

$ ls -al | sort -n -k5

This results in the following ls command sorted output, which as you can see, is a directory listing, sorted by filesize (the 5th column):

-rw-r--r--   1 al  al       0 Aug 17  2007 CreateAPodcast.idx
total 992
-rw-r--r--   1 al  al     240 Aug 17  2007 files
drwxr-xr-x  11 al  al     374 Jul  5 17:50 ..
-rw-r--r--   1 al  al     535 Aug 18  2007 CreateAPodcast.out
drwxr-xr-x  18 al  al     612 Aug 18  2007 images
drwxr-xr-x  20 al  al     680 Aug 27  2007 .
-rw-r--r--   1 al  al     978 Aug 18  2007 CreateAPodcast.toc
-rw-r--r--   1 al  al    1425 Aug 18  2007 CreateAPodcast.lof
drwxr-xr-x  50 al  al    1700 Aug 18  2007 CreateAPodcast
-rwxr-xr-x@  1 al  al    2716 Aug 18  2007 CreateAPodcast.tex
-rw-r--r--   1 al  al    4431 Aug 18  2007 CreateAPodcast.aux
-rw-r--r--@  1 al  al    9689 Aug 17  2007 CAPContent2.rga copy
-rw-r--r--   1 al  al   13564 Aug 18  2007 CreateAPodcast.log
-rw-r--r--@  1 al  al   14369 Aug 18  2007 CAPContent2.tex
-rw-r--r--@  1 al  al   14738 Aug 31  2007 CAPContent2.rga
-rw-r--r--@  1 al  al  310657 Aug 18  2007 create-a-podcast-2.mp3

The -n in my example means "sort numerically", and the -k5 option means to key off of column five. Like other Unix commands, these sort command options can be combined and shortened, like this:

$ ls -al | sort -nk5

which yields the same output.

(ls now has a sort option; I just showed this as an example.)

Sorting output of the ‘ps’ command


From time to time you'll want to sort the output of the Linux ps command, and again here, the sort command can be your friend. You can just sort alphabetically by the first column (username):

$ ps auxw | sort

Or you can sort numerically by column two (the PID field):

$ ps auxw | sort -nk2

You can also reverse that sort with the -r option:

$ ps auxw | sort -rnk2

Sorting file contents with ‘cat’


You can also sort the contents of a file with the Linux sort command. Here's what a file named files looks like before I sort it:

$ cat files

1-gb-startup.jpg
10-after-drum.jpg
2-use-for-buttons.jpg
3-after-media-button.jpg
4-after-loop-browser.jpg
5-after-jingles.jpg
6-after-male-voice.jpg
7-after-chipmunk.jpg
8-before-2nd-male-recording.jpg
9-after-2nd-male-recording.jpg

And here's the output when I run a simple sort command against it:

$ sort files

1-gb-startup.jpg
10-after-drum.jpg
2-use-for-buttons.jpg
3-after-media-button.jpg
4-after-loop-browser.jpg
5-after-jingles.jpg
6-after-male-voice.jpg
7-after-chipmunk.jpg
8-before-2nd-male-recording.jpg
9-after-2nd-male-recording.jpg

It's very important to note that this command does not sort the actual file, it just displays the sorted output on your terminal. To have the sorted output to another file, you'd run a command like this:

$ sort files > files.sorted

which creates a new file named files.sorted, which contains the new, sorted output.

Linux `sort` help

The output from the sort --help command is pretty short, so I'll include it here:

$ sort --help

Usage: sort [OPTION]... [FILE]...
Write sorted concatenation of all FILE(s) to standard output.

Mandatory arguments to long options are mandatory for short options too.
Ordering options:

  -b, --ignore-leading-blanks  ignore leading blanks
  -d, --dictionary-order      consider only blanks and alphanumeric characters
  -f, --ignore-case           fold lower case to upper case characters
  -g, --general-numeric-sort  compare according to general numerical value
  -i, --ignore-nonprinting    consider only printable characters
  -M, --month-sort            compare (unknown) < `JAN' < ... < `DEC'
  -n, --numeric-sort          compare according to string numerical value
  -r, --reverse               reverse the result of comparisons

Other options:

  -c, --check               check whether input is sorted; do not sort
  -k, --key=POS1[,POS2]     start a key at POS1, end it at POS2 (origin 1)
  -m, --merge               merge already sorted files; do not sort
  -o, --output=FILE         write result to FILE instead of standard output
  -s, --stable              stabilize sort by disabling last-resort comparison
  -S, --buffer-size=SIZE    use SIZE for main memory buffer
  -t, --field-separator=SEP  use SEP instead of non-blank to blank transition
  -T, --temporary-directory=DIR  use DIR for temporaries, not $TMPDIR or /tmp;
                              multiple options specify multiple directories
  -u, --unique              with -c, check for strict ordering;
                              without -c, output only the first of an equal run
  -z, --zero-terminated     end lines with 0 byte, not newline
      --help     display this help and exit
      --version  output version information and exit

POS is F[.C][OPTS], where F is the field number and C the character position
in the field.  OPTS is one or more single-letter ordering options, which
override global ordering options for that key.  If no key is given, use the
entire line as the key.

SIZE may be followed by the following multiplicative suffixes:
% 1% of memory, b 1, K 1024 (default), and so on for M, G, T, P, E, Z, Y.

With no FILE, or when FILE is -, read standard input.

*** WARNING ***
The locale specified by the environment affects sort order.
Set LC_ALL=C to get the traditional sort order that uses
native byte values.

Report bugs to <bug-coreutils@gnu.org>.

Tuesday 14 July 2020

LPIC-3 304: Virtualization and High Availability

LPIC-3 304, LPI Tutorial and Material, LPI Exam Prep, LPI Certification, LPI Learning, LPI Prep

The LPIC-3 certification is the culmination of LPI’s multi-level professional certification program. LPIC-3 is designed for the enterprise-level Linux professional and represents the highest level of professional, distribution-neutral Linux certification within the industry. Three separate LPIC-3 specialty certifications are available. Passing any one of the three exams will grant the LPIC-3 certification for that specialty.

The LPIC-3 304: Virtualization and High Availability certification covers the administration of Linux systems enterprise-wide with an emphasis on Virtualization & High Availability.

Current Version: 2.0 (Exam code 304-200)

Objectives: 304-200

Prerequisites: The candidate must have an active LPIC-2 certification to receive LPIC-3 certification

Requirements: Passing the 304 exam

Validity Period: 5 years

Cost: Click here for exam pricing in your country.

Languages: English, Japanese

LPIC-3 Exam 304 Topics


1. Virtualization
2. High Availability Cluster Management
3. High Availability Cluster Storage

Also Read: LPIC-3 304: Virtualization and High Availability

Saturday 11 July 2020

Open Technology: Linux Professional Institute DevOps Tools Engineer

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

The Open Technology professional certifications are designed to evaluate the knowledge and skills of open technology tools, such as DevOps tools and BSD Specialist. To keep pace with evolving technologies, open technology track exam objectives are updated on average every three years and certifications are valid for five years before you must recertify or certify at a higher level.

For Open Technology certifications, single exam is awarded with certification, and there are no prerequisites for the exams.

Businesses across the globe are increasingly implementing DevOps practices to optimize daily systems administration and software development tasks. As a result, businesses across industries are hiring IT professionals that can effectively apply DevOps to reduce delivery time and improve quality in the development of new software products.

To meet this growing need for qualified professionals, LPI developed the Linux Professional Institute DevOps Tools Engineer certification which verifies the skills needed to use the tools that enhance collaboration in workflows throughout system administration and software development.

In developing the Linux Professional Institute DevOps Tools Engineer certification, LPI reviewed the DevOps tools landscape and defined a set of essential skills when applying DevOps. As such, the certification exam focuses on the practical skills required to work successfully in a DevOps environment – focusing on the skills needed to use the most prominent DevOps tools. The result is a certification that covers the intersection between development and operations, making it relevant for all IT professionals working in the field of DevOps.

Current Version: 1.0 (Exam code 701-100)

Objectives: 701-100

Prerequisites: There are no prerequisites for this certification.

Requirements: Pass the Linux Professional Institute DevOps Tools Engineer exam. The 90-minute exam consists of 60 multiple choice and fill-in-the-blank questions.

Validity Period: 5 years

Cost: Click here for exam pricing in your country.

Languages: English, Japanese

LPI Study Materials, LPI Exam Prep, LPI Guides, LPI Tutorial and Material, LPI Certification
To receive the Linux Professional Institute DevOps Tools Engineer Certification the candidate must:

◉ Have a working knowledge of DevOps-related domains such as Software Engineering and Architecture, Container and Machine Deployment, Configuration Management and Monitoring.

◉ Have proficiency in prominent free and open source utilities such as Docker, Vagrant, Ansible, Puppet, Git, and Jenkins.

Also Read: LPIC-OT Exam 701: DevOps Tools Engineer

Tuesday 7 July 2020

Linux mail - a Linux shell script to send mail

Linux Mail, LPI Study Material, LPI Exam Prep, LPI Tutorial and Material, LPI Study Material

Here's a n example Linux shell script (Bourne shell to be specific) that I use to send a list of directories to one of our invoicers. She uses this list as part of a cross-checking process to make sure she bills each one of our customers who have a directory allocated to them. The list is sent to her automatically from a Linux crontab entry I created for her.

Also Read: 101-500: Linux Administrator - 101 (LPIC-1 101)

Without any further ado, here is the Linux shell script that sends the email. (Note that although I keep writing "Linux mail", this should also work on other Unix systems.)

Example Linux shell script - sending mail


Here's the source code for the Linux shell script that sends the email message out every day:

#!/bin/sh

cd /home/lpicentral/bin

echo "

DO NOT REPLY TO THIS EMAIL MESSAGE.

This is a list of the current customer directories installed on our server.
Please make sure they are all billed.

"                       >  listOfWebSites
ls -1 /customers        >> listOfWebSites

mail -s "Current customer directories on our server" kim@herdomain.com < listOfWebSites

That script creates a file named listOfWebSites, then sends that file via the standard Linux mail command.

Corresponding Linux crontab entry


Here is the crontab entry that I use to send this email message every day. If you're familiar with the crontab format you should be able to easily figure out the date and time this information is mailed to here.

30 7 12 * * /home/lpicentral/bin/mailWebSitesToKim

I thought this was a pretty decent use of shell scripting and the built-in Linux mail command. Notice how easy the Unix operating system and redirection operators make this.

Saturday 4 July 2020

How to use the Linux cut command with a field and delimiter

Linux Tutorial and Material, Linux Exam Prep, Linux Certification, LPI Prep

Should you ever run into a situation where you want to use the Linux cut command by specifying both a field number and field delimiter, I hope this example is helpful for you.

I was just working on a problem where I wanted to list all the fonts on a Mac OS X (Unix) system, and needed to use the cut command this way. A straight listing of all the filenames in the Mac font directory gave me a long list of names like this:

$ ls -1

AScore.ttf.11904_0.ATSD
AScore.ttf.11904_0.fontinfo
AScoreParts.ttf.122A0_0.ATSD
AScoreParts.ttf.122A0_0.fontinfo
Abadi MT Condensed Extra Bold.0_11005.ATSD
Abadi MT Condensed Extra Bold.0_11005.fontinfo

(There are actually 761 files on my current system, so I omitted a lot of output.)

For my needs, I just wanted the first part of each filename, i.e., the text string to the left of the first decimal in each filename, like this:

AScore
AScoreParts
Abadi MT Condensed Extra Bold

In short, to create this list, I used the following Unix cut command, specifying the desired field number and field delimiter:

$ ls -1 | cut -f1 -d'.'

This command can be read like this:

◉ Create a single column list of all files in the current directory.

◉ From that list, only print the first field of each filename, where the field delimiter is the "." character.

Running this command gave me the output I wanted:

AScore
AScoreParts
Abadi MT Condensed Extra Bold

More cut command examples


As a few more quick cut command examples, had I wanted to print the second field of each filename, I would have used this command:

$ ls -1 | cut -f2 -d'.'

If it made sense to use a space as the field delimiter, my cut command would have looked like this:

$ ls -1 | cut -f2 -d' '

And for something a little different, if I wanted to print all the usernames out of the /etc/passwd file on my Unix system, I can use this cut command:

$ cut -f1 -d: /etc/passwd

In that example, I'm again printing field one, but this time I'm using the ":" character as the field delimiter, and I'm reading directly from a file named /etc/passwd, instead of reading from standard input.