Ampache Music Streaming Server

A Windows user has all kinds of options when it comes to audio file management and web media servers.

There’s Spotify, Emby, Deezer, Subsonic and other web-based media streamers that can give you easy access to music and video or to share music with friends. Then, there’s Ampache.

History of Ampache

Ampache logo in the screen

The Apache HTTP Server is one of the oldest platforms around, having been rolled out first in 1995.

It’s a free, open-source web server that’s cross-platform, with 92 percent of Apache HTTPS Servers run on Linux distributions. It’s a technology that was instrumental in the development of growth of the World Wide Web, and has remained the most popular web server for over 20 years.

Ampache, then, is a mashup of the words “amplifier” and “Apache.” Ampache was originally developed to work with Apache’s Mod_mp3, but has since been rewritten as its own streaming method.

Ampache was originally developed by Scott Kveton at Oregon State University way back in 2001, and has since been passed off to other hands.

Ampache is designed for a user to have access to their music, regardless of where they are, anywhere in the world.

It was developed originally for private or small group situations, but it also allows the option for an admin to offer public registration. In other words, it’s a fast, simple, secure web front end that’s compatible with almost any hardware and any platform that works with PHP, and is also written to be scalable for large music collections.

Extensions and APIs for Ampache

One of the great features of Ampache is its API for extracting meta data in the form of XML files. Ampache’s API was originally written for use with Amarok2, but it can be used with many other front-ends to Ampache and accessed through many other methods.

Ampache is usable with several network music player, including VLC, WinAMP, Foobar2000, Windows Media Player and just about any player that’s compatible with HTTP stream. It can also be used with Plex, DAAP, UPnP/DLNA and XML-API clients.

These applications all have plug-ins that are compatible with Ampache’s XML API:

  • Amarok (2.x)
  • Coherence (UPNP A/V MediaServer)
  • Rhythmbox Plugin
  • Terratoc Noxon iRadio
  • Just Player (an Android application with extra features)
  • Traxstar (based on Ampache, Traxstar Radio Automation)
  • Ampache Mobile (WebOS client
  • AmpachPre (WebOS client)
  • AmpacheX (application for iPod Touch and iPhone)
  • Lullaby (designed specifically for native Android)
  • Ampacheberry (Ampache client designed specifically for BlackBerry)

Ampache Features for Education

Ampache features in the screen

For students with language conflicts in learning, Ampache is a useful tool for instructional and assistive technology.

Several years ago, a group of advanced students at the Chelsea School realized that Ampache had potential and could be used to develop new accommodations and tweaks that could suit their learning styles and challenges. They then teamed up to build and configure an Ampache server that was customized for classroom use, enhancing teaching and learning both.

With this innovation, an instructor can add audio recordings of assignments or instructional texts to an Ampache catalog, enabling students to listen to a streaming text individually while simultaneously reading a print version of the text. This way, students can have access to materials and texts that they might not be able to avail themselves otherwise. Ampache, in an educational setting, provides a good bridge between audiobooks, text-to-speech software and a human reader.

Ampache is also useful for video streaming in classroom situations, and has been explored for teaching and learning at Chelsea School. It provides the opportunity for students to watch streamed video assignments at their workstations, rather than everyone watching instructional videos as a group.

This enhances learning by allowing students to set their own pace for progress, with fewer distractions and the opportunity to pause and take notes or re-watch segments if there is any clarification needed. It also gives students full access to the file folder for the course, so they can go back and review older material if needed.

Organizing Files in Ampache

If you’ve got all your music files in one place, you’ll probably want to organize them to make a “jukebox,” giving you the same functionality as Spotify or Pandora except with no commercials and the music of your choice instead of an algorithm’s.

You can download your music to client devices that way, and of course any music that’s hard-to-find or more obscure isn’t likely to be on Spotify or Amazon anyway.

One of the great innovations with Ampache is its ability to connect to services for lyrics, such as LyricsWiki or ChatLyrics, as well as its capacity to import music metadata from MusicBrainz. If you’re setting up a music streaming server, you can even get artists’ biographies and pictures by connecting Ampache to Last.FM.

To fully set this up, you’ll need:

  • A PC with Ubuntu 12.04 LTS and LAMP
  • Your own eb address
  • Forward port 80 from router to Ubuntu server
  • SAMBA/SWAT on the server

You can set up a media directory and download directory with fairly open permissions, so that there’s easy access to the folders on your network. In these examples, you’ll be substituting your own username for <ubuntu username>. The 777 code in these commands means anyone with access to the system can run, edit and read files:

Sudo mdkir ~/music

Sudo chmod 777 ~/music

Sudo mkdir ~/downloads

Sudo chmod 777 ~/downloads

Now, to set up a Windows folder using SWAT:

  • Log in as admin and go to http: //<ubuntu server hostname>:901 and log in with username “root” and <root user password>
  • Click on the shares box at the top and click “create share”
  • Enter the following, remembering to insert your own ubuntu username for <ubuntu username>:

path:        /home/<ubuntu username>/music
valid users:    <ubuntu username>
read only:    no
available:    yes

  • Now, click commit changes, click “advanced” and reset all the “masks” to 0777
  • Click “commit changes” again, click “basic” and “create share” and repeat the process for your downloads folder.

At this point, you should be ready to actually download and install Ampache, and can copy and move all your music over to a shared music folder (if you’re comfortable with open permissions and access).

Online Ampache Configuration

Once Ampache is downloaded, you should be ready to start with an initial configuration.

Go to your web browser and enter http://<ubuntu server hostname>/ampache. This is where you’ll see the start of the actual installation progress. Click to start the configuration and you’ll see the following boxes:

  • Desired database name: ampache
  • MySQL hostname: localhost
  • MySQL admin username: root
  • MySQL administrative password: (set a password here)
  • Create database user for new database
  • Ampache database username
  • Ampache database user password

At this point you should establish a new username and password specifically for Ampache.

Android Players for Ampache

Cartoons in the screen

If you’re wanting to run your Ampache music collection through your Android device, here are some media players that are a great fit and are available through Google Play Store:

  • Subsonic: Available for free and is currently installed on about 300,000 Android devices. Subsonic Music Streamer is on six top lists around the world on Play Store.
  • Just Player: Compatible with Ampache as well as GoogleDrive, Dropbox, OneDrive and Box (in pay function). Ampache playback is free of charge.
  • ServeStream: Open-source HTTP streaming media player that supports custom, SHOUTcast and online radio streams as well as Ampache. Includes alarm clock feature, repeat and shuffle modes.
  • Amdroid: This one is a little more off the radar, but is designed specifically for use with Ampache.

Wrapping Up Ampache

list of soundtrack with black background

Ampache is versatile, but it’s not exactly universal. While it doesn’t use codecs, it can still convert music in real time if you’re using a player that isn’t compatible with a specific format. For example, if your player can’t play FLAC, Ampache can convert it on the fly to mp3 or another compatible format.

That being said, ampache can play content from Subsonic, Plex, DAAP or UPnP backends, as well as live streams or radio, podcasts, Dropbox, Soundcloud and even another Ampache remote catalog. And best of all, it’s open-source and absolutely free to use.

While Ampache might be superseded or replaced by some more versatile platform in the future, it’s certainly got a lot to offer right now if you’re wanting access to your music library from your mobile device, or wherever you happen to be.

Tips On How To Update Raspbian – All You Need To Know

A few years ago, the Raspberry Pi was introduced as a cheap single-board computer aimed at teaching the basics of computer science for students and in developing countries.

Although it doesn’t include peripherals like a case, keyboard or mouse, Raspberry Pi has become a hugely popular tool (partly thanks to its price, ranging from $5 to $35).

The processor speed for Raspberry Pi’s ranges from 700 MHz to 1.4 GHz, with on-board memory between 256 MB and 1 Gb RAM. It’s capable of HDMI or composite video, with a 3.5mm phono jack for audio and an 8P8C Ethernet port (on the B-model), Wi-Fi and Bluetooth.

The Raspberry Pi has seen several upgrades and iterations since its introduction in 2012 – variations have included changes and upgrades in peripheral device support and hardware, among other things.

One of the newer options includes third-party Ubuntu, Windows 10 Io% Core, RISC OS and Raspbian, which is a Debian-based Linux distribution that’s downloadable through the Raspberry Pi Foundation.

What Is Raspbian? 


Put simply, Raspbian is an OS for Raspberry Pi, with several versions that include Raspbian Jessie and Raspbian Stretch. It’s optimized for the CPU of the Raspberry Pi and its limited processor speed and memory.

Raspbian’s website offers a zip file for installation, easily downloaded here.

Installing Raspbian

Raspbian logo

For a newer Raspberry Pi with Hynix or a Samsung memory, it’s recommended that you replace the kernel and bootload that comes with the installer, and upgrade to a more recent version from the Raspberry Pi Foundation.

The SD media card that the installer uses to update Raspbian has a reputation for very slow performance. There are tens of thousands of small files that the installer needs to write to various locations in the root file system, and even a minimal installation of Raspbian on an SD card can take an hour and a half or more.

An installation that incorporates the Debian desktop environment, which has an additional 800 or so packages, can take more than 8 hours to complete, depending on the speed of the SD card. With this in mind, it’s advisable to install onto other media, such as a USB hard drive.

Installing Raspbian to USB Flash Drive or Hard Drive

  • Make sure that the external drive is being detected by the installer – you will have to set up partitions manually
  • You’ll need to keep the RasPi boot partition on the SD card
  • You won’t be able to mount this partition as /boot – instead, mount the FAT32 partition as /rpiboot
  • Post-install script will term this as /boot after installation
  • Place any other partitions on an external drive
  • The root partition block device needs a specific name – edit cmdline.txt kernel options to direct rootfs when installation is complete

Doing the Update

So, we know that it’s a good idea to update Raspbian software and keep it totally current, since bugs in older iterations of Raspbian can be the source of a lot of problems.

There are a couple of ways to perform these updates, some easier than others.

  • Verify connectivity: Plug a network cable in and ensure that the machine has an internet connection, and verify by going to any website on your browser.
  • Get to the terminal: The Terminal will show up as a simple black screen with white text. To locate LXTerminal on your desktop, find the monitor-shaped icon that’s mostly black and double-click on it. You should see a new window pop up, which is the Terminal.
  • Perform the update: Enter this command – curl https: // | bash

You’ll then be asked if you need to reboot – be sure your work is saved, and then answer Y for Yes.

Here’s another method for an update:

Enter these commands in this order, and wait for each of them to complete:

Sudo apt-get update

Sudo apt-get upgrade

Sudo reboot

Sudo apt-get update will bring all the package indexes up to date. This command won’t update any software on the Pi itself, but instead provides updates on where the latest software can be found for download.

“Update” needs a minute or two to work while it downloads the updated package lists.

Sudo apt-get upgrade is the command that actually initiates software upgrades on the Raspberry Pi. Usually it will inform you how many downloads are needed and how much space will be required, then it will ask you if you want to continue with the process.

Depending on how fast of an internet connection you have and how long ago your last upgrade was, this step can take several minutes or perhaps longer.

NOTE: On occasion, the packaged “raspberrypi-bootloader” will be part of the updates. This update includes new firmware for Raspberry  Pi, replacing the existing kernel with a newer, more stable version.

“Rpi-update” can help you obtain the newest releases of the kernel and firmware, but it’s recommended that you avoid this command. If there’s a problem with the firmware, it can render your machine un-boot-able, with some consequences that can be difficult to fix.

Sudo reboot is what reboots the machine, letting you restart with all-new firmware. You’ll need to reboot the machine to finalize the update and bring everything all the way up to speed.

Upgrading from Raspberry Pi Jessie to Raspbian Stretch 9

This upgrade is a fairly simple process, but you’ll still need to use caution. The fewer third-party packages and services you install, the better the chances are that you’ll be able to successfully upgrade your Raspbian Linux system and get updates.

On the other hand, if you go too far with third-party packages, there’s a chance of breaking the entire system.

To start:

  • Remove any outdated or unnecessary packages
  • Put together a data and configuration backup
  • Using a console, perform a direct upgrade

NOTE: The default SQL database in Debian 9 Stretch is now MariaDB. It features a new database binary data file format, which isn’t fully compatible with you’re the Debian 8 Jessie format.

Databases will be automatically upgraded during this process, but you will not be able to revert back should you run into any problems during the upgrade or after. That’s why it’s crucial for you to back up any current databases before going any farther with a Debian 9 Stretch upgrade.

Begin Your Upgrade

These are the first steps for a Stretch package to update your Raspbian system:

# apt-get update

#apt-get upgrade

To upgrade any held-back packages:

# apt-get dist-upgrade

Now, check for any system issues and perform a database consistency check. This should find any missing, obsolete or partly-installed packages:

# dpkg -C

Now, you can check for any packages that are held back:

# apt-mark showhold

Any packages “on hold” will not upgrade, and in fact might cause inconsistencies after the upgrade to Stretch. It’s recommended to fix any issues that are brought to light by these commands before moving ahead.

Now, you can upgrade the package depository to include any new Stretch repositories:

# sed -i ‘s/jessie/stretch/g’ /etc/apt/sources.list

This command will enable new Stretch repositories by replacing any Jessie keyword occurrences. When your /etc/apt/sources.list  is fully updated to include Stretch repositories, your local package indes can be updated with:

#apt -get update

To do a dry run of the upgrade, enter the command:

# apt-get – simulate upgrade

Performing the Jessie Upgrade

Now it’s time to start on the actual Jessie upgrade to update Raspbian. You may see this message:

There are services installed on your system which will need to be restarted when certain libraries, such as libpam, libc and libssl, are upgraded. Since these restarts may cause interruptions of service for the system, you will normally be prompted on each upgrade for the list of services you wish to restart. 

You can choose this option to avoid being prompted; instead, all necessary restarts will be done for you automatically, so you can avoid being asked questions on each library upgrade.

This message, in other words, gives you the choice of restarting the services automatically while the system is upgraded, restarting them manually or waiting until after the system upgrade to Stretch is fully completed.

Ready? These commands will execute the Debian Stretch upgrade process:

# apt-get upgrade

# apt-get dist-upgrade

Now You Know How to Update Raspbian

Flower, raspberry and heart shapes

That’s it! Reboot your system and you’ll be completely upgraded.

We hope that this step-by-step guide helps you understand and enjoy Raspbian even more.

Tutorial About Echo Linux – Everything You Need To Know

If you’re working in Linux, Echo is one of the most prevalent, commonly-used built-in commands for both bash and C shells. This is a basic command that’s used in most operating systems where a command line is required.

Echo is commonly used in scripts, batch files or as a component of individual commands – in other words, in any instance where you need to add or insert text. That’s why echo is a built-in command in shells such as bash, ksh and csh.

Terms and Syntax For Echo

file of echo linux

First, we should get clear on a couple of terms:

  • command is any instruction that tells the computer to do a specific action or task
  • An argument is the input data for that command
  • Standard output will be the display screen, by default, but can also be redirected to a folder, file, printer, etc
  • Syntax is the required way of putting the command and argument together
  • string is a finite series of characters, which can include symbols, punctuation marks, letters or numerals

Echo also is used with tags, such as:

  • -n: Do not output a trailing newline
  • -e: Enable interpretation of backslash escape sequences
  • -E: Disable interpretation of backslash escape sequences (this is a default setting)
  • --help: Display a help message, then exit
  • --version: Output version information, then exit
  • \\: This denotes a backslash character
  • \a: An alert or “bell” character
  • \b: backspace
  • \b: End of sequence, no further output needed
  • \e: Literal “escape” character, or the equivalent of pressing the escape key on a keyboard
  • \r: Form feed
  • \n: Newline
  • \r: Carriage return
  • \t: Horizontal tab
  • \v: Vertical tab
  • \ONNN: Byte with octal value of NNN, which can be one to three digits

Examples of Echo

Now that we’ve gone through a little cheat sheet for echo, here are a few examples of how it’s used.

Example 1

To print “I need a sandwich” on console:

$ echo “I need a sandwich”


I need a sandwich

Example 2

This time, we want to print the value of x, where x=10

$ echo $x

Output: 10

Example 3

This time, we want to remove spaces – this touches on the terms we discussed above, in our cheat sheet:

$ echo -e Here \bthe \bspaces \bare \bbackspaced



Example 4

Here, we’ll use option \n for newline, with backspace interpreter -e treating each newline from where it is used:

$ echo -e Here \nthe \nspaces \nare \nnewlined







Example 5

Using option \t – horizontal tab with backspace interpreter -e, to create horizontal tab spaces:

$ echo -3 ‘Here \tthe \tspaces \thave \thorizontal \ttab \tspaces’


Here    the        spaces have      horizontal tab        spaces

More On Syntax

We did touch on syntax for Echo briefly above, so let’s expand on that. The syntax for echo is:

Echo [options] [strings]

When no options or strings are specified, echo will display a blank line on the display screen, with a command prompt following on the subsequent line. When you press the ENTER key on your keyboard, this is a signal for the system to initiate a new line, and echo will repeat this signal. When arguments consist of one or more strings, echo will (by default) repeat those strings on the screen. For instance, typing in the following phrase and then pressing the ENTER key would result in echo repeating the phrase I need a sandwich on the screen:

echo I need a sandwich

As you see, it isn’t necessary to use quotation marks to surround this string, as it doesn’t have any effect on what is displayed on the screen. When sing either double or single quotation marks, they will not be repeated on the screen.

Of course, echo can do more than repeat word-for-word whatever follows it. When the dollar character ($) is used and is put before a particular variable with no intervening spaces, it can show the value of that variable by telling the shell to substitute that variable’s value for its name.

Let’s say that you have a variable named x with a value of 5. It can be created and its value set with this command:


Now, we can recall the value of x with echo by the following phrase:

echo The number is $x.

Environmental Variables

Sample of echo with grey background

There will be instances where the shell needs to understand how to behave when a user is working at the command line, or in a script (which is actually a short program). These are called environmental variables, and echo is especially useful in these iterations.

Let’s say the current user wants to make reference to the home directory. In that case, the value of HOME is the environmental value:

echo $HOME

The user’s PATH can be considered another environmental variable, along with a colon-separated list of the directories that the system accesses to search for an executable program specified by a user’s command:

echo $PATH

By default, echo will follow any output with a newline character. This is an invisible, non-printing character, representing the break at the end of one line of text and the start of the next line. In Unix-like systems, it’s represented by |nAs a result, the next command prompt will begin on a new line, rather than remaining on the same line as the output generated by echo.

The -e option is for instances when there are other special characters, such as a horizontal tab (represented by \t) along with additional repeats of the newline character.  The -e option comes into play in a formatted output such as this:

echo -e “\n Projects:  \n\n\tplan \n\tcode \n\ttest\n”

While a command like the above one might display as two lines on a smaller screen, it should be written as a single line. To prevent echo from adding newline to the output, the -n option should be used.


For redirecting output, echo incorporates a simple way of creating text in a new file. It’s a matter of typing echo and then the desired text, followed by the output redirection operator (a right-pointing angle bracket) and then the name of the new file. In this case, special characters can also be used to format the new file. So, for instance, we can create a new file using the formatted output from the example above:

echo -e “\n Project 1: \n\n\tplan \n\twrite \n\ttest\n” > project1

This new file, including any necessary formatting, can be verified when you use a command such as cat or less, for instance:

less project1

Appending Text

Echo is also a convenient way of appending text at the end of a file, when using it in conjunction with the append operator. The append operator is represented by two right-pointing angle brackets. NOTE: this feature should ideally only be used in scripts – if you accidentally use a single angle bracket instead od the double bracket, it can overwrite the entire contents of the file.

Echo can also be used with the wildcard character for pattern matching. We’ll call the asterisk the wildcard character, and this command would return the phrase The gif files are, followed by a list of all the .gif files found in a given directory:

echo -e The gif files are *.gif

Echo is also used for when you need a shell script to display instructions or a message, such as an interactive session with users where a Please enter Y or N option is needed.

NOTE: echo will automatically be turned off whenever a password is entered, so the password won’t be shown on the screen.

Wrapping Up

Sleeping linux symbol

Be aware that there are several implementations of echo that exist on different operating systems, some of which may be incompatible. Some will expand escape sequences by default, while others don’t. Some of them also can accept options, varying with implementations, and some of them will not.

With these variations in behavior and performance, echo is regarded as a non-portable command on Unix-type systems. In some cases, the printf command (introduced by Ninth Edition Unix) is the preferable command.

Everything You Need To Know About WC Linux

The roots of Unix go all the way back to the 1970s and Bell Labs. Originally intended for use at Bell and AT&T, Unix was licensed for use with outside parties starting in the late 70s, and soon it was in use at UC-Berkeley, Sun Microsystems, Microsoft and IBM. Over the years, the rights to Unix changed hands among Novell, Santa Cruz Operation and The Open Group. Today, the single biggest application for Unix is with Apple’s macOS.

Unix was originally intended as a platform for programmers who were developing Unix-compatible software. It began to catch on in academic circles and grew larger as users adapted their own tools into the system. Unix uses plain text for storing data, with a hierarchical file system and the capacity for treating devices and interprocess communication as separate files. By the early 80s, users began to regard Unix as an operating system that could be suitable for computers of all sizes.

Understanding Unix

Unix can be thought of as the link between the user and the computer, in the form of a set of programs. These programs allocate and manage the computer’s resources, with the shell translating commands from the user and converting them into terms that are understood by the “kernel” or OS, which is Unix.

The system also runs on commands and utilities, which initiate everyday tasks for the system and are usually delivered through third-party software. Its information and data are all organized into files, which are further organized into directories. This tree-like design is called the filesystem.

WC for Linux


In Linux and Unix operating systems, the WC (word count) command is what’s used to determine the number of newline count, word count, bytes and characters in a file, as defined by the file arguments. Let’s break down these definitions a little bit, as they pertain to Linux and Unix:

  • Newline: a control character or a series of control characters in a character encoding setup such as ASCII or EBCDIC. Newline marks the end of a line of text and the beginning of a new one.
  • Byte: a sequence of a certain number of bits, which can be used as a unit of memory or storage. An eight-bit byte is used for instructions execution
  • Word : a “word” is considered to be any sequence of characters, followed by a white space.

Counts are always assembled in the following order: newline, word, character, byte, maximum line length. So, these are a few examples:

WC -1: Prints the number of lines in a file

WC – w: Prints the number of words in a file

WC – c: Displays the count of bytes in a given file

WC – m: Prints the count of characters in a file

WC – L: Prints only the length of the longest line in a file

WC In Use

WC logo

Obviously, WC is really handy when there are instances where you need to know characters, line counts, bytes, words or longest lines in a given file. So, let’s take a look at how it’s actually done.

A basic command could be:

$ wc/etc/passwd

65 185 3667/etc/passwd

In a case such as this, 65 is the lines count, 185 the word count and 3667 the characters count. Now, should you just need to know the number of lines in a given file, add the -1 argument:

$ wc -1 etc/passwd


Determining the number of words in a file, add the -w argument:

$ wc -w etc/passwd

          185 etc/passwd

Using Pipes in Linux WC Commands

Pipelines, in Unix and Linux systems, can be thought of as a series of processes that are linked by standard streams, with the output of one process fed directly as input to the next process. The shell syntax used for pipelines will list a series of commands, each separated by a vertical bar or “pipe,” in Unix/Linux verbiage. Pipes and pipelines are also used in other operating systems, such as Microsoft windows, DOS, OS/2 and BeOs.

WC as a command follows the process of reading input from STDIN and writing output to STD out. Thus, it can be used in Linux command pipelines, for instance:

Here’s a command that shows the number of people who are logged into your Linux system at any given time:

who | wc -1

In this instance, the output of the “who” command is piped into the input of the “wc” command, which, in this case, is being used to tabulate the number of lines in the output of the “who” command.  Along the same lines, this example shows how to use pipelines and WC to indicate the number of processes running on a Linux system at a given time:

ps -3 | wc -1

This is achieved the same way as the previous example. The “ps” command generates output, and the “wc” -1 command indicates the number of lines of output associated with that command. In other words, piping is a useful way to connect the streams and connections between programs and files, directing and redirecting data in accessible ways.

Redirecting From a File

Let’s look at this example:

user@bash: wc -1 myoutput

8 myoutput

user@bash 2c -1 ¸myoutput



Many programs allow a user to access a file as a command line argument, and will then read and process the contents of that file. Using WC to supply the file you need as a command line argument, the output from that program displays the name of the file that’s being processed. The subtle difference in this example is that when we want to redirect contents of the file using wc, the file name isn’t printed since in an occasion where redirection or piping are used, data is sent anonymously. In this example, WC refers some content to process, but can’t print this information since there’s no specific knowledge of where it came from. This is a mechanism that can be used to get access to ancillary data, which isn’t printed.

Now, we combine two different forms of redirection into a single command, still using WC:


user@bash: wc -1 < barry.txt > myoutput

user@ bash: cat myoutput



Let’s Recap

So we’ve talked about how to use the WC command in Linux and Unix. Just to reiterate:

Wc -1 : prints the number of lines in a file

Wc -w: prints the number of words in a file

Wc -c: displays the count of the bytes in a file

Wc -m: prints the count of characters in a file

Wc – L: prints ONLY the length of the longest line in a file


To find more information and get help for the WC command, run “wc -help” or “man wc” from the command line. Remember that more than one file name is called for in argument, the command will show a four-columnar output that displays all individual files. There will be another extra row that displays all files specified in argument, including the total number of characters, lines and words, along with the keyword “total.”

The WC command can also be used to get a total of the number of rows or records in CSV files, when used along with pipes. Here’s an example with five CSV files and the objective of finding the sum of records across all five files. Here, we’ll pipe the output of the “cat” command to WC:

cat *.csv | wc -1


Thus, there are 1866 records counted across all five files.

WC can also be used to get a total of folders and files in a directory, when combined with the ls command. It involves passing the -1 option to ls to count each folder or line, piped to WC to give a count:

ls -1 | wc -1


And we see a total of 21 folders and files in that directory.

Learning your way around Unix and Linux is a lot like learning a new language, and the WC command is just another part of the syntax that you’ll need to grasp to do well with Unix.

How You Can Use Rescutux To Save Your Linux or Windows System

Any operating system should have a rescue CD, DVD, USB or download that’s available, just in case the worst happens. Everyone knows that Windows and Linux systems can fail and crash so completely that there’s seemingly not much the user can do to resuscitate them.

That doesn’t mean that all hope is lost, though.

Rescutux is a product from GNU/Linux that’s designed to bring an apparently-dead operating system back to life. It’s not exactly a “reinstall” CD, but more of a companion utility that is handy for when the unexpected happens.

It features an array of tools and works in live mode to cover a wide range of issues that crop up in Linux and even in Windows. While many of the tools for rescuing a “broken” OS can be daunting to use, Rescatux is pretty straightforward. Right away, it launches Rescapp, a window that can be used to address problems with a series of categorized icons and buttons.

Rescutux can be downloaded here.

From there, the best approach is to burn it onto a CD-ROM or USB, making sure that it’s burned as an image and NOT a file. When you insert the media, your machine should do Rescutux autodetect, by default. Press return – if you don’t press return, it should be autoselected anyway inside of 60 seconds time.

Getting Started with Rescutux

rescatux logo

The first step you’ll want to take on with Rescutux is a password reset. This is a solution that will work for XP, Vista or Windows 7. You’ll see a button on the main window that corresponds to this particular action – press it and you’ll see detailed instructions and prompts on how to do the reset.

When you’re ready, just press the “Run” button at the top of the window.

If the problem you’re having originates on your Linux partition, Rescutux can help that as well. Select the partition in the system that’s giving you problems, and then just select which user you want to designate and set a new password.

Booting USB Via Yumi

boot logo

Booting via YUMI by default will boot onto the machine’s first hard disk. When you see the YUMI MultiBoot USB screen, select Linux Distributions using the down arrow key, then the return key. From there, you should see Linux Distribution screens – again, use the down arrow key and return key to arrive at the Rescatux entry. You should then see the Rescutux ISOlinux screen.

Use this default entry: Live (amd64).

Should you see this message:

This kernel requires an x86-64 CPU, but only detected an i686 CPU. Unable to boot – please use a kernel appropriate for your CPU

Go ahead and repeat all these steps to be able to boot into your device, but select the Live (486) entry instead.

Grub Menu Issues

When a filesystem has errors, there are several things that can go wrong, sometimes unpredictably so. Sometimes Grub1 or Grub2 can’t locate its own files (which will show as Grub errors) or the kernels (which are “cannot find file” errors).

You may encounter situations where the kernel can be loaded, but the initrd stage can’t find the final device root filesystem. These are options to fix filesystem errors, even when a filesystem at least seems to be clean and OK.

Here are a couple of methods to rescue Grub, if you’re seeing a black screen with the message “Unknown Filesystem” and “Grub Rescue”:

  • Type IS and hit Enter
  • You’ll see several partitions that are in use on your PC, such as hd0,msdos1 or hd0,msdos2. Click on the partition where your Linux distro is installed.
  • You’ll be asked which is the Gnu/Linux partition on your machine. Select the Gnu/Linux distro partition and ignore the Loop1 partition,
  • If your distro is installed in the second option, enter this command: setprefix=(hd0,msdos1)/boot/grub. If you can’t remember or don’t know which partition, use this command with every option. You’ll see either an error message or you’ll be able to proceed.
  • Once you’ve found the drive, enter: insmod normal and then normal.
  • Your laptop should now reboot and take you to the desktop. Enter Ctrl+Alt+T and open terminal, then enter sudo update-grub followed by sudo grub-install/dev/sda. You might be asked for your password next – type it in, even though the password may remain invisible while you type it.
  • If Grub files are lost, the system will ask for a data connection in order to download them.

Now, here’s another method for recovering Grub:

  • Get a live USB stick and plug it in.
  • After booting up into the live desktop, open terminal.
  • Type /mnt and boot to /mnt/boot, then hit Enter to mount the root partition.
  • You should be able to replace /dev/sda with the correct partition at this point.
  • Type sudo update-grub to update Grub (this can take some time).

Now, if all else fails:

  • Get a Windows OS installation DVD – not a Windows XP or Windows Vista DVD.
  • Launch it in the PC or laptop and run the installer, either by going into boot order in the bootloader or just by pressing F12.
  • When the Windows files are loaded, you should see a dialog box with “Repair your Computer.” Select this button.
  • If prompted, in system recovery mode, select OS. Now enter the command bootrec/fixboot.
  • Quit setup and reboot the machine. At this point, Windows is restored, and Linux distro is present, but Grub has been overridden.

How to Set Partitions

You’ll find an “Expert Tools” section in the Rescutux window, with the “Gparted” tool residing in it. You can reconfigure the partitions the tool has detected this way.

Just right-click on the partition/disk that you will be reconfiguring, which will next display a set of options that includes format partition, resize, delete, etc.

Ordering Your Hard Disks

If your machine has more than one hard disk, you’ll be asked to select and order the hard disk, in boot order that parallels the BIOS boot order. This way, Grub knows if it’s booting from a secondary device or from the first device to boot.

  • Wait for Rescapp to finish. You may see a message while Rescapp is performing its assigned task, which can take some time. Be patient and wait until the process is finished.
  • You should see a message saying everything went OK, or “something went wrong.”
  • If you see a message that the procedure went wrong, click on the Chat button up at the top right corner of Rescapp and you can ask for help. You may be asked to share your logs via the Share Log button.
  • When engaging in Chat, remember that the wait times for replies may be fairly long. Rescatux is funded by donations, and the money for a well-staffed support just isn’t there. If you’re still having problems, you can ask someone knowledgeable by forum or mailing list.

How to Restore Files

There’s a command line tool that enables users to find any files that were accidentally deleted in a partition. This is one of the more esoteric features of Rescutux, but it can be executed through the “Expert Tools” using the button named “Photorec.”

You will see a partition where files were located – just select the filesystem type you want and press “c” to start the search for deleted files. Please note this only works on HDD partitions – any files located in SSD partitions cannot be rescued using the Photorec features.

Support Features for Rescatux

One of the unique features of Rescutux and its wizard is the suite of support features that are available.

  • Chat: Having trouble? You can go directly to a Rescutux channel and open the chat feature to ask for help directly.
  • Share log: Each option or procedure will have its action registry stored as a log which you can share in the chat for better help and a better handle on what’s going on. Better still, users can help identify, debug and fix any Rescutux bugs that are encountered, on the fly.
  • Share log on forum: There’s also a feature where you can copy and paste your logs into the forum of your choice. The logs are in forum post-alike text, complete with code symbols.
  • Boot info script: You can share your computer configuration and boot script by running Boot Info Script option.

Wrapping Up on Rescutux

Once everything is back up and running, you’ll see an on/of button at the right bottom corner of the Rescutux wizard. Click on it and you’ll see “Shut down” on the menu. The computer will then power off.

At this point, you should remove the Rescutux media so that the machine doesn’t boot Rescutux the next time you turn it on instead of your regular OS.