Two Useful Commands for Your Linux Server

Want to back up files and documents on your laptop or desktop PC to a server? Assuming both machines run Linux, you can do that with just one command.

First, install SSH server on the server and rsync on your machine.

Open then the terminal on your machine and run the following command:


rsync --progress -avhe ssh --delete /path/to/local/dir user@host:/path/to/remote/dir

Replace user with the name of the existing user on the server and host with the IP address of the server.

Using your server to serve files also requires only one command.

Start with installing the sshfs package on your machine.


sshfs user@host:/path/to/dir /mountpoint -o idmap=user -o uid=1000 -o gid=1000

Replace user with the name of the existing user on the server and host with the IP address of the server

Once the directory has been mounted, you can use the files in it as they were on your own machine. To unmount the directory, use the fusermount command as follows:


fusermount -u /mountpoint


Leave a comment

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.