Linux Napster Client: User Guide

Peter Selinger (selinger at theory.stanford.edu)

Created March 28, 2001. Updated April 8, 2001.


This document describes the linux napster client "nap". It covers basic installation, configuration, and usage, as well as some finer points.

1. Introduction

2. Author and copyright

3. Downloading and installation

4. Configuration

5. Basic nap usage

6. Messages and channels

7. Advanced features

8. Summary of command line options

9. Summary of nap commands


1. Introduction

Nap is a a linux console napster client written by Kevin Sullivan. This user guide is an attempt to summarize some of the most important features, from a user's point of view. Additions and corrections are always welcome.

2. Author and copyright

This user guide can be freely copied, modified, and distributed under the GNU public license.

The nap software is copyrighted by Kevin Sullivan, under conditions set forth in the file COPYRIGHT.

3. Downloading and installation

The current release of nap is available from http://theory.stanford.edu/~selinger/nap. You can download nap in one of several formats. In the following, XXX stands for a version number.

3.1. Source distribution

This is the most complete distribution of nap, since it contains all the source code necessary to compile nap. On the other hand, this means you have to compile it yourself. This is not very difficult, but if nap is available in precompiled form for your platform, you might find that easier.

Instructions: download the file nap-XXX.tar.gz. The following sequence of commands should compile and install nap.

        tar -zxf nap-XXX.tar.gz
        cd nap-XXX
        ./configure
        make
        su
        (type root password)
	make install

3.2. Linux precompiled distribution

Instructions: download the file nap-linux-XXX.tar.gz. Install nap as follows:

        tar -zxf nap-linux-XXX.tar.gz
        cd nap-XXX
	su
	(type root password)
	cp nap /usr/local/bin/nap
	chmod 0755 /usr/local/bin/nap

3.3. RPM package

RPM is the Redhat Package Manager. It allows for easy installation of packages on Redhat Linux systems, and on other systems where it is available. Instructions: download the file nap-XXX.i386.rpm. As root, install nap with the single command

        rpm -ivh nap-XXX.i386.rpm

3.4. OpenBSD package

Instructions: download the file nap-XXX.tgz. Install it with the single command

        pkg_add nap-XXX.tgz
Note: this file is an OpenBSD Package, not a regular tar archive. It should be installed with "pkg_add". If you unpack it with "tar", do it in an empty directory, as it will spill some files into the current working directory. If you do unpack this as a tar file, you will find an executable binary in the "bin" subdirectory.

3.5. Other formats

Nap may be available in other formats, for instance in precompiled form for other operating systems. Something similar to the above instructions should work. Note that precompiled code for Windows is available at http://www.gis.net/~nite/ for an older version of nap.

3.6. What if you don't have root privileges on your machine?

Don't worry. It is not really necessary to install nap in /usr/local/bin; you can install it anywhere you like. All that is really necessary is that the nap binary is somewhere in your PATH. The recommended steps are as follows:

1. create a directory bin in your home directory, and move the file nap there.

        mkdir $HOME/bin
	mv nap $HOME/bin
2. If the shell you are using is sh or bash, put the following lines in the file .bashrc in your home directory:

        PATH=$PATH:$HOME/bin
	export PATH
If the shell you are using is tcsh, put the following line in the file .tcshrc in your home directory:

        set path = ($path $HOME/bin)
3. Restart the shell. You should now be able to invoke nap by typing nap.

4. Configuration

Installation means that nap is available on your system; it is done only once, usually by the system administrator. Configuration, on the other hand, has to be done by each user who wants to use nap. It is very easy: simply create a file .napconf in your home directory, whose content looks more or less like the following (of course, you need to substitute your own data):

# the username, password, and email address of your Napster account
user=username
pass=?
email=email@here.com

# a list of directories with shared files, separated by semicolon ';'
upload=music/;music2/

# a directory where to put downloaded files
download=music/

# which port to use for incoming upload requests - probably the
# default will do fine. It is advisable to specify a range in case the
# given port is busy.
dataport=6699-6799

# your type of internet connection, according to the following list:
#
# Connection | Number
# -------------------
# Unknown    |  0
# 14.4       |  1
# 28.8       |  2
# 33.6       |  3
# 56.7       |  4
# 64K ISDN   |  5
# 128K ISDN  |  6
# Cable      |  7
# DSL        |  8
# T1         |  9
# T3 or >    | 10

connection=4

A file with the above sample contents came with your nap distribution, and you may find it easy to copy it to your home directory and edit it to your tastes. The sample file is called nap.conf.dist. If you used RPM, this file can be found in the directory /usr/doc/nap-XXX, otherwise it is in the tar ball that you unpacked.

Note that you may either enter your password, or you may leave the password entry blank (or use a single question mark), if you want nap to prompt you for your password each time.

That is all. You are now ready to use nap. In fact, even if you don't create this file, you can still use nap, and you will be prompted for the missing information. However, in this case, you will not be able to share any files.

All the options that you specify in your .napconf file can be overridden on the command line. In fact, it is even possible to have more than one configuration file (for instance, if you have two different napster accounts with different usernames and passwords), and to specify on the command line which one to use.

5. Basic nap usage

5.1 Starting nap

Congratulations, you have installed nap and set up your configuration file. You have told nap where to find your shared files, and you are ready to give it a try. Simply invoke nap by typing

        nap -b
You will be prompted for any necessary information not included in your configuration file, and eventually you will see napster's main screen, which looks more or less like this:


                                                             [nap v1.4.4-ps-2] 

     _.-------._
    |\          /|
   /| \_.----._/ |\                                  __
  .$:            :$.    _____  ____   _____  _____  / /__ ___   ____
 |$$:  ___  ___  :$$|  / __  // _  `// _   //  ___//  __// _ \ / ___/
  "$: \___\/___/ :$"  / / / // /_/ // /_/ /(__   )/  /_ /  __// /
    |     __     |   /_/ /_/ \__,_// ____//_____/ \___/ \___//_/mG!
    `.    \/    .'                /_/
      `. .__, .'
        `----'

* This is the main screen of nap.
*
* In this space, you will usually see some welcome messages from your 
* Napster server.
*
* In the upper right corner, you see the version number of nap.
* The blue line below is called the status line.
* It displays the user name, and some other information. In the right part
* of the status line, you see the number of current uploads and downloads.

 [username] [474042 songs in 8066 libraries (1954 gigs)]             [U/0 D/0] 

The very last line, after the status line, has a cursor. This is where you can enter commands. All commands start with a slash "/"; if you forget the slash, nap will complain that you are "not on a channel". But more about that later.

5.2. Simple searches and downloads

To perform a search, you use the /search command. For instance, if you want to search for a song called "Yucky green goo", you type

        /search yucky
This will cause nap to search for files that contain the word "Yucky". Napster queries are case insensitive, so it doesn't matter if you search for "yucky" or "Yucky". If fact, napster is generally very tolerant regarding search queries.

After a few moments, another screen will pop up with the search results. This is called the result screen. It might look as follows:


Filename (total = 14)                    | BRate       | Length       | Conn
-----------------------------------------|-------------|--------------|---------
1) Bobby Bones - Yucky.mp3               | 64          | 3:24         | T3
2) HOT 5- [07]Time Will Tell.mp3         | 128         | 2:12         | T3  
3) WB theme songs - Jack and Jill .mp3   | 128         | 3:00         | Cable
4) Korean Rap-YG family - 1tym attack.mp | 128         | 3:35         | 56k
5) Felicity THEME season 3 (New version  | 128         | 0:53         | 56k
6) Passions theme.mp3                    | 128         | 2:24         | 33.6
7) Korean - Uptown(03)- Han Oh Baek Nyun | 128         | 4:25         | 28.8
8) BB Mack  - Back Here.mp3              | 192         | 3:40         | 28.8
9) Cher_with_Peter_Cetera-After_All.mp3  | 128         | 4:04         | 28.8
10) Gob- Paint it Black.mp3              | 160         | 1:49         | 28.8
11) 3lw (Three Little Women) - NO MORE3. | 192         | 4:26         | 28.8
12) kpop-CLICK B-EXIT.mp3                | 128         | 4:21         | 14.4
13) Duets - Gwyneth Paltrow & Huey Le wi | 192         | 4:51         | 14.4
14) Dawson's Creek 2 Soundtrack - Shawn  | 128         | 4:38         | Unknown
                                         |             |              |
                                         |             |              |
                                         |             |              |
                                         |             |              |
                                         |             |              |
                                         |             |              |
                                         |             |              |
1:\1\Mp3\Bobby Bones - Yucky.mp3

Note that not all files listed actually contain the word "yucky". For instance, some of them might be found in a directory named "yucky", but the directory name is not displayed in the results list.

The files are listed in decreasing order of connection speed. On the result screen, you can move up and down with the respective arrow keys, or you can move faster with the "PgUp" and "PgDn" keys. The red line at the bottom displays the full filename of the song currently selected; if it does not fit on the screen, you can scroll it from side to side with the right and left arrow keys.

By default, the result screen displays the bitrate and length of each song, as well as the connection speed and/or ping results. However, you have full control over what information is displayed: The following keys toggle each category of information on and off:

        b - bitrate
	l - length
	m - megabytes
	f - frequency
	u - user name
	s - speed
	p - ping
Moreover, if you type 'a', all categories of information will be turned on. Warning: this might not all fit on the screen, and will be cut off on the right.

You can hit "return" for any song you wish to download. Note: do not use nap to download or distribute any copyrighted material.

Type "q" to return to the main screen. From the main screen, enter /results to return to the result screen. You can also switch back and forth between the main screen and the result screen with the function keys "F1" and "F2".

Back on the main screen, nap will inform you about any downloads or uploads that have been started or stopped. If you want to see a detailed list of downloads that are currently going on, type

        /pdown
This will tell you, among other things, how far each download has progressed.

If you want to delete a particular download, first find out what its number is by using /pdown. Suppose you want to delete download number 3, then you type

        /ddown 3

Files are downloaded into the directory which you specified during configuration or on the command line. If you did not specify a download directory, nap will use the current working directory.

Do not try to download two files with identical names. Nap currently does a very bad job in this situation. Wait until one download has finished, then rename the file manually.

5.3. Browsing another user's files

Browsing works almost exactly like searching. Just type

        /browse 
and that user's files will appear on the result screen.

5.4. Uploads

Uploads are similar to downloads, except that they are initiated by a remote user, and not by you. (Of course, what's an upload for you is a download for the remote user). The analogs of /pdown and /ddown for uploads are /pup and /dup.

5.5. Navigating the main screen

On the main screen, you can use your "PgUp" and "PgDn" keys to scroll up and down. This allows you to see stuff that has disappeared off the top of the screen.

You can use to "up" and "down" keys to scroll through a history list of previous commands. This will help you save time typing. You can also use the "tab" key for completing partially typed commands. For instance, /res[tab] will yield /results.

Type /results to return to the results screen after a previous search. Type "q" to leave the results screen.

You can type /help to see a list of available commands. (There are so many that you will probably have to use "PgUp" and "PgDn" to see them all). You can get usage info for a particular command by typing /help followed by the command name (without the leading slash).

5.6. Quitting nap

To quit nap, type /quit. If there are any uploads or downloads going on, nap will refuse to quit unless you type /quit yes.

5.7. Building your library

Above, I recommended invoking nap with the command

        nap -b
The "-b" tells nap to "build your library", which means to compile information about all the files you are sharing. This information goes into a file in your home directory called ".nap_shared". Once you have built your library, it is not necessary to type the "-b" the next time you invoke nap, provided that nothing has changed about your shared files. This might save you some time because nap starts faster if it doesn't have to build your library again.

On the other hand, if you added or deleted any shared files or directories, it is necessary to rebuild your library, or otherwise, nap will rely on out-of date information (and not share any new files you might have added). Thus, I recommend always invoking nap with the "-b" flag unless you are sure that it is unnecessary. In the future, this may become the default behavior of nap.

You can learn about other command line options in the section "Summary of command line options" below.

6. Messages and channels

One of the nice things about napster is that it allows you to communicate with other users. This is done through messages or channels.

6.1. Messages

You can send an instant message to another user by typing

        /msg  
If you don't want to receive such messages from a particular user, you can ignore the user by typing

        /ignore user message
You will no longer see that user's messages or files. If you have regrets later, you can also /unignore a user.

6.2. Channels

When you join a channel, you can post messages to the channel and see what other users on the channel are saying. Type

        /clist
or      /clist2
to see a list of available channels. /clist2 lists more channels than /clist. To join a channel, type

        /join channel
You can be on several channels simultaneously. To switch between channels, type /join again. To leave a channel, type

        /part channel
You can omit the channel name if you want to leave the current channel.

While you're on a channel, you will see a special prompt telling you what channel is currently active. To say something on that channel, simply type the message. This is why all command names start with a slash "/": so that when you're on a channel, nap can distinguish between a command and a post to a channel.

A word of caution about double quotes ("). The napster protocol is extremely dumb when it comes to double quotes. It cannot tolerate any data which contains double quotes. This includes filenames, messages, and anything you say on a channel. This is not nap's fault; it is really a problem with the napster protocol. Thus, avoid using double quotes under any circumstances. Use single quotes instead.

To see a list of all channels you are currently on, type /pchans. To see a list of users on your active channels, type /names.

Just like for messages, you can /ignore a user that is bothering you. More severe punishments are also available for users that behave truly inappropriately: you can request to kick a user from a channel or all channels, or request that a user be muzzled, killed, or banned. Such measures should of course be taken only under extreme circumstances, and might be subject to review by the administrators of your napster server. The corresponding commands are called /kick, /kickall, /muzzle, /kill, and /ban. Try

        /help command
for more info.

7. Advanced features

7.1. Aliases

One interesting feature of nap is the ability to add new user-defined commands. This is done via so-called aliases (also called macros). Briefly, if you type something like

 /alias x get $1
this will define "x" to be an alias, and you can henceforth type "/x arg" instead of "/get arg". But there's more to aliases than this simple example suggests. For instance it is possible to write aliases that contain "if" conditionals or "while" loops. Aliases can also be saved and loaded from a file. I know very little about the details of alias syntax, so additions to this section are very welcome.

7.2. Daemon mode

Sometimes you might want to share your files on napster, even when you're not currently actively using it. For instance, if you're on a multi-user system, you might want to run a napster client in the background at all times, even when you're not logged in. (Beware though that downloads generate quite a bit of network traffic, so you better had a fast connection and be sure it is not going to upset other users).

Nap's daemon mode allows you to do exactly that. If you invoke nap as follows:

        nap --daemon --autorestart
it will connect to the napster server and then run silently. While connecting, it will still print the usual informational messages, and prompt you for any missing information. As soon as the connection succeeds, it will print something like

        Connected to 208.184.216.40:8888
and then fall silent. It will produce no further output, nor react to input. Moreover, if your config file is complete, and you are sure that nap will not prompt you for any information, you can even suppress the informational messages by redirecting its output:

        nap --daemon --autorestart > /dev/null

By the way, the --autorestart option is so that nap will automatically reconnect whenever it detects that it has been disconnected from the server. It tries to do this at most once a minute, so that your computer will not overheat in case all servers go down.

Using this method, I have been able to run nap unsupervised for days and even weeks at a time.

If you feel uncomfortable with nap's silence, and you would rather like to see whether it is actually working (and not just dozing off), you have the ability to write something to a log file. The option

        --log logfile
will cause nap to log all uploads and downloads to the specified file. (But beware that log files might later be used against you in court). If you'd like even more information, you can specify

        --logall logfile2
and nap will log everything that would have normally been written to the main screen to that file. Note that these log files can take up a tremendous amount of disk space, so you might want to delete them and restart nap periodically, for instance once a week. If a log file already exists, nap will append its output to the end of the existing file.

7.3. Running nap as a nohup process

On unix systems, it is possible to run a process as a "nohup" process - this means, the process will not be killed when you log out. This might come in handy if you want to run nap in the background while you're not logged in. Nap's daemon mode is perfect for a nohup process. For instance, the following works:

        nohup nap --daemon --autorestart -b --log logfile >/dev/null &
Note that you have to put an explicit ampersand "&", or otherwise the process will not fork to the background. To stop such a process, you will have to kill it explicitly, by saying

        kill -KILL pid
or      killall -KILL nap
where pid is the process id, as reported by the command ps -e. The second form kills all processes whose name is nap.

On my system, I use a small shell script called server, which automates these tasks. Here is the script:

#! /bin/bash

napservers="-s 63.196.54.15:8888"
napservers="$napservers -s 63.196.54.248:8888"
napservers="$napservers -s 63.196.54.4:8888"
# etc

if [ $# -gt 0 ]; then
    action=$1
    shift
else
    action=start
fi

if [ $# -gt 0 ]; then
    target=$1
    shift
else
    target=all
fi

do_action () {
 local action target
 action=$1
 target=$2
   
 case $action in
  start )
    do_action stop $target

    if [ "$target" = all -o "$target" = gnut ]; then
	echo -n "Starting gnut "
	nohup gnut -d >/dev/null &
	echo $! > gnut.pid
	echo "(PID $!)"
    fi
    if [ "$target" = all -o "$target" = nap ]; then
	echo -n "Starting nap "
	nohup nap --daemon --autorestart -b $napservers --log nap.log >/dev/null &
	echo $! > nap.pid
	echo "(PID $!)"
    fi
    ;;
  stop )
    if [ "$target" = all -o "$target" = gnut ] &&  [ -r gnut.pid ]; then
	pid=`cat gnut.pid`
	echo "Stopping gnut (PID $pid)"
	kill -KILL $pid
	rm gnut.pid
    fi
    if [ "$target" = all -o "$target" = nap ] &&  [ -r nap.pid ]; then
	pid=`cat nap.pid`
	echo "Stopping nap (PID $pid)"
	kill -KILL $pid
	rm nap.pid
    fi
    ;;
 esac
}

do_action $action $target

This shell script illustrates a number of things: first, note the use of the "-s" option to pass an alternative list of server addresses to nap. Second, the script can be used to start and stop not only nap, but also gnut, another neat file sharing client for linux (gnut is a Gnutella client). Third, the script automatically saves the process id so that it knows how to stop the process later.

I invoke this script as follows:

        ./server start nap      (to start or restart nap)
        ./server stop nap       (to stop nap)
        ./server start gnut     (ditto for gnut)
        ./server stop all       (stop them both)

8. Summary of command line options

Usage: nap [options]

Options:
-h, --help         - print this help message
-v, --version      - print version info and exit
-b, --build        - build library of your current mp3s to send to server
-B, --build-only   - build library and exit
-m, --create       - create new account from the information in config file
-r, --reconnect    - keep reconnecting until server connection established
-a, --autorestart  - automatically reconnect when connection to server lost
-q, --daemon       - run without user interface; file sharing only
-t, --notitle      - do not display the title bar (fixes messed-up displays)
-l, --nxterm       - try using a terminal which is compatible with most
                     systems (fixes messed-up displays)
-f fn, --config fn - specifies the config file to use (default $HOME/.napconf)
-x fn, --log fn    - log all transfers to a specific filename
-g fn, --logall fn - log everything to a specific filename
-s sv, --server sv - select a specific server (multiple -s opts possible)
-d n, --debug n    - set debug level
-u str, --user str     - specify Napster username
-p str, --pass str     - specify user's password
-e str, --email str    - specify user's email address
-U dir, --upload dir   - specify upload directory (multiple -U opts possible)
-D dir, --download dir - specify download directory
-P n, --dataport n     - specify local data port to use
-C n, --connection n   - specify connection speed number (see README)
-M n, --maxuploads n   - specify maximum number of simultaneous uploads

9. Summary of nap commands

I did not have time to write something about how each command is used, so for now I only list the command names, as given by /help:

about                alias                aliaslist            announce
ban                  banlist              block                blocklist
break                browse               cban                 cbanlist
chupload             clear                clearalias           clearhandler
clist                clist2               cloak                conf
cunban               ddown                dec                  debug
disconnect           dns                  done                 dup
echo                 eval                 exec                 finger
g                    get                  gusers               handler
handlerlist          help                 hotlist              hup
if                   ignore               ignoreclear          ignorelist   
inc                  irc                  join                 kick
kickall              kill                 lastlog              loadalias   
loadconfig           loadhandler          me                   msg
muzzle               names                news                 noprint
notify               opsay                part                 pchans
pdown                ping                 psocks               pup
query                quit                 rebuild              reconnect
reload               reloadm              results              savealias
saveconfig           savehandler          say                  search
serv                 server               set                  setdataport
setlevel             setlinespeed         setpassword          setuserlevel
sraw                 stop                 sver                 tell
timer                tlist                topic                tquit
unalias              unban                unblock              unhandler
unignore             unmuzzle             unnotify             unset
while                whois                window               wstats