skip to main content - dyslexic font - mobile - text - print

Hacker Public Radio

Your ideas, projects, opinions - podcasted.

New episodes Monday through Friday.

In-Depth Series

Linux in the Shell

Linux In The Shell aims to explore the use of many commands a user can run in the Bash Shell. Tutorials include a write up with examples, an audio component about the write up, and a video component to demonstrate the usage of the command.
The website is http://www.linuxintheshell.org/

LiTS 032: cat - Dann | 2013-06-19

Episode 32 of Linux in the Shell talks about the use of the cat command. Learn the different switches to cat and how through the use of redirection cat becomes more than just a tool to view the contents of a file. For the full write-up of the command and the corresponding video examples check out http://www.linuxintheshell.org.

LiTS 031: who - Dann | 2013-06-04

Episode 31 of Linux in the Shell discuses the use of the who command. The who command does more than just identify who is logged into a system. Who is coupled with init and will produce statistical information about the system since the last boot. Make sure you visit the entry on http://www.linuxintheshell.org to get the full write up of the who command and for further information in the bibliography on topics discussed.

Linux in the Shell Ep 30 - vmstat - Dann | 2013-05-22

Episode 30 of Linux in the Shell talks about the use of the vmstat command. Learn about Linux Virtual Memory managment and the files in /proc where vmstat gathers information.

LiTS 029: ab - apache benchmark. - Dann | 2013-05-09

This episode of LITS talks about using Apache Benchmark utility to test websites. Learn how to use and interpret the results of Apache Benchmark.

LiTS 028: extended attributes - Dann | 2013-04-23

Episode 28 of Linux in the Shell talks about extended attributes and how to view them with lsattr and change them with chattr. Attributes are discussed in some detail and those that are mutable by chattr are noted.
http://www.linuxintheshell.org/2013/04/23/episode-028-extended-attributes-lsattr-and-chattr/

LiTS 027: mathematical commands - Dann | 2013-04-09

Episode 27 of Linux in the Shell continues on with looking at some mathematical commands. Four programs are discussed:

  • factor - which will give you the prime factors of a number

  • primes - which will list all the prime numbers between a start and option stopping number

  • seq - sequence will list all the numbers given a stopping point or a starting and stopping point. You can also specify an increment or decrement value.

  • arithmetic - Arithmetic is a game from the bsd games package that will quiz you on arithmatic problems.

LiTS 026: units - Dann | 2013-03-27

Linux In The Shell aims to explore the use of many commands a user can run in the Bash Shell. Tutorials include a write up with examples, an audio component about the write up, and a video component to demonstrate the usage of the command.
The website is http://www.linuxintheshell.org/

Episode 026 - units

Last episode of Linux in the Shell discussed the use of the bc command to perform math on the command line. This episode continues in suit with a mathematical theme picking up from the last examples of converting between different number systems or units. While bc can help you convert between units if you know the formulas, there is another program which will do it all for you units. Chances are units is not installed by default but a simple check in your package manager should allow you to add units to your daily tool set.

For more on this post and to see the video please see the main article
http://www.linuxintheshell.org/2013/03/27/episode-26-units/

LiTS 025: bc - Dann | 2013-03-12

Linux In The Shell aims to explore the use of many commands a user can run in the Bash Shell. Tutorials include a write up with examples, an audio component about the write up, and a video component to demonstrate the usage of the command.
The website is http://www.linuxintheshell.org/

Episode 025 – bc

Math from the Linux command line is one of those tasks that is not as straight forward as you may think. There are many tools that will allow you to perform mathematical functions accessible to you, but to perform simple arithmetic is not as simple as just entering some equation. You can use the echo command to perform basic mathematical problems but it does not allow for decimals making division in particular problematic.

For more on this post and to see the video please see the main article http://www.linuxintheshell.org/2013/03/12/episode-025-bc/

LiTS 024: time and /usr/bin/time - Dann | 2013-02-26

Linux In The Shell aims to explore the use of many commands a user can run in the Bash Shell. Tutorials include a write up with examples, an audio component about the write up, and a video component to demonstrate the usage of the command.
The website is http://www.linuxintheshell.org/

The time program is a handy tool to not only guage how much time in seconds it takes a program to run, but will also display how much user CPU time and system CPU time was used to execute the process. To understand these values you must grasp how the kernel handles the time reporting for the process. For example, the output of:

time ls

is

real 0m0.007s
user 0m0.000s
sys 0m0.003s

For the complete show including video and a complete write up go to http://www.linuxintheshell.org/2013/02/26/episode-024-time-and-usrbintime/

LiTS 023: Date - Dann | 2013-02-12

Spring is in the air and valentine's day is just around the corner and Dann Sexy Washko tells us all we need to know about dates on his regular Linux In The Shell series.

Linux In The Shell aims to explore the use of many commands a user can run in the Bash Shell. Tutorials include a write up with examples, an audio component about the write up, and a video component to demonstrate the usage of the command.
The website is http://www.linuxintheshell.org/

The date command will not only display or let you change the current date and time but is the go to utility for getting date and time information into scripts. Evoked by itself the date command will output the current system date based upon the rules of the LC_TIME format. The LC_TIME format defines the rules for formatting dates and times. LC_TIME is a subset of locale which defines the overall environment based upon the chosen language and cultural conventions. You can see the current LC value by issuing the locale command. You can see time specific information for your system by issueing:

locale -m LC_TIME

http://www.linuxintheshell.org/2013/02/12/episode-023-date/

LiTS 022: Sort - Dann | 2013-01-29

Linux In The Shell aims to explore the use of many commands a user can run in the Bash Shell. Tutorials include a write up with examples, an audio component about the write up, and a video component to demonstrate the usage of the command. The website is http://www.linuxintheshell.org/

In todays episode

The sort command does just that, it sorts input.  Input can be a list of files, standard in, or files with standard in. The first example presents this simple file, shopping.txt,  containing a list of items:

chicken
fish
sour cream
bread crumbs
milk
eggs
bread
sinkers
fishing hooks

Issuing the sort command on this file:

sort shopping.txt

Would present the following output:

bread
bread crumbs
chicken
eggs
fish
fishing hooks
milk
sinkers
sour cream

For more information including a complete video please see http://www.linuxintheshell.org/2013/01/29/episode-022-sort/

LiTS 021 – killall - Dann | 2013-01-15

Linux In The Shell aims to explore the use of many commands a user can run in the Bash Shell. Tutorials include a write up with examples, an audio component about the write up, and a video component to demonstrate the usage of the command.
The website is http://www.linuxintheshell.org/

The previous two shows have discussed different ways to kill a process using kill and pkill. This episode will cover a third command, killall. The killall command is used to send a signal to every process that is running the identified command. For instance:

killall xterm

Will send the SIGTERM process to all incidents of xterm. Should there be any xterm processes running they would receive the default SIGTERM signal (recall, number 15) and be terminated. If there were no xterm processes running then killall would report the following:

xterm: no process found

For the rest of this episode please check out the shownotes and video at http://www.linuxintheshell.org/2013/01/01/episode-21-killall/

LiTS 020: pgrep and pkill - Dann | 2012-12-18

Linux In The Shell aims to explore the use of many commands a user can run in the Bash Shell. Tutorials include a write up with examples, an audio component about the write up, and a video component to demonstrate the usage of the command.
The website is http://www.linuxintheshell.org/

This episode the focus will be on two commands that go hand-in-hand: pgrep and pkill. Like the kill command, pkill is used to send a signal to a process usually with the intent to terminate or stop the process. Instead of passing the Process ID (PID) you can pass the process name:
pkill xterm

For the rest of this episode please check out the shownotes and video at http://www.linuxintheshell.org/2012/12/18/episode-20-pgrep-and-pkill/

LiTS 019: Kill the worms! - Dann | 2012-12-04

Linux In The Shell aims to explore the use of many commands a user can run in the Bash Shell. Tutorials include a write up with examples, an audio component about the write up, and a video component to demonstrate the usage of the command.
The website is http://www.linuxintheshell.org/

The kill command is used in the shell to terminate a process. Kill works by sending a signal to the process and typically this signal is either the SIGTERM or SIGKILL signal, but there are others that can be used. To properly use the kill command you need to know the Process ID, or PID, of the process you want to kill. Also be aware that some processes can spawn child processes of the same or similar name. For instance, if you have are running the Chromium browser you may find multiple instances of the chromium process running. Killing one of these processes may not terminate all the processes because typically all but the first process are children processes. Killing any or all of the children processes will not terminate the mother process. But terminated the mother process will typically kill the children processes.
For more see:
http://www.linuxintheshell.org/2012/12/04/episode-019-kill-the-worms/

LiTS 018: ln - Dann | 2012-11-20

Linux In The Shell aims to explore the use of many commands a user can run in the Bash Shell. Tutorials include a write up with examples, an audio component about the write up, and a video component to demonstrate the usage of the command.
The website is http://www.linuxintheshell.org/

Today it's the turn of the ln command. The rest of the shownotes and video can be found at
http://www.linuxintheshell.org/2012/11/20/episode-018-ln-command/ The ln command is used to create a link between an existing file and a destination, typically newley created, file. Some operating systems may all this creating a shortcut. Recall that Linux treats everything like a file, thus you can create links to files, directories, or even devices.

There are two types of links:

Hard Links: A hard like is a connection where two files share the same inode.
Symbolic Links: A symblic link is a special file that refers to a different file.

LiTS 017: split - Dann | 2012-11-06

Dann makes a welcome return with his podcast, blogg and video entry over at http://www.linuxintheshell.org/2012/11/06/episode-017-split/

The split command is used to split up a file into smaller files. For example, if you need to transfer a 3GB file but are restricted in storage space of the transfer to 500 MB you can split the 3GB file up into about 7 smaller files each 500MB or less in size. Once the files are transferred restoring them is done using the cat command and directing the output of each file back into the master file:

split -b500M some3GBfile

Please visit his site for more splitty goodness

LiTS 016: top pt 4: Alternate Windows - Dann | 2012-09-25

This final installment on the top command will discuss the alternate displays for top. When starting top with the defaults one is presented with a full screen view of top containing the summary window at the top and the task area in the bottom. The task area usually takes up three quarters of the top window. This display is not the only informative view that top has. By pressing the “A” key the “Alternate Display” view is presented where the task area becomes four separate task areas of equal size called “field groups”. The summary area remains where it is. Each of the four field groups displays the task information in a different manner.

For complete shownots, and video see http://www.linuxintheshell.org/2012/09/25/episode-016-top-pt-4-alternate-windows/

LiTS 015: top part 3 - Control Top - Dann | 2012-09-11

Others would have given up by now. Not our Dann ! He continues his epic coverage of the Top command and in this episode will detail how to control the output of top via shortcut keys and command line switches.

LiTS 014: The Bottom of Top, top pt 2 - Dann | 2012-08-28

Dann continues his systematic analysis of the top command and you absolutely need to check out the text, and video for this one.
http://www.linuxintheshell.org/2012/08/28/episode-014-the-bottom-of-top-top-pt-2

LiTS: 013 - Top of Top - Dann | 2012-08-14

The top command is a very complex and feature-full application. When executed from the command line the top command displays two sections of information: Summary information (contained in the yellow box in the screen shot below) and running application field information (contained in the red box):

Top running in Arch Linux

The focus of this entry will be on the Summary window of top:

summary window of the top command

The screen shot above shows the summary section. The first line contains the following information in this order by default:

  • The current time
  • up time
  • how many users are logged in
  • load average

For the rest of the shownotes and the video please go to http://www.linuxintheshell.org/2012/08/14/episode-013-top-of-top/

LiTS: 012 - tail - Dann | 2012-07-31

The tail command is used to print out the last 10 lines of a file to standard out. This command is a staple in a system administrator’s tool kit and especially handy when monitoring log files. The basic syntax is:

tail some_file

Which will output the last 10 lines of the file. You can alter then number of lines with the -n, or –lines=, flag:

tail -n20 some_file
tail –lines=20 some_file

In some versions of tail you can get away with specifying the number of lines from the end with just a “-” and number:

tail -30 some_file

Instead of working backwards with the -n command you can specify a “+” and some number to start from that number and list the contents to the end:

tail -n+30 some_file

This will display the contents of some_file from line 30 to the end of the file.

For the complete write up including video please go to http://www.linuxintheshell.org/2012/07/31/episode-012-tail/

LiTS 011: du - disk usage - Dann | 2012-07-17

The du command provides a summary of disk usage for files and directories. The default behavior is to show the amount of blocks used by the contents of a directory or directories the command is run on. Usage is calculated recursively for directories. When du encounters a directory it will recurse into subdirectories and show the disk utilization of the files and directories under that directory and then present a total for the top most directory. This cascades down through each subdirectory where the subdirectory becomes the parent and each child directory is summarized and the parent then totaled.

For compete show notes see http://www.linuxintheshell.org/2012/07/17/episode-011-du-disk-usage/

LiTS 010 - df - Exploring Disk Filesystem Usage - Dann | 2012-07-03

The df command is used to report file system usage. The df command will show you the amount of storage available, used, and free per partition for each fileystem currently mounted on the system. Values are shown in blocks.

Linux In The Shell 008 - free: Understanding Linux Memory Usage - Dann | 2012-06-05

In today's show Dann explains to us what it means to be free.

The free command is a handy snapshot into your systems memory and how much of it is being used. In conjunction with other tools like top you can get begin to understand where your system resources are being utilized and weed out potential bottlenecks and bugs. But before jumping into the deep end in system analysis, you need to have a decent grasp on how the Linux kernel utilizes memory, or you initial observations may send you tearing through the interwebs looking for a solution to a problem that does not exist.

As ever catch he complete shownotes and video at http://www.linuxintheshell.org

Linux In The Shell 007 - Chmod and Unix Permissions. - Dann | 2012-05-22

This is LITS 007

Pay attention everyone, this is serious stuff. This is CHMOD a powerful and dangerous operator that has infiltrated to the heart of every unix and linux system. We have been receiving reports that it has also behind many strange incidents leading to computer compromise and in some cases complete lock down.

Our American colleague, Special Agent Washko, will show us how to, in his own words "turn this bad boy around" so we can get it working for us.

LITS: Episode 005 - pmount - Dann | 2012-05-08

In our continuing journey around the command line, Dann takes us to visit the outer edges and talks about the pmount command.

NAME
       pmount - mount arbitrary hotpluggable devices as normal user

As ever the very very detailed shownotes can be found on his site http://www.linuxintheshell.org

Don't forget that he also has a video component, and as ever this one is worth a watch.

LITS: Episode 005 - wc - Dann | 2012-04-24

Fear not Dann has not decided to branch and do a plumming show. Rather he sticks with the plaan and brings us yet another excellent explanation of a common unix utility, namely wc

http://www.linuxintheshell.org/2012/04/24/episode-005-wc/

Ever want to know how many lines are in a file? How about how many words are in a file or even how many characters? Well then the “wc” command is just for you.  The “wc” command, short for word count, is a very simple command that will print “new line, word and byte counts for file specified, and a total count for all files combined if more than one file is included.”

Consider the following little ditty:

the linux wc command
for those not in then know
stands for word count and
does a lot you should know

It counts lines and words and bytes
producing output on site
quickly giving you the numbers
without any blunders

Executing the following command:

wc poem.txt

Results in the following output:

9 40 215 poem.txt

To break it down:

  • 9 lines
  • 40 words
  • 215 characters

LITS: Episode 004 - paste - Dann | 2012-04-10

In the fourth in his series Dann, shows us the benifits of the paste command:

The paste command merges the lines of two or more files or a file and standard in if a second file is not specified or a "-" is used in place of the second file.  Consider the following two files.  The first file, test1.txt contains the following lines:

a
one
three
cat
good

The second file, test2.txt contains the following lines:

tuna
blue finch
dogs
fish
eats

The paste command can be used to paste these two files like so:

paste test1.txt test2.txt

producing the following output:

a         tuna
one     blue finch
three   dogs
cat      fish
good   eats

Each line in test1.txt has been “pasted” to the corresponding line in test2.txt.

http://www.linuxintheshell.org/2012/04/10/episode-004-paste/ for the complete shownotes, including video.

LITS: Episode 003 - cut - Dann | 2012-03-28

In the third in his series Dann, shows us the benifits of the cut command:

The cut command, as the man page states, "removes sections from each line of a file." The cut command can also be used on a stream and it can do more than just remove section. If a file is not specified or "-" is used, the cut command takes input from standard in. The cut command can be used to extract sections from a file or stream based upon a specific criteria. An example of this would be cutting specific fields from a csv (comma separated values) file. For instance, cut can be used to extract the name and email address from a csv file with the following content:

http://www.linuxintheshell.org/2012/03/28/episode-003-cut/ for the complete shownotes, including video.

LITS: Episode 002 - tr - Dann | 2012-03-14

In the third in the series, Dann introduces us to the tr command.

Here's a flavour:
The tr, or translate (aka: transliterate) command, substitutes one more characters for another set of characters or it will delete a specified set of characters. The tr command takes input from standard in and writes to standard out. This simple example of the tr command translates some numbers into a world:

echo "12234" |tr '1234' 'aple'

The output:

apple

The entire article, including links to the videos can be found on his site:
http://www.linuxintheshell.org/2012/03/15/episode-002-tr/

LITS: Entry 001 – qrencode - Dann | 2012-02-29

In the second in the series, Dann concentrates on producing a image from the command line, QR codes to be precise.

He says: "The qrencode application is a tool to rapidly produce qrcodes. Qrcodes are handy little images that embed information many cell-phone cameras can read to do a number of tasks like provide a link to install applications, provide links to web sites or videos, or to add contacts into the address book. With qrencode, in seconds you can generate these images.
Find the excellent write up and video at http://www.linuxintheshell.org/2012/03/01/entry-001-qrencode/
or if you prefer:

Episode 000 redirection - Dann | 2012-02-15

Welcome to the first entry of Linux in the Shell. Before delving into specific commands, redirection will be explored as redirection will be used frequently in the examples going forward. The Unix philosophy posits program simplicity and that a program should do one thing and do it well (Mike Gancarz, the Unix Philosophy). Eric Raymond adds the Rule of Composition: "Design programs to be connected to other programs." Redirection is the glue that achieves this design.

Redirection is applied to any of the following standard streams to achieve results beyond simply outputting some value from a single command:

Standard Input (stdin) – 0
Standard Output (stdout) – 1
Standard Error (stderr) – 2

For the rest of this article and accompanying video please go to http://www.linuxintheshell.org/2012/02/16/entry-000-redirection/
The video can be downloaded http://www.archive.org/download/LinuxInTheShellEpisode000-Redirection/lits-000.ogv