MEWBIES@:  Facebook  Twitter  G+  YouTube  DeviantArt  Forum  Wall
 SHARE:
    ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
   ██                                                                       ██
  █▌                -   LFTP - FTP CLIENT - NIX, MAC, WIN  -                 █▌
 █▌                                                                           █▌
 █                                                                            ▐▌
    LFTP
 █                                                                            ▐▌
 █ LFTP is a command line FTP client by Alexander Lukyanov. It is well loved  ▐▌
 █ by many including myself. LFTP has great support, with a quiet, but active ▐▌
 █ mailing list (send subscribe lftp in letter body to majordomo [at]         ▐▌
 █ uniyar.ac.ru to subscribe (replace ' [at] ' with: @). LFTP is actively     ▐▌
 █ updated, very easy to use, supports mirroring, reverse mirroring,          ▐▌
 █ transfers in the background while browsing the site, and FTPS, HTTP,       ▐▌
 █ HTTPS, HFTP, FISH, and SFTP. There are plenty of 'how tos' on the web.     ▐▌
 █ This tutorial is yet another to cover the basics I use.                    ▐▌
 █                                                                            ▐▌
 █                                                                            ▐▌
 █ INSTALL LFTP                                                               ▐▌
 █ HELP FILES                                                                 ▐▌
 █                                                                            ▐▌
 █ LFTP CONNECT TO A SITE                                                     ▐▌
 █ SSL-FORCE ERROR                                                            ▐▌
 █ VIEW SERVER'S WELCOME MESSAGE AND SERVER'S REPLIES                         ▐▌
 █ ISSUE SHELL COMMANDS WHILE IN LFTP                                         ▐▌
 █ BOOKMARKS                                                                  ▐▌
 █ UPLOAD, DOWNLOAD                                                           ▐▌
 █ TO QUEUE ITEMS TO DOWNLOAD                                                 ▐▌
 █ TO STOP, RESUME OR KILL A TRANSFER                                         ▐▌
 █                                                                            ▐▌
 █ CONFIGURATION                                                              ▐▌
 █   SKIP LIST / EXCLUDE                                                      ▐▌
 █   REGEX NOTES                                                              ▐▌
 █   SET THE ORDER OF FILES TO BE TRANSFERED                                  ▐▌
 █                                                                            ▐▌
 █ CUSTOMIZE LFTP PROMPT LINE SYTLE                                           ▐▌
 █   PROMPT LINE CHARACTERS AREN'T SHOWING CORRECTLY                          ▐▌
 █ CUSTOMIZE LFTP LISTING COLORS OF DIRECTORIES & FILES                       ▐▌
 █                                                                            ▐▌
 █ DISABLE LFTP LOGS & HISTORY                                                ▐▌
 █                                                                            ▐▌
 █ MISC NOTES & TIPS                                                          ▐▌
 █ MY QUICK CMD REFERENCE                                                     ▐▌
 █                                                                            ▐▌
 █                          ___________..___________                          ▐▌
 █                                                                            ▐▌
 █ INSTALL LFTP:                                                              ▐▌
 █ `````````````                                                              ▐▌
 █ Install LFTP via package manager including openssh and openssl, to support ▐▌
 █ HTTPS and FTPS..                                                           ▐▌
 █ BUT IF you want to be able to connect to FTP servers that use SSLv3 and    ▐▌
 █ TLSv1.2 it is better to compile it yourself (easy) with OpenSSL to ensure  ▐▌
 █ you can connect. You'll then also have the latest stable LFTP version. To  ▐▌
 █ do this for Linux view HERE. To know if your LFTP was compiled with        ▐▌
 █ OpenSSL also view HERE.                                                    ▐▌
 █                                                                            ▐▌
 █ Linux users To install via package manager:                                ▐▌
 █ su                                                                         ▐▌
 █ aptitude update                                                            ▐▌
 █ aptitude install openssh openssl lftp                                      ▐▌
 █ exit                                                                       ▐▌
 █                                                                            ▐▌
 █ - Window users use Cygwin terminal to use lftp; run setup.exe              ▐▌
 █   then look for lftp under the net section.                                ▐▌
 █ - Mac users after installing openssh and openssl, to install lftp:         ▐▌
 █   fink install lftp                                                        ▐▌
 █                                                                            ▐▌
 █ HELP:                                                                      ▐▌
 █ Normal commands: lftp -h or man lftp                                       ▐▌
 █ Search the LFTP mailing list.                                              ▐▌
 █ Wiki article here is a must read.                                          ▐▌
 █                                                                            ▐▌
 █                          ___________..___________                          ▐▌
 █                                                                            ▐▌
 █ LFTP CONNECT TO A SITE:                                                    ▐▌
 █ ```````````````````````                                                    ▐▌
 █ To connect to a site the input would be:                                   ▐▌
 █ open -u name,password -p port site                                         ▐▌
 █ For this tutorial we are going to use Adobe's FTP site.                    ▐▌
 █ If you want to use your own local FTP server add yourself first to your    ▐▌
 █ FTP, example:                                                              ▐▌
 █ site addip admin mewbies@127.0.0.1                                         ▐▌
 █ (change mewbies to shell's user name)                                      ▐▌
 █                                                                            ▐▌
 █ Start LFTP:                                                                ▐▌
 █ lftp                                                                       ▐▌
 █ open -u anonymous,ftpuser@adobe.com -p 21 ftp.adobe.com                    ▐▌
 █ ('ftpuser@adobe.com' - they require the password to be an e-mail)          ▐▌
 █ Or if using your own FTP:                                                  ▐▌
 █ open -u admin,MyPassword -p 34567 localhost                                ▐▌
 █                                                                            ▐▌
 █ Now we aren't actually connected yet. LFTP has only resolved the host      ▐▌
 █ name:                                                                      ▐▌
 █ ---- Resolving host address...                                             ▐▌
 █ ---- 1 address found: 192.150.16.26                                        ▐▌
 █                                                                            ▐▌
 █ LFTP is awaiting our first command for the server then it will connect and ▐▌
 █ perform the command. So lets list the directories 'ls', at the same time   ▐▌
 █ it will connect:                                                           ▐▌
 █ ls                                                                         ▐▌
 █ Output:                                                                    ▐▌
 █ ---- Connecting to ftp.adobe.com (192.150.16.26) port 21                   ▐▌
 █ [snip]                                                                     ▐▌
 █ ---> FEAT                                                                  ▐▌
 █ [snip]                                                                     ▐▌
 █ ---> QUIT                                                                  ▐▌
 █ ---- Closing control socket                                                ▐▌
 █ ls: Login failed: ftp:ssl-force is set and server does not support or      ▐▌
 █ allow SSL                                                                  ▐▌
 █                                                                            ▐▌
 █                          ___________..___________                          ▐▌
 █                                                                            ▐▌
 █ SSL-FORCE ERROR:                                                           ▐▌
 █ ````````````````                                                           ▐▌
 █ If you received the above error this is either because                     ▐▌
 █ - LFTP client is setup to only use SSL (mine is).                          ▐▌
 █ - And the site doesn't support SSL.                                        ▐▌
 █ - Or the site is badly configured telling LFTP that it does.               ▐▌
 █ To turn it off for this site, this session only:                           ▐▌
 █ set ftp:ssl-force/ftp.adobe.com off                                        ▐▌
 █ Then try again: ls                                                         ▐▌
 █                                                                            ▐▌
 █ If this error happens on a site that you know supports SSL; turn off FEAT: ▐▌
 █ set ftp:use-feat/ftp.adobe.com off                                         ▐▌
 █                                                                            ▐▌
 █ To connect to multiple FTPs you open a site as normal then switch between  ▐▌
 █ the connections using your Alt key and pressing the corresponding number,  ▐▌
 █ 0 - 9.                                                                     ▐▌
 █                                                                            ▐▌
 █ LFTP default uses passive. If you need active for a particular session:    ▐▌
 █ set ftp:passive-mode off                                                   ▐▌
 █                                                                            ▐▌
 █ To disconnect from the site: close                                         ▐▌
 █ To disconnect and exit LFTP: bye, exit or quit                             ▐▌
 █                                                                            ▐▌
 █                          ___________..___________                          ▐▌
 █                                                                            ▐▌
 █ VIEW SERVER'S WELCOME MESSAGE AND SERVER'S REPLIES:                        ▐▌
 █ ```````````````````````````````````````````````````                        ▐▌
 █ Type in exit if you still have LFTP open.                                  ▐▌
 █ debug 3 mode using the -d so that we may view server's welcome message and ▐▌
 █ replies:                                                                   ▐▌
 █ lftp -d                                                                    ▐▌
 █ set ftp:ssl-force/ftp.adobe.com off                                        ▐▌
 █ open -u anonymous,ftpuser@adobe.com -p 21 ftp.adobe.com                    ▐▌
 █ ls                                                                         ▐▌
 █                                                                            ▐▌
 █                          ___________..___________                          ▐▌
 █                                                                            ▐▌
 █ ISSUE SHELL COMMANDS WHILE IN LFTP:                                        ▐▌
 █ ```````````````````````````````````                                        ▐▌
 █ To issue commands to your own local shell for some just precede the cmd    ▐▌
 █ with:!                                                                     ▐▌
 █ For example: !ls                                                           ▐▌
 █ !mkdir downloads                                                           ▐▌
 █ To change to a local directory:                                            ▐▌
 █ lcd downloads                                                              ▐▌
 █ Output: lcd ok, local cwd=/home/mewbies/downloads                          ▐▌
 █                                                                            ▐▌
 █                          ___________..___________                          ▐▌
 █                                                                            ▐▌
 █ BOOKMARKS:                                                                 ▐▌
 █ ``````````                                                                 ▐▌
 █ To bookmark the site, it would include our current working path:           ▐▌
 █ bookmark add adobe                                                         ▐▌
 █ To view all of our bookmarks:                                              ▐▌
 █ bookmark list                                                              ▐▌
 █ adobe   ftp://anonymous:XXXX@ftp.adobe.com:21/                             ▐▌
 █ Note password is X'd out, but the file is stored in plain text. So don't   ▐▌
 █ bookmark sensitive sites if your shell isn't for your eyes only.           ▐▌
 █ You can at any time while in LFTP edit a bookmark: bookmark edit           ▐▌
 █ To exit bookmark, if it opened in vim: :quit                               ▐▌
 █ You can at any time open a bookmark by using its name, for example:        ▐▌
 █ open adobe                                                                 ▐▌
 █ To save a path on a server in bookmark just cd to that path, for example:  ▐▌
 █ cd /pub/adobe/acrobat/unix                                                 ▐▌
 █ bookmark add adobe2                                                        ▐▌
 █ bookmark list                                                              ▐▌
 █ To view the commands that have been issued: history                        ▐▌
 █                                                                            ▐▌
 █ UPLOAD, DOWNLOAD:                                                          ▐▌
 █ `````````````````                                                          ▐▌
 █ TO UPLOAD:                                                                 ▐▌
 █ Directories: mirror -R Directory/                                          ▐▌
 █ Files:       put file.name                                                 ▐▌
 █                                                                            ▐▌
 █                          ___________..___________                          ▐▌
 █                                                                            ▐▌
 █ TO QUEUE ITEMS TO DOWNLOAD:                                                ▐▌
 █ ```````````````````````````                                                ▐▌
 █ Directories: queue mirror "directory name"                                 ▐▌
 █ Files:       queue pget "my file"                                          ▐▌
 █ You only need the quotes if the name has spaces or special characters in   ▐▌
 █ the name.                                                                  ▐▌
 █ To mirror just one file in x folder read here.                             ▐▌
 █                                                                            ▐▌
 █ Lets queue a file to download:                                             ▐▌
 █ ls                                                                         ▐▌
 █ To prevent queue from auto transferring while you add to it:               ▐▌
 █ queue stop                                                                 ▐▌
 █ queue pget license.txt                                                     ▐▌
 █ Lets queue a directory to download:                                        ▐▌
 █ cd /pub/adobe/acrobat/unix                                                 ▐▌
 █ ls                                                                         ▐▌
 █ ls 3.x                                                                     ▐▌
 █ mmm sounds good pizza.tar.Z!                                               ▐▌
 █ queue mirror "3.x"                                                         ▐▌
 █ You can add to the queue as many more files and directories as you want.   ▐▌
 █ To view your queue: queue                                                  ▐▌
 █ To view jobs in waiting and your queue: jobs                               ▐▌
 █ Or jobs -v for more info while files are in transit.                       ▐▌
 █ To remove an item from the queue, use the number it is on the queue;       ▐▌
 █ replied on queue or jobs cmd. For example to remove license.txt from the   ▐▌
 █ queue: queue -d 1                                                          ▐▌
 █ If you want to delete the entire queue:                                    ▐▌
 █ queue -d                                                                   ▐▌
 █ Then to start the download, it will download to your working shell         ▐▌
 █ directory:                                                                 ▐▌
 █ queue start                                                                ▐▌
 █ exit                                                                       ▐▌
 █ You can enter exit even if your transfer isn't completed. It will finish   ▐▌
 █ the transfer first in the background (nohup), then close it self.          ▐▌
 █                                                                            ▐▌
 █ Don't forget to clean up if you downloaded the two files above:            ▐▌
 █ rm license.txt pizza.tar.Z                                                 ▐▌
 █                                                                            ▐▌
 █                          ___________..___________                          ▐▌
 █                                                                            ▐▌
 █ TO STOP, RESUME OR KILL A TRANSFER:                                        ▐▌
 █ ```````````````````````````````````                                        ▐▌
 █ To cancel a transfer: Ctrl+c                                               ▐▌
 █ To resume a download use the -c (--continue) switch, for example:          ▐▌
 █ mirror -c "directory name"                                                 ▐▌
 █ pget -c "my file"                                                          ▐▌
 █ To kill and delete an active transfer: kill                                ▐▌
 █ If you have multiple transfers simultaneously, use the number it is on the ▐▌
 █ jobs; replied on jobs cmd. For example: kill 1                             ▐▌
 █ To kill and delete all transfers: kill all                                 ▐▌
 █                                                                            ▐▌
 █                          ___________..___________                          ▐▌
 █                                                                            ▐▌
 █ CONFIGURATION:                                                             ▐▌
 █ ``````````````                                                             ▐▌
 █ "On startup, LFTP executes /etc/lftp.conf and then ~/.lftprc and           ▐▌
 █ ~/.lftp/rc."                                                               ▐▌
 █ The first time starting LFTP it will create ~/.lftprc                      ▐▌
 █ If it didn't; not to worry.                                                ▐▌
 █ At any time you can create that file to put in your own settings by doing: ▐▌
 █ pico .lftprc                                                               ▐▌
 █ What you place in there will override any other settings.                  ▐▌
 █                                                                            ▐▌
 █                          ___________..___________                          ▐▌
 █                                                                            ▐▌
 █                                                                            ▐▌
 █ SKIP LIST / EXCLUDE:                                                       ▐▌
 █ ````````````````````                                                       ▐▌
 █ To view all the default system wide configuration:                         ▐▌
 █ lftp                                                                       ▐▌
 █ set -a                                                                     ▐▌
 █ Default is: mirror:exclude-regex "(^|/)(\\.in\\.|\\.nfs)"                  ▐▌
 █ If you want to always exclude, aka skip list, certain files and            ▐▌
 █ directories from being transfered you need to add them either to your own  ▐▌
 █ ~/.lftprc                                                                  ▐▌
 █ Create this file if it doesn't exist for user specific setting:            ▐▌
 █ pico ~/.lftprc                                                             ▐▌
 █ For example if you want to skip file_id.diz, *.nfo, and any directory with ▐▌
 █ [ add this line after '#set ftp:sync-mode off':                            ▐▌
 █ set mirror:exclude-regex ^.*file_id\.diz.*$\|^.*\.nfo.*$\|^.*\[.*$         ▐▌
 █ Or you could just declare the extension .diz:                              ▐▌
 █ set mirror:exclude-regex ^.*\.diz.*$\|^.*\.nfo.*$\|^.*\[.*$                ▐▌
 █ Or if you didn't want to exclude every directory that name begins with a   ▐▌
 █ '[' but only directories named [COMPLETE] for example then it would be:    ▐▌
 █ set mirror:exclude-regex ^.*\.diz.*$\|^.*\.nfo.*$\|^.*\[COMPLETE\]$        ▐▌
 █                                                                            ▐▌
 █ To view your setting:                                                      ▐▌
 █ lftp                                                                       ▐▌
 █ set -a                                                                     ▐▌
 █ Not to worry that the output of the line you added will contain extra \:   ▐▌
 █ set mirror:exclude-regex "^.*\\.diz.*$|^.*\\.nfo.*$|^.*\\[.*$"             ▐▌
 █ quit                                                                       ▐▌
 █                                                                            ▐▌
 █ Or to set it system wide; for all users:                                   ▐▌
 █ su                                                                         ▐▌
 █ pico /etc/lftp.conf                                                        ▐▌
 █ Has this: set mirror:exclude-regex "(^|/)(\\.in\\.|\\.nfs)"                ▐▌
 █ Change to: set mirror:exclude-regex ^.*\.diz.*$\|^.*\.nfo.*$\|^.*\[.*$     ▐▌
 █ exit                                                                       ▐▌
 █                                                                            ▐▌
 █                          ___________..___________                          ▐▌
 █                                                                            ▐▌
 █ REGEX NOTES:                                                               ▐▌
 █ ````````````                                                               ▐▌
 █ From this (archived) article here are a few of the notes to understand     ▐▌
 █ what the regex lines above mean:                                           ▐▌
 █ ^  = start of line/expression                                              ▐▌
 █ $  = end of line/expression                                                ▐▌
 █ *  = match any character including none                                    ▐▌
 █ +  = match one or more character                                           ▐▌
 █ .  = exactly 1 of any character (like a wild card)                         ▐▌
 █ .* = any number of any characters including 0                              ▐▌
 █ <> = exact match what it contains                                          ▐▌
 █ Alphanumeric character : Aa-Zz 0-9                                         ▐▌
 █ Metacharacters: \ | ( ) [ { ^ $ * + ? . < >                                ▐▌
 █ use \ in front of a special character to specify it like [                 ▐▌
 █ which will convert the metacharater, [ , into a literal character.         ▐▌
 █ For example: \[ = the character [                                          ▐▌
 █ For example: \. = the character .                                          ▐▌
 █                                                                            ▐▌
 █                          ___________..___________                          ▐▌
 █                                                                            ▐▌
 █ SET THE ORDER OF FILES TO BE TRANSFERED:                                   ▐▌
 █ ````````````````````````````````````````                                   ▐▌
 █ On some FTPs it is important that certain files are transfered first       ▐▌
 █ before others. For example on glFTPD a .sfv file must be uploaded before   ▐▌
 █ the rars so that the server may verify each rar file.                      ▐▌
 █ To set the order of transfer, source here:                                 ▐▌
 █ pico ~/.lftprc                                                             ▐▌
 █ (Or system wide: pico /etc/lftp.conf)                                      ▐▌
 █ add this line for example, directory names add a slash:                    ▐▌
 █ set mirror:order "*.sfv *.nfo Sample/"                                     ▐▌
 █                                                                            ▐▌
 █                          ___________..___________                          ▐▌
 █                                                                            ▐▌
 █ CUSTOMIZE LFTP PROMPT LINE SYTLE:                                          ▐▌
 █ `````````````````````````````````                                          ▐▌
 █ You can change the sytle of LFTP's prompt line easily. For example         ▐▌
 █ connecting to Adobe as above the default prompt line would look like this: ▐▌
 █ lftp anonymous@ftp.adobe.com:/pub>                                         ▐▌
 █ Included in .lftprc is a blue-gray-white color theme. To use it first      ▐▌
 █ increase the width of your terminal window so that you may view these long ▐▌
 █ lines unwrapped or not turnicated; line ends with a $                      ▐▌
 █ pico ~/.lftprc  (or system wide: pico /etc/lftp.conf)                      ▐▌
 █ It has:                                                                    ▐▌
 █ set prompt "lftp \S\? \u\@\h:\w> "                                         ▐▌
 █ ## some may prefer colors (contributed by Matthew <mwormald@optusn...      ▐▌
 █ #set prompt "\[\e[1;30m\][\[\e[0;34m\]f\[\e[1m\]t\[\e[37m\]p\[\e[3...      ▐▌
 █                                                                            ▐▌
 █ Change to (comment out first line, uncomment third line):                  ▐▌
 █ #set prompt "lftp \S\? \u\@\h:\w> "                                        ▐▌
 █ ## some may prefer colors (contributed by Matthew <mwormald@optusn...      ▐▌
 █ set prompt "\[\e[1;30m\][\[\e[0;34m\]f\[\e[1m\]t\[\e[37m\]p\[\e[3...       ▐▌
 █                                                                            ▐▌
 █ Save changes, launch your LFTP again. It will now look like this:          ▐▌
 █ [ftp] anonymous@ftp.adobe.com:/pub>                                        ▐▌
 █ On my monitor the blues against black are very hard to view:               ▐▌
 █ [ftp] anonymous@ftp.adobe.com:/pub>                                        ▐▌
 █                                                                            ▐▌
 █ This is my LFTP prompt line, be sure you have your terminal width wide     ▐▌
 █ enough so that it is pasted in as one line or it won't work:               ▐▌
set prompt "\[\e[0;32m\]┌┼───┤\[\e[1;33m\] [lftp] \[\e[0;36m\]\u\[\e[0;33m\]\@\[\e[0;36m\]\h \[\e[0;32m\]├───┤\[\e[0;33m\]\w\[\e[0;32m\]├───\n└┼─\[\e[1;33m\]$\[\e[0;32m\]─┤► :\[\e[0m\] "
█ Which will produce this: ▐▌ █ ┌┼───┤ [lftp] anonymous@ftp.adobe.com ├───┤/pub├─── ▐▌ █ └┼─$─┤► : ▐▌ █ ▐▌ █ Test it, you can copy paste the whole chunk in (if you set the bookmark): ▐▌ lftp -d set ftp:ssl-force/ftp.adobe.com off open adobe cd pub █ ▐▌ █ exit ▐▌ █ ▐▌ █ Some notes about the codes above to help create your own: ▐▌ █ To understand and select the colors codes in the prompt line; view here. ▐▌ █ \u is the user's name (anonymous) ▐▌ █ @ is @ ▐▌ █ \h is the host (ftp.adobe.com) ▐▌ █ \w is the working directory (/pub) ▐▌ █ $ is $ ▐▌ █ : is : ▐▌ █ \n is start a new line ▐▌ █ 0;32m is the color code for ;green ▐▌ █ 1;33m is the color code for light;yellow ▐▌ █ ▐▌ █ My 'same' prompt line broken into parts to better understand (me thinks): ▐▌ █ "\[\e[0;32m\]┌┼───┤ { design is ;green ▐▌ █ \[\e[1;33m\] [lftp] { [lftp] is light;yellow ▐▌ █ \[\e[0;36m\]\u { user name is ;cyan ▐▌ █ \[\e[0;33m\]\@ { @ is ;yellow ▐▌ █ \[\e[0;36m\]\h { host is ;cyan ▐▌ █ \[\e[0;32m\]├───┤ { design is ;green ▐▌ █ \[\e[0;33m\]\w { working directory ;yellow ▐▌ █ \[\e[0;32m\]├─── { design is ;green ▐▌ █ \n└┼─ { new line \n, design, no color change ▐▌ █ \[\e[1;33m\]$ { $ is light;yellow ▐▌ █ \[\e[0;32m\]─┤► : { design & : are ;green ▐▌ █ \[\e[0m\] " { closing tag leaving a space & 0m prevents terminal's ▐▌ █ output color change. You could set a color here so ▐▌ █ using LFTP has a different color output. ▐▌ █ ▐▌ █ ___________..___________ ▐▌ █ ▐▌ █ PROMPT LINE CHARACTERS AREN'T SHOWING CORRECTLY?: ┌┼ ► etc ▐▌ █ ````````````````````````````````````````````````` ▐▌ █ If you used some special characters, like above, in your prompt line and ▐▌ █ the characters aren't showing correctly, try this; create this file: ▐▌ █ cd ~ && pico .utf8 ▐▌ █ Paste this in and save changes: ▐▌ export LANG=en_US.UTF-8 export LESSCHARSET=utf-8 export PERL_UTF8_LOCALE=1 PERL_UNICODE=AS █ ▐▌ █ Then: ▐▌ █ pico .bashrc ▐▌ █ Add this towards the end of that file, before any 'PS1=' lines you have: ▐▌ █ . ~/.utf8 ▐▌ █ ▐▌ █ You might need to logout/in to view the changes, launch your LFTP again. ▐▌ █ ▐▌ █ ___________..___________ ▐▌ █ ▐▌ █ CUSTOMIZE LFTP LISTING COLORS OF DIRECTORIES & FILES: ▐▌ █ ````````````````````````````````````````````````````` ▐▌ █ LFTP displays the files in the colors set in /etc/lftp.conf or ▐▌ █ ~/.lftprc or your own LS_COLORS in ~/.bash_profile or ~/.bashrc . ▐▌ █ ▐▌ █ To customize your own LFTP ls colors enter the 'set color:dir-colors' ▐▌ █ followed by the code while in LFTP, for that session only to test the ▐▌ █ results. ▐▌ █ ▐▌ █ To produce the directory color listing on the image at the top of this ▐▌ █ article, for this session only: ▐▌ █ lftp ▐▌ █ Connect to site. (open -u anonymous,ftpuser@adobe.com -p 21 ftp.adobe.com) ▐▌ █ ls ▐▌ set color:dir-colors "rs=0:di=01;36:fi=01;32:ln=01;31:*.txt=01;35:*.html=00;35:"ls ▐▌ █ ▐▌ █ You can adjust the colors, file types, etc and paste it again to view ▐▌ █ changes; ls. ▐▌ █ To make it permanent put in in your ~/.lftprc. ▐▌ █ You can also add in: set color:use-color true ▐▌ █ Help file: man dir_colors (online here) ▐▌ █ (Or to use for your entire shell when you perform ls: ▐▌ █ alias ls='ls --color' ▐▌ █ LS_COLORS='di=01;36:fi=01;32:ln=01;31:*.txt=01;35:*.html=00;35' ▐▌ █ export LS_COLORS ▐▌ █ To view your LS_COLORS: echo $LS_COLORS) ▐▌ █ ▐▌ █ Here are some ls color:dir-colors examples to use with LFTP. ▐▌ █ To explain a bit about the codes in color:dir-colors: ▐▌ █ '*.html=00;35:': Files with the extension .html are to be (=) colored ▐▌ █ '00;35' ('light;magenta'). ▐▌ █ View here for a visual of the color codes and explanation of the ▐▌ █ initials (di, fi, etc.). ▐▌ █ ▐▌ █ Short summary if you don't want to leave this page for colors and format: ▐▌ █ Formats: ▐▌ █ 00=None 01=Light/Bold 04=Underline 05=Blink 07=Inverse 08=Conceal ▐▌ █ Colors: ▐▌ █ 30=Black 31=Red 32=Green 33=Yellow 34=Blue 35=Magenta 36=Cyan 37=Gray ▐▌ █ So 00;32 is Green. 01;32 is Light Green. ▐▌ █ Background colors: ▐▌ █ 40=Black 41=Red 42=Green 43=Yellow 44=Blue 45=Magenta 46=Cyan 47=Gray ▐▌ █ (Windows terminal color codes here.) ▐▌ █ ▐▌ █ You can add/remove any file extension you like just separate each with a ▐▌ █ colon ':'. ▐▌ █ ▐▌ █ NOTES: ▐▌ █ 1. When connecting to SFTP, i.e. lftp sftp://mewbie@123.45.67.890:21 to ▐▌ █ list files with color instead of using ls use cls. ▐▌ █ cls --sort=date (cls -D) ▐▌ █ cls -1 --date --sort=date ▐▌ █ rels replace with: recls ▐▌ █ recls --sort=date (recls -D) ▐▌ █ etc. ▐▌ █ ▐▌ █ 2. As per my image only the symbolic link is colorized; I don't know ▐▌ █ how to colorize the file it is pointing to. Please post if you know how :).▐▌ █ ▐▌ █ ___________..___________ ▐▌ █ ▐▌ █ DISABLE LFTP LOGS & HISTORY: ▐▌ █ ```````````````````````````` ▐▌ █ Read here. ▐▌ █ ▐▌ █ ___________..___________ ▐▌ █ ▐▌ █ MISC NOTES & TIPS: ▐▌ █ `````````````````` ▐▌ █ - A good article of the usage of lftp here, with many variables for the ▐▌ █ configuration, and another here. ▐▌ █ - I like to use in screen so I can toggle back and forth as needed: ▐▌ █ screen lftp -d ▐▌ █ To switch back to your shell (detach from screen) Ctrl + a, then d. ▐▌ █ To resume your screen: screen -r ▐▌ █ - Tab key can auto complete file and dir names and cmds. ▐▌ █ - Use up and down arrow keys to cycle previously used commands. ▐▌ █ - You can FXP with LFTP (transfer from one server to another) but I ▐▌ █ haven't used LFTP for this before. If you love a dual pane interface ▐▌ █ check out pftp-shit; read here and here. ▐▌ █ ▐▌ █ ___________..___________ ▐▌ █ ▐▌ █ MY QUICK CMD REFERENCE: ▐▌ █ ``````````````````````` ▐▌ █ lftp -u Name,Password -p 34567 localhost ▐▌ █ or -d show server msg: ▐▌ █ lftp -d ▐▌ █ Adobe requires an e-mail address for password (ftpuser@adobe.com): ▐▌ █ open -u anonymous,ftpuser@adobe.com -p 21 ftp.adobe.com ▐▌ █ ls ▐▌ █ Output: ls: Login failed: ▐▌ █ ftp:ssl-force is set and server does not support or allow SSL ▐▌ █ set ftp:ssl-force/ftp.adobe.com off ▐▌ █ ls ▐▌ █ bookmark add adobe ▐▌ █ bookmark list ▐▌ █ queue stop ▐▌ █ File: queue pget license.txt ▐▌ █ Dir: queue mirror "3.x" ▐▌ █ jobs ▐▌ █ queue start ▐▌ █ exit ▐▌ █ ▐▌ █ //---------------------------------------------------------------------- ▐▌ █ ▐▌ █ If you find mistakes, have suggestions, and or questions please post at ▐▌ █ mewbies forum HERE - thank you. ▐▌ █ ▐▌ █ Last update on 12 Mar '14 ▐▌ █ ▐▌ █▌ █▌ █▌ - mewbies.com - █▌ █▌ █▌ ██▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄██