Categories
Linux

Sync SFTP remote folders via CLI in Linux

There are many utilities for synchronizing folders via SFTP on Linux, but most of them are visual (eg Filezilla). There are not so many good utilities for the command line. For example, there is the sftp utility, but it is not very convenient, you cannot synchronize the whole folder recursively using it. Therefore, here we will look at lftp, which works from the command line and allows you to do a lot of operations using the SFTP protocol.

Categories
Linux Utilities

A simple way to copy emails from one account to another

If you need to copy emails from one mailbox to another, even if they are located on different servers, you can use the imapsync utility. You just need to install and run it in the console with parameters. Naturally, you need to know the passwords for both mailboxes.

Categories
Docker Linux Magento

Fluentbit does not follow the logs

Fluentbit can follow and parse logs and send them to different systems, for example, Newrelic or Elasticsearch. But you may notice, that for some reason it does not follow files or stops follow ones.

Categories
Docker Linux

How to check memory limit inside Docker container

You should know the memory limit of your container (not the whole host) when packing applications there. For example and simplicity, let’s imagine you are creating customized redis, memcached or varnish image and you wish to know available memory when the container starts to set it as the memory limit for your application.

Categories
Linux

Show disk usage ignoring mounts

If you wish to know how much space uses some dir in Linux, you can use du -hs /some-folder. But what if you have a lot of mixed mounts in that folder and you want to know how much exactly this folder consumes at root disk storage?

Categories
Linux

Get count of files in a Linux directory recursively

It is very simple:

for i in */ .*/ ; do 
    echo -n $i": " ; 
    (find "$i" -type f | wc -l) ; 
done