Reverse lines in a file
tac /path/to/file
In vim, you can select the lines you need to reverse and issue :'<,'>!tac
.
Source: https://stackoverflow.com/a/742485/526189
Compare two files and get only the difference
# Using the `diff` tool diff -a --suppress-common-lines -y a.txt b.txt > c.txt # Using the `comm` tool comm -2 -3 <(sort a.txt) <(sort b.txt)
Source: https://stackoverflow.com/questions/4544709.
Prepend data to a file
sed -i -e "1i <your data goes here>" FILE_NAME
Have rsync print timestamps
Use the --out-format
option. For example:
rsync --out-format='%t %f' -avzu ~/myfolder/ user@1.1.1.1:/home/user/myfolder