Skip to content

Transferring Files Between WSL and Windows

Transferring Files Between WSL and Windows

This guide provides a step-by-step approach to transferring files between Windows Subsystem for Linux (WSL) and Windows using tools like SCP (Secure Copy). It includes commands for file management and efficient navigation in both environments.


Logging into Zomro VPS using WSL in Ubuntu CLI

To access your Zomro VPS using WSL’s Ubuntu terminal:

  1. Open the Ubuntu terminal via the Windows Start menu.
  2. Use the ssh command to connect to your VPS:

ssh your_username@your_server_ip

Replace your_username with your VPS username and your_server_ip with the server’s IP address.

  1. Enter your VPS password when prompted. After logging in, you can manage your VPS from the Ubuntu CLI.

Locating File Paths in Ubuntu CLI

Navigating and identifying file paths in Ubuntu is essential for transferring files. Use these commands for efficient file management:

1. Present Working Directory (pwd)

Displays the absolute path of the current directory:

pwd

2. List Directory Contents (ls)

Shows files and directories in the current location:

ls

3. Find a File (find)

Searches for a file in the system:

find / -name example.txt

4. Change Directory (cd)

Navigates through directories:

cd /path/to/directory

5. Access Windows Files

WSL allows access to Windows files via /mnt. For example:

cd /mnt/c/Users/YourUsername/Desktop


File Transfer Methods Using SCP

Using SCP (Secure Copy)

The scp command securely copies files between WSL and Windows.

Syntax

scp username@source:/path/to/source/file /path/to/destination/

Example: Copy Files from WSL to Windows

To copy screenshots from a remote VPS to your Windows Desktop:

scp root@45.88.107.136:/root/zomro-selenium-base/screenshots/* "/mnt/c/Users/Harminder Nijjar/Desktop/"

This command transfers all files from the VPS directory to the specified Windows Desktop folder.


Conclusion

Transferring files between WSL and Windows is simple and efficient using commands like scp. Mastering these techniques will streamline your workflow and enhance your productivity across WSL and Windows environments.


Created 2024-11-25, Updated 2024-11-29
Authors: Harminder Singh Nijjar (8)

Comments