Open windows directory from linux

How to share files between a Linux and Windows computer

The easiest and most reliable way to share files between a Linux and Windows computer on the same local area network is to use the Samba file sharing protocol. All modern versions of Windows come with Samba installed, and Samba is installed by default on most distributions of Linux.

Create a shared folder on Windows

First, create a shared folder on your Windows machine.

  1. Open the Control Panel.
  2. Go to Network and Sharing Options.
  3. Go to Change Advanced Sharing Settings.
  4. Select Turn on Network Discovery and Turn on File and Print Sharing.

Now, create a new folder to share or choose an existing folder that you’d like to share.

  1. Right-click the folder and select Properties.
  2. Go to the Sharing tab.
  3. Above the Share button is the network name of the share you are creating. It should look like \\YOURCOMPUTERNAME\Users\YourUserName\ShareFolderName. Make a note of this network name to use later on your Linux machine.
  4. Click Share.

Access a Windows shared folder from Linux, using Konqueror

Many Linux distributions use the KDE desktop environment and the Konqueror file manager/browser. If this is what you are using, you can follow these steps to access your Windows shared folder:

  1. Click the K menu icon.
  2. Select Internet ->Konqueror.
  3. In the Konqueror window that opens, click the Network Folders link, or type remote:/ in the address bar and press Enter .
  4. Click the Samba Shares icon.
  5. Click the icon of your Windows Home workgroup.
  6. Click the Workgroup icon.
  7. Click the icon for your computer.
  8. When prompted, enter the username and password for the Windows account that created the share.
  9. Click OK.

Access a Windows shared folder from Linux, using Nautilus

Many Linux distributions, especially those that use the GNOME desktop environment, use the Nautilus file manager. If this is what you’re using, you can follow these steps to access your Windows shared folder:

  1. Open Nautilus.
  2. From the File menu, select Connect to Server.
  3. In the Service type drop-down box, select Windows share.
  4. In the Server field, enter the name of your computer.
  5. Click Connect.

Alternatively, in the Nautilus address bar, you can type smb://ComputerName/ShareName and press Enter . For instance, when you created your Windows Share, if the share name was listed as:

Type smb://YOURCOMPUTERNAME/Users/YourUserName/ShareFolderName and press Enter . Note the smb: at the beginning; in Linux, use forward slashes instead of backslashes.

Access a Windows shared folder from Linux, using the command line

You can also access your Windows share from the Linux command line using the smbclient program.

  1. Open a terminal.
  2. Type smbclient at the command prompt.
  3. If you receive a «Usage:» message, this means smbclient is installed, and you can skip to the next step. If the command is not found, however, you need to install smbclient. Follow these steps to install it.

Источник

Крутые лайфхаки для работы с WSL (Подсистема Windows для Linux )

Я глубоко погружен в WSL (Windows Subsystem для Linux), и теперь, когда WSL2 доступен в Windows Insiders, это отличное время, чтобы по-настоящему изучить доступные опции. Очень интересная фича, которую я нашел в WSL, — возможность «чисто» перемещать данные между мирами. Это не тот опыт, который вы легко можете получить с полноценными виртуальными машинами, и он говорит о тесной интеграции Linux и Windows.

Под катом подробнее о некоторых интересных вещах, которые вы можете делать, смешивая арахисовое масло и шоколад!

Запустите Windows Explorer из Linux и получите доступ к файлам вашего дистрибутива

Когда вы находитесь в командной строке WSL / bash и хотите получить визуальный доступ к своим файлам, вы можете запустить «explorer.exe .», где находится текущий каталог, и вы получите окно проводника Windows, в котором ваши файлы Linux будут доставлены вам через сервер локальной сети plan9.

Используйте настоящие команды Linux (не CGYWIN) из Windows

Я уже писал об этом раньше, но теперь есть алиасы для функций PowerShell, которые позволяют вам использовать настоящие команды Linux изнутри Windows.

Вы можете вызвать любую команду Linux напрямую из DOS/Windows/чего угодно, просто поместив ее после WSL.exe, вот так.

Исполняемые файлы Windows можно вызывать/запускать из WSL/Linux, поскольку путь к Windows находится в $PATH до Windows. Все, что вам нужно сделать, это явно вызвать его с .exe в конце. Вот как работает «Explorer.exe.». Вы также можете сделать notepad.exe или любой другой файл.

Запустите Visual Studio Code и получите доступ к вашим приложениям Linux нативно на Windows

Вы можете запустить «code.», находясь в папке в WSL, и вам будет предложено установить расширения VS Remote.. Это эффективно разделяет Visual Studio Code пополам и запускает «headless» VS Code Server в Linux с клиентом VS Code в мире Windows.

Вам также необходимо установить Visual Studio Code и расширение Remote — WSL. При желании, установите бета-версию Windows Terminal для лучшего опыта работы с терминалом в Windows.

Вот отличная подборка статей из блога Windows Command Line.

  • Виртуальные машины являются ресурсоемкими и создают очень независимый опыт.
  • Исходный WSL был очень «подключенным», но имел довольно низкую производительность по сравнению с VM.
  • WSL 2 предлагает гибридный подход с облегченными VM, полностью подключенным интерфейсом и высокой производительностью.

Запуск нескольких Linux в считанные секунды

Здесь я использую «wsl —list —all», и в моей системе уже есть три Linux.

Я могу легко запустить их, а также назначить профили, чтобы они появлялись в моем Windows Terminal.

Запустите X Windows Server под Windows с Pengwin

Pengwin — это специальный Linux-дистрибутив WSL, который очень крут. Вы можете получить его в Windows Store. Объедините Pengwin с X Server, например X410, и вы получите очень классную интегрированную систему.

Простое перемещение дистрибутивов WSL между системами Windows.

Ana Betts отмечает эту замечательную технику, с помощью которой вы можете легко перенести свой идеальный дистрибутив WSL2 с одной машины на n машин.

Вот и все. Получите идеальную настройку Linux, синхронизированную на всех ваших системах.

Используйте провайдер учетных данных Windows Git внутри WSL

Все перечисленные фичи переткают в кульминацию в этом крутом посте от Ana Betts, где она интегрирует Windows Git Credential Provider в WSL, превращая /usr/bin/git-credential-manager в сценарий оболочки, который вызывает диспетчер git creds Windows. Гениально. Это было бы возможно только при условии чистой и тесной интеграции.

Источник

How to access windows file server from linux

We have a windows file server with an address like this:

How can I access it from Linux?

On a Ubuntu 14.04 I tried to access this through nautilus, but it crashed. Here is the crash report:

3 Answers 3

Assuming a recent Linux, do this:

Which will mount it at /mnt . You will need sufficient privilege (or be root).

If you need to add credentials, try:

You may need to install a package from your distro’s repository called cifs-utils but, hopefully, it would already be there as part of the standard install.

I’d suggest adding it to your /etc/fstab , so it’s online as soon as you boot. Mine has a (long) line reading:

  • The first field is the address and share name.
  • The second field is the mount point on your system (the folder must exist).
  • cifs is the type of the file system for any Windows share.
  • uid=1000,guid=1000,rw means that anyone on the system can access this share
  • credentials=/etc/cifspasswd means that that credentials found in /etc/cifspasswd will be used to authenticate access to the share on the Windows server.

This credential file should contain the username and password necessary for accessing the Windows share, i.e.

As /etc/fstab is (usually) readable by other users of the system, you can create the file as root and chmod go-=rwx to remove access for other users, to protect your password.

Caveat If you boot your system and the server isn’t available, Linux will wait a bit during the boot sequence before giving up.

Источник

How to access Windows folders from Bash on Ubuntu on Windows

On the Bash on Ubuntu on Windows app, I only have

How do I access all of the Windows folders like Documents, Downloads, etc.?

2 Answers 2

You’ll find the Windows C:\ structure at /mnt/c/ in the Bash environment.

Therefore, my Documents folder is at /mnt/c/Users/Ben/Documents/ .

directory, your home in the Bash environment, which is not the root ( / ). If you had done cd / first, you would have seen mnt .

Alternatively,

  1. Hold down Shift while right-clicking in your desired Windows directory
  2. Select «Open PowerShell window here«

  1. Once you’re in PowerShell, type bash

You’ll be able to use any Bash commands directly to operate on the files and folders in that Windows directory. By using this method, you don’t have to manually cd into your directories especially when you’ve a deep-rooted directory to access.

Update as of Windows 10 1809:

Above still works, but there’s an easier method now.

  1. Hold down Shift while right-clicking in your desired Windows directory
  2. Select «Open Linux shell here«

Источник

What is the home directory on Windows Subsystem for Linux?

When I start bash on Windows Subsystem for Linux, it drops me in the directory

When I ls this directory, I see the directories Desktop , Documents , etc. that I can see are in C:\Users\ using the Windows File Explorer. Since this is where the bash program started, I expected this is my home directory, but when I type either cd or cd

I am brought to

which contains my .bashrc , .profile etc. file which I would expect to find in my home directory in a Linux box. Moreover, entering cd ../.. from here I can see the directories bin , etc and so on, again as expected on a Linux box.

I have two questions regarding all this:

  1. What exactly is /mnt/c/Users/ compared with C:\Users\ ? It seems they are one in the same—so what is /mnt/c/ ?
  2. How can I view the files in /home/ using the Windows File Explorer? Not that I’d really ever want to—I’m just trying to get a feel for how Windows is organizing this Subsystem for Linux thing.

11 Answers 11

In the latest versions [2020], the file system is accessed from:

Previously, as of 2018, The current path is related to which distribution you have installed from the Microsoft Store rather than one global path; for Ubuntu, it was located at:

Other distributions should be (to be confirmed) in a similar location under their respective folders within:

In Bash, to view the current directory in Windows File Explorer just enter:

Don’t leave out the «.».

This will open windows explorer at the current folder and you can see where everything is in relation to the rest of your Windows system.

  1. /mnt/c is the exact same as C:\ . It’s just the syntax for getting to it from WSL.
  2. Look in C:\Users\ \AppData\Local\Lxss\rootfs .

About the filesystem mounted on /mnt/c

  1. What exactly is /mnt/c/Users/ compared with C:\Users ? It seems they are one in the same—so what is /mnt/c/?

In contrast to Windows, Linux (and the other systems based on Unix) use a single folder structure independent of the number of disks you have. If you have multiple disks, all these disks must me mounted into the folder structure at some point.

  • Typically, all the disks (different than the used to boot the system) are mounted in a folder named /mnt or /media

WSL has an special type of filesystem named DrvFS that gives you access to the disks used in windows. You can use DrvFS to mount, not only your windows filesystem, but also network disks and other media types.

  • In WSL, by default, the C: disk in windows is mounted under /mnt/c
  • If you have another disk, for instance a D: disk in windows, it will be mounted under /mnt/d

The files you can see in /mnt/c are the same you have in C: . If you modify some file, you will get the changes in the windows too.

About the location of /home/

  1. How can I view the files in /home/ using the Windows File Explorer? Not that I’d really ever want to—I’m just trying to get a feel for how Windows is organizing this Subsystem for Linux thing.

In WSL, all the linux filesystem is located under a Windows folder. The location of the folder depends on the version of Windows and of the WSL distribution you are using.

  • Initial versions of WSL store the linux filesystem in %LOCALAPPDATA%\Lxss\rootfs
  • WSL distributions installed from the Windows Store, starting in Windows Build 16215 (mid of 2017), use a folder like %LOCALAPPDATA%\Packages\\LocalState\rootfs . The name of the package varies depending on the distribution (e.g. it is different for Ubuntu than for Debian). For Ubuntu on Windows it is CanonicalGroupLimited.UbuntuonWindows_ , for example.
  • Linux distributions installed using other tools, such as lxRunOffline or WSL-DistroLauncher may store the linux filesystem into any location.

You may check many options to know the location of the WSL folder. For instance, I think the easiest option is to use lxRunOffline to know the installation folder.

Once you know the location of the installation folder, the /home/ is under \rootfs\home\username .

  • For instance, if your installation folder is c:\wsl\ubuntu
  • the /home/ is in c:\wsl\ubuntu\rootfs\home\username

NOTE: Both Linux and Windows stores file permissions in different ways. Nowadays, the WSL DrvFS stores the Linux permissions as Streams (metadata) attached to the files you can see in Windows. Microsoft does not recommend to modify linux files using Windows programs. It is possible that some Windows applcations damage the linux permissions without notice it.

Источник

Читайте также:  Дистрибутив linux для виртуальных машин
Оцените статью