Photo by David Travis on Unsplash

Check the newline code of the opened file

:set fileformat?
:se ff?

Visualization of line feed code

Display line feed code

:se list

Hide newline code

:se nolist

Specify line feed code to open


:edit ++fileformat=unix


:e ++ff=dos


:e ++ff=mac

Specify line feed code

:se ff=dos
:se ff=mac
:se ff=unix

Remove line feed code


Reopen the file with the specified character code

Reopen the file in UTF-8

#Option 1
:e ++enc=utf-8
#Option 2
:edit ++enc=utf-8

Save file with specified character code

Save the file in UTF-8

#Option 1
:set fileencoding=utf-8
#Option 2
:se fenc=utf-8

Check current encoding

Vim encoding

:se enc?

File encoding

:se fenc?



Compare files under the specified directory and display only file names

diff -qr /home/vagrant/example1 /home/vagrant/example2

Compare ignoring newline spaces and newline codes

cd /home/vagrant/
diff -Bw --strip-trailing-cr example1.txt example2.txt

Display only the differences side by side

cd /home/vagrant/
diff -y example1.txt example2.txt | grep "|\|<"

Side-by-side comparison (vimdiff)

⚠️ Vim must be installed

#Option 1
cd /home/vagrant/
vimdiff example1.txt example2.txt
#Option 2
cd /home/vagrant/
vim -d example1.txt example2.txt

Diff Options

Compare by directory

diff -r /home/vagrant/example1 /home/vagrant/example2

Show file name only

diff -q /home/vagrant/example1 /home/vagrant/example2

Ignore newlines

diff -B…




We want to copy only a specific directory of the host into the container.


If you want to copy only a specific directory instead of mounting it to the container, use the following command.

tar cf - /path/on/host | lxc exec container -- tar xvf - -C /path/on/target

It can be omitted if it is okay to expand to the current directory in the container with the same directory name as the source -C

tar cf - /path/on/host | lxc exec container -- tar xvf -





DevOps Consultant. I’m strongly focused on automation, security, and reliability.