Skip to content
Victor Escorcia Castillo edited this page Sep 22, 2018 · 8 revisions

Commands and process that I search every once in a while

ssh-agent running?

if [ $(ps ax | grep [s]sh-agent | wc -l) -gt 0 ] ; then
    echo "ssh-agent is already running"
else
    eval $(ssh-agent -s)
    if [ "$(ssh-add -l)" == "The agent has no identities." ] ; then
        echo "add you key to ssh-agent";
    fi
fi

Credits: SO

Add key to ssh-agent

eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa

Credits: Github

tar

add files not symlinks

Apparently, tar adds symlink-files as symlinks (which is really nice), to archive the file itself use -h.

Credits: SO

track progress

WIP: not test

tar cf - /folder-with-big-files -P | pv -s $(du -sb /folder-with-big-files | awk '{print $1}') | gzip > big-files.tar.gz

Credits: SE

rsync

WIP: nice explanation here

The simplest instantiation, but not the best transfer performance

rsync -a --progress /source/a/ /dest/a

in case you don't wanna preserve ownerships (users, etc.)

rsync -rlptD --progress /source/a/ /dest/a

considerations for exFAT drives

Apparently, exFAT drives are picky. Hopefully, there are workarounds:

rsync -rltD --progress /source/a/ /dest/a

Check this from details

Thanks: Bhautik Joshi

Split

Split large files in chunks of ~5G.

split -b 5G big-filename big-filename.part

To recover the original file just do:

cat big-filename.part* > big-filename

Credits: tecmint

md5

md5sum in Linux

md5 in osx

other unix tricks

WIP: move them from gist to here.