使用Windows 10,我使用Linux Bash Shell与Jekyll一起使用。
我要做的就是打开资源管理器或文件系统来复制一些文件。有谁知道你如何使用shell浏览文件资源管理器或以其他方式实现我想要的?
我希望打开一条生活在
的道路/var/lib/gems/2.3.0/gems/minima-2.5.0
基本上我想做Linux Bash Shell(Windows 10)相当于
explorer /var/lib/gems/2.3.0/gems/minima-2.5.0
我安装了nautilus
str@DESKTOP-SMMADM5:/mnt/c/WorkingProjects/personal$ sudo apt install nautilus
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
adwaita-icon-theme at-spi2-core colord colord-data dbus-x11 dconf-gsettings-backend dconf-service desktop-file-utils
fontconfig gcr glib-networking glib-networking-common glib-networking-services gnome-desktop3-data gnome-keyring
gsettings-desktop-schemas gvfs gvfs-backends gvfs-common gvfs-daemons gvfs-libs hicolor-icon-theme
humanity-icon-theme hwdata libarchive13 libassuan0 libatasmart4 libatk-bridge2.0-0 libatk1.0-0 libatk1.0-data
libatspi2.0-0 libavahi-client3 libavahi-common-data libavahi-common3 libavahi-glib1 libboost-filesystem1.58.0
libboost-system1.58.0 libcairo-gobject2 libcairo2 libcapnp-0.5.3 libcdio-cdda1 libcdio-paranoia1 libcdio13
libcolord2 libcolorhug2 libcups2 libdatrie1 libdbusmenu-glib4 libdconf1 libdee-1.0-4 libegl1-mesa libepoxy0
libexempi3 libexif12 libgail-3-0 libgbm1 libgck-1-0 libgcr-3-common libgcr-base-3-1 libgcr-ui-3-1 libgd3
libgdata-common libgdata22 libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common libgnome-desktop-3-12 libgoa-1.0-0b
libgoa-1.0-common libgphoto2-6 libgphoto2-l10n libgphoto2-port12 libgraphite2-3 libgtk-3-0 libgtk-3-bin
libgtk-3-common libgudev-1.0-0 libgusb2 libharfbuzz0b libieee1284-3 libimobiledevice6 libjbig0 libjpeg-turbo8
libjpeg8 libjson-glib-1.0-0 libjson-glib-1.0-common liblcms2-2 libldb1 libmediaart-2.0-0 libmirclient9 libmircommon7
libmircore1 libmirprotobuf3 libmtp-common libmtp-runtime libmtp9 libnautilus-extension1a libnotify4 libnspr4 libnss3
libnss3-nssdb liboauth0 libp11-kit-gnome-keyring libpam-gnome-keyring libpango-1.0-0 libpangocairo-1.0-0
libpangoft2-1.0-0 libpixman-1-0 libplist3 libprotobuf-lite9v5 libproxy1v5 libpython2.7 librest-0.7-0 librsvg2-2
librsvg2-common libsane libsane-common libsecret-1-0 libsecret-common libsmbclient libsoup-gnome2.4-1 libsoup2.4-1
libtalloc2 libtdb1 libtevent0 libthai-data libthai0 libtiff5 libtracker-sparql-1.0-0 libudisks2-0
libunity-protocol-private0 libunity-scopes-json-def-desktop libunity9 libusbmuxd4 libvpx3 libwayland-client0
libwayland-cursor0 libwayland-egl1-mesa libwayland-server0 libwbclient0 libxapian22v5 libxcb-render0 libxcb-shm0
libxcb-xfixes0 libxkbcommon0 libzeitgeist-2.0-0 nautilus-data notification-daemon p11-kit p11-kit-modules
pinentry-gnome3 python-talloc samba-libs session-migration ubuntu-mono udisks2 usbmuxd zeitgeist-core
Suggested packages:
colord-sensor-argyll bluez-obexd samba-common lrzip cups-common libgd-tools gphoto2 libusbmuxd-tools liblcms2-utils
librsvg2-bin avahi-daemon hplip libsane-extras sane-utils unity-common xapian-tools brasero eog evince | pdf-viewer
totem | mp3-decoder tracker gnome-sushi pinentry-doc reiserfsprogs exfat-utils zeitgeist-datahub
The following NEW packages will be installed:
adwaita-icon-theme at-spi2-core colord colord-data dbus-x11 dconf-gsettings-backend dconf-service desktop-file-utils
fontconfig gcr glib-networking glib-networking-common glib-networking-services gnome-desktop3-data gnome-keyring
gsettings-desktop-schemas gvfs gvfs-backends gvfs-common gvfs-daemons gvfs-libs hicolor-icon-theme
humanity-icon-theme hwdata libarchive13 libassuan0 libatasmart4 libatk-bridge2.0-0 libatk1.0-0 libatk1.0-data
libatspi2.0-0 libavahi-client3 libavahi-common-data libavahi-common3 libavahi-glib1 libboost-filesystem1.58.0
libboost-system1.58.0 libcairo-gobject2 libcairo2 libcapnp-0.5.3 libcdio-cdda1 libcdio-paranoia1 libcdio13
libcolord2 libcolorhug2 libcups2 libdatrie1 libdbusmenu-glib4 libdconf1 libdee-1.0-4 libegl1-mesa libepoxy0
libexempi3 libexif12 libgail-3-0 libgbm1 libgck-1-0 libgcr-3-common libgcr-base-3-1 libgcr-ui-3-1 libgd3
Setting up libgoa-1.0-0b:amd64 (3.18.3-1ubuntu2) ...
Setting up libnspr4:amd64 (2:4.13.1-0ubuntu0.16.04.1) ...
Setting up libgdata-common (0.17.4-1) ...
Setting up libplist3:amd64 (1.12-3.1ubuntu0.16.04.1) ...
Setting up libusbmuxd4:amd64 (1.0.10-2ubuntu0.1) ...
Setting up libimobiledevice6:amd64 (1.2.0+dfsg-3~ubuntu0.2) ...
Setting up hwdata (0.267-1) ...
Setting up libdbusmenu-glib4:amd64 (16.04.1+16.04.20160927-0ubuntu1) ...
Setting up libgphoto2-l10n (2.5.9-3) ...
Setting up libmediaart-2.0-0:amd64 (1.9.0-2) ...
Setting up libmtp-runtime (1.1.10-2ubuntu1) ...
Setting up libtracker-sparql-1.0-0:amd64 (1.6.2-0ubuntu1.1) ...
Setting up libunity-protocol-private0:amd64 (7.1.4+16.04.20180209.1-0ubuntu1) ...
Setting up libunity-scopes-json-def-desktop (7.1.4+16.04.20180209.1-0ubuntu1) ...
Setting up libunity9:amd64 (7.1.4+16.04.20180209.1-0ubuntu1) ...
Setting up session-migration (0.2.3) ...
Setting up nautilus-data (1:3.18.4.is.3.14.3-0ubuntu6) ...
Setting up usbmuxd (1.1.0-2) ...
Warning: The home dir /var/lib/usbmux you specified can't be accessed: No such file or directory
Adding system user `usbmux' (UID 113) ...
Adding new user `usbmux' (UID 113) with group `plugdev' ...
Not creating home directory `/var/lib/usbmux'.
Setting up libgtk-3-bin (3.18.9-1ubuntu3.3) ...
Setting up adwaita-icon-theme (3.18.0-2ubuntu3.1) ...
update-alternatives: using /usr/share/icons/Adwaita/cursor.theme to provide /usr/share/icons/default/index.theme (x-curs
or-theme) in auto mode
Setting up humanity-icon-theme (0.6.10.1) ...
Setting up libnss3-nssdb (2:3.28.4-0ubuntu0.16.04.3) ...
Setting up libnss3:amd64 (2:3.28.4-0ubuntu0.16.04.3) ...
Setting up liboauth0:amd64 (1.0.3-0ubuntu2) ...
Setting up libgdata22:amd64 (0.17.4-1) ...
Setting up ubuntu-mono (14.04+16.04.20180326-0ubuntu1) ...
Setting up libgtk-3-common (3.18.9-1ubuntu3.3) ...
Setting up libgtk-3-0:amd64 (3.18.9-1ubuntu3.3) ...
Setting up libgcr-ui-3-1:amd64 (3.18.0-1ubuntu1) ...
Setting up gcr (3.18.0-1ubuntu1) ...
Setting up pinentry-gnome3 (0.9.7-3) ...
Setting up gnome-keyring (3.18.3-0ubuntu2) ...
Setting up gvfs-backends (1.28.2-1ubuntu1~16.04.2) ...
Setting up libgail-3-0:amd64 (3.18.9-1ubuntu3.3) ...
Setting up libgnome-desktop-3-12:amd64 (3.18.2-1ubuntu1) ...
Setting up libnautilus-extension1a:amd64 (1:3.18.4.is.3.14.3-0ubuntu6) ...
Setting up nautilus (1:3.18.4.is.3.14.3-0ubuntu6) ...
Setting up notification-daemon (3.18.2-1) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Processing triggers for libgdk-pixbuf2.0-0:amd64 (2.32.2-1ubuntu1.4) ...
Processing triggers for dbus (1.10.6-1ubuntu3.3) ...
但是当我尝试打开我得到的路径时
str@DESKTOP-SMMADM5:/mnt/c/WorkingProjects/personal$ nautilus /var/lib/gems/2.3.0/gems/minima-2.5.0
Failed to connect to Mir: Failed to connect to server socket: No such file or directory
Unable to init server: Could not connect: Connection refused
(nautilus:6622): Gtk-WARNING **: cannot open display:
编辑:
已安装的xdg-utils(感谢Brydon)无效并在此处输出以下内容
stradled@DESKTOP-SMMADM5:/mnt/c/WorkingProjects/personal$ xdg-open /var/lib/gems/2.3.0/gems/minima-2.5.0
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/%{ <-- HERE (.*?)}/ at /usr/bin/run-mailcap line 528.
Error: no "view" mailcap rules found for type "inode/directory"
/usr/bin/xdg-open: 778: /usr/bin/xdg-open: www-browser: not found
/usr/bin/xdg-open: 778: /usr/bin/xdg-open: links2: not found
/usr/bin/xdg-open: 778: /usr/bin/xdg-open: elinks: not found
/usr/bin/xdg-open: 778: /usr/bin/xdg-open: links: not found
/usr/bin/xdg-open: 778: /usr/bin/xdg-open: lynx: not found
/usr/bin/xdg-open: 778: /usr/bin/xdg-open: w3m: not found
xdg-open: no method available for opening '/var/lib/gems/2.3.0/gems/minima-2.5.0'
答案 0 :(得分:0)
我在WSL中遇到了与Hashicorp Vault相同的问题。
我创建了一个脚本,该脚本基本上将xdg-open
转发到powershell -c start
虽然测试不多。
sudo tee /usr/local/bin/xdg-open <<EOF
#!/bin/sh
powershell.exe -c start "'\$@'"
EOF
sudo chmod +x /usr/local/bin/xdg-open
然后xdg-open https://google.com
应该起作用。
欢呼 奥利弗
答案 1 :(得分:0)
无需像其他答案中所建议的那样花哨的东西,wsl和Windows都支持从WSL内部打开Windows文件和应用程序,反之亦然。
首先请记住,您不应该打开Windows中的Linux文件并弄乱它们(link)。但是对于Windows文件和文件夹(例如:\ mnt \ c ...),您可以使用 // intializes and starts game
const ticGame = new TicGame();
ticGame.start();
function TicGame(){
// creates and tracks the players
const board = new Board();
const player1 = new Player1(board);
const player2 = new Player2(board);
this.positions = Array.from(document.querySelectorAll(".column"));
this.values=[];
var turnCount=0;
for(let i = 0; i < this.positions.length; i++){
this.values[i]=this.positions[i].innerHTML;
}
this.start = function() {
const config = { childList: true };
const observer = new MutationObserver(() => takeTurn(turnCount));
board.positions.forEach((el) => observer.observe(el, config));
takeTurn(turnCount);
}
function takeTurn(turnCount) {
if (turnCount % 2 === 0)
{
console.log(5);
turnCount++;
console.log(turnCount);
player1.takeTurn();
}
else
{
console.log(6);
player2.takeTurn();
turnCount++;
console.log(turnCount);
}
for(let i = 0; i < ticGame.positions.length; i++){
ticGame.values[i]=ticGame.positions[i].innerHTML;
}
}
//
// let a = document.getElementById('box1').innerHTML;
// console.log(a);
console.log(this.positions);
console.log(this.values);
const winningCombinations = [
[0,1,2],
[3,4,5],
[6,7,8],
[0,4,8],
[2,4,6],
[0,3,6],
[1,4,7],
[2,5,8]
];
console.log(winningCombinations);
}
// had to pop it out from ticGame because apparently i cant keep it in one object :(
function Board() {
this.positions = Array.from(document.querySelectorAll('.column'));
}
function Player1(board){
console.log(1);
this.takeTurn=function(){
board.positions.forEach(el => el.addEventListener('click', handleTurnTaken));
}
}
function Player2(board){
console.log(2);
this.takeTurn=function(){
board.positions.forEach(el => el.addEventListener('click', handleTurnTakenO));
}
}
function handleTurnTaken(event) {
console.log(3);
if(event.target.innerText === 'X' || event.target.innerText === 'O'){
console.log("NAH");
board.positions.forEach(el => el.removeEventListener('click', handleTurnTaken));
}
else{
event.target.innerText = 'X';
board.positions.forEach(el => el.removeEventListener('click', handleTurnTaken,true));
board.positions.forEach(el => el.removeEventListener('click', handleTurnTaken,false));
}
}
// **** me i suck at this
function handleTurnTakenO(event) {
console.log(4);
if(event.target.innerText === 'X' || event.target.innerText === 'O'){
console.log("NAH");
board.positions.forEach(el => el.removeEventListener('click', handleTurnTakenO));
}
else{
event.target.innerText = 'O';
board.positions.forEach(el => el.removeEventListener('click', handleTurnTakenO,true));
board.positions.forEach(el => el.removeEventListener('click', handleTurnTakenO,false));
}
}
要使其正常工作,您将需要在Linux环境集中设置一个别名
start .
如果要在linux文件系统中操作文件,可以使用midnight commander之类的双窗格控制台文件管理器
答案 2 :(得分:-1)
编辑:我没有意识到这是在WSL上,除非有显示服务器
,否则这不起作用xdg-open似乎在目录上工作(如果你不知道你的默认文件浏览器是什么)。
public BorrowId(Person person, Book book, Library library) {
assert library.getCode().equals( person.getId().getLibraryCode() );
assert library.getCode().equals( book.getId().getLibraryCode() );
this.person = person.getId().getName();
this.book = book.getId().getTitle();
this.library = library.getCode();
}
我在nautilus问题中唯一的输入是确保你正确拼写它并且安装实际上正在工作(不会抛出错误)。仔细阅读xdg-open /var/lib/gems/2.3.0/gems/minima-2.5.0
的输出或在此处发布。