LinuxDevCenter.com
oreilly.comSafari Books Online.Conferences.





Linux in a Nutshell

This directory of Linux commands is from Linux in a Nutshell, 5th Edition.

Click on any of the 687 commands below to get a description and list of available options. All links in the command summaries point to the online version of the book on Safari Bookshelf.

Buy it now, or read it online on Safari Bookshelf.



lftp

lftp [options] [url]

File transfer program with more features than ftp. The lftp command allows FTP and HTTP protocol transfers, plus other protocols including FISH (SSH based), FTPS, and HTTPS. It uses a shell-like command interface and offers job control in a manner similar to bash. lftp has two important reliability features: it resumes failed or interrupted transactions, and it goes into the background automatically if it is quit in the middle of a file transfer.

Options

-d

Run in debug mode.

-e commands

Start, execute the specified commands, and then wait for further instructions.

-p portnumber

Connect to the specified port number.

-u user[,pass]

Login to the server with the username (and, optionally, password) you specify.

-f scriptfile

Run the specified script file of lftp commands, then exit.

-c commands

Run the commands specified, then exit.

Commands

The lftp commands are similar to those for ftp. However, lftp lacks or uses different mechanisms for a number of commands, including $, ascii, binary, case, and macdef. It also adds the following:

alias [name [value] ]

Create an alias for a command. For example, you could set dir to be an alias for ls -lf.

anon

Set the username to anonymous. This is the default username.

at

Execute a command at a given time, as with the at command in an actual shell.

bookmark [arguments]

The lftp bookmark command used with the following arguments will add, delete, edit, import, or list bookmarks, respectively:

add name url

del name

edit

import type

list

cache

Work with the local memory cache. This command should be followed by the arguments:

stat

Display the status for the cache.

on|off

Turn caching on or off.

flush

Empty the cache.

size n

Set the maximum size for the cache. Setting it to -1 means unlimited.

expire nu

Set the cache to expire after n units of time. You can set the unit to seconds (s), minutes (m), hours (h), or days (d). For example, for a cache that expires after an hour, use the syntax cache expire 1h.

close

Where the ftp version of this command just stops all sessions, this version closes idle connections with the current server. If you have connections to multiple servers and wish to close all idle connections, add the -a flag.

command cmd args

Execute the specified lftp command, with the specified arguments, ignoring any aliases created with the alias command.

mirror [options] [remotedir [localdir] ]

Copy a directory exactly. The mirror command accepts the following arguments:

-c, --continue

If mirroring was interrupted, resume it.

-e, --delete

Delete local files that are not present at the remote site.

-s, --allow-suid

Keep the suid/sgid bits as set on the remote site.

-n, --only-newer

Get only those files from the remote site that have more recent dates than the files on the local system. Cannot be used with the -c argument.

-r, --no-recursion

Do not get any subdirectories.

--no-umask

Do not use umask when getting file modes. See umask for more information about file modes.

-R, --reverse

Mirror files from the local system to the remote system. With this argument, make sure that you specify the local directory first and the remote directory second. If you do not specify both directories, the second is assumed to be the same as the first. If you choose neither, the operation occurs in the current working directories.

-L, --dereference

When mirroring a link, download the file the link points to rather than just the link.

-N, --newer-than filename

Get all files newer than the file filename.

-P, --parallel[=n]

Download n files in parallel.

-i, --include regex

Get only the files whose names match the regular expression regex. See grep for more information about regular expressions.

-x, --exclude regex

Do not get the files whose names match regex. See grep for more information about regular expressions.

-t, time-prec n

Set the precision of time measurement for file comparison; if file dates differ by amounts less than n, they are assumed to be the same. You can specify n in seconds (s), minutes (m), hours (h), or days (d).

-T, --loose-time-prec n

Set the precision for loose time comparisons. You can specify n in seconds (s), minutes (m), hours (h), or days (d).

-v, --verbose=n

Set the verbose level. You can set n from 0 (no output) to 3 (full output) using a number or by repeating the v. For example, -vvv is level 3 verbose mode.

--use-cache

Use the cache to get directory listings.

--remove-source-files

Move, rather than copy, files when mirroring.

set [setting | value]

Set one of the preference variables for lftp. If run without arguments, list the variables that have been changed; without arguments and with the -a or -d flags, list all values or default values, respectively.

See the lftp manpage for a complete list of preference variables that can be set.

wait [n | all]

Wait for the job or jobs you specify by number, or all jobs, to terminate.