Как перейти в каталог в C: с Cygwin?
Я пытаюсь установить PyQt4 так что я могу с ним возиться. В руководстве по установке говорилось, что я должен был установить Sip. Последний шаг к установка Sip использовать . У Windows этого нет, поэтому я посмотрел его и все, что я видел, сказал установить Cygwin. Так я и сделал. Но. СИП в C:Python31sip .
могу ли я запустить это из команды Cygwin? Если да, то как бы я это сделал?
или я могу запустить это из нормального командная строка windows? Если да, то как мне это сделать?
13 ответов:
Я добавлю что-то, что очень помогает мне с cygwin. Всякий раз, когда настраивается новая система, я всегда делаю это
это создает символическую ссылку до /cygdrive/c С Новым файлом под названием /c (в домашнем каталоге)
затем вы можете сделать это в командной строке
cd c: теперь поддерживается в cygwin
вы уже приняли ответ, но я просто подумал, что упомяну, что в Cygwin также работает следующее:
Я думаю cd /cygdrive/c метод лучше, но иногда полезно знать, что Вы тоже можете это сделать.
Как вы, вероятно ,захотите делать это часто, добавьте псевдонимы в свой.файл bashrc, как:
затем вы можете просто ввести в командной строке:
в соответствующей заметке вам также может понравиться:
Это позволяет вам cd a dir, просто набрав в dir
— это настойчивый, вы должны добавить его в свой
определите переменную in .bashrc следующее :
затем вы можете использовать
вкладка правильно autocompletes (пожалуйста, включите / в конце)
вы можете просто использовать
создайте файл с именем «overrideBashCdForWindowsPaths» в вашей домашней папке. Вставьте следующие строки в этот файл и сохраните его:
затем введите следующую команду в терминале, пока вы находитесь в своей домашней папке:
закройте терминал и откройте новый. Теперь вы можете легко перейти в эту папку Windows, просто набрав
скрипт считывает последнюю команду, извлекает путь и передает его в Cygwin путь-инструмент преобразования. Называя функцию «cd», мы как бы» переопределяем «встроенный» cd » Bash и делегируем ему фактический вызов в самой последней строке.
что-то, что стоит упомянуть здесь, это то, что Cygwin’s cygpath , по-прежнему не обрабатывает разнесенные пути Windows должным образом, особенно в сценариях Bash, работающих под управлением Cygwin. Фокус в том, чтобы понять, как Cygwin интерпретирует кавычки в скриптах Bash.
ниже ли не работы:
но это работает:
насколько я знаю, в настоящее время нет известного обходного пути с помощью cygpath , который может правильно обрабатывать пробелы в контекст сценария bash, но вы можете использовать кавычки в своих сценариях.
чтобы иметь linux, как чувствовать, то делать:
и использовать это как:
> (нажмите enter, когда вы видите эту строку)
теперь вы находитесь в диск C.
Setting Working Directory to Desktop in Cygwin
The current directory on cygwin is home/myuser. I navigated to cygwin and found it has a directory called home/myuser and could not figure out how I would navigate to the desktop. I did not want to add a desktop directory there and I could not navigate above the root folder (cygwin). Any idea on how I could do this?
2 Answers 2
This is essentially covered in the Cygwin FAQ under «How can I access other drives?». No, you’re not trying to access another drive, but you are trying to access a folder outside of the Cygwin tree. As the FAQ item says, Cygwin maps your Windows drives as /cygdrive/ , so your desktop is likely something like /cygdrive/c/Users/ /Desktop . Note that the path has changed over the years with various versions of Windows and you didn’t specify what version you’re running, so it may not be exactly that.
Anyway, what I would do, would be to create a symbolic link to that from my Cygwin home folder. Something like this:
I put the quotes in because depending on what version of windows you have, this path may include spaces.
You’ll probably notice from the FAQ that the Cygwin version of bash accepts DOS-style pathnames, so you can actually do the following:
But I recommend avoiding such syntax. Not all Cygwin apps understand DOS-style paths, and you’ll only end up confusing yourself if you have to try to figure out whether what you’re doing will work with a DOS-style path or not. It’s best to just use the Unix-style paths for everything when in the Cygwin environment, unless you have a very good reason not to.
Directory permissions for Cygwin SSH (Windows 7)
I am a fan of Linux but due to bad Intel wireless drivers in Linux, I had to switch to Windows 7. I have installed Cygwin in Windows and want to configure SSH to remotely connect to my laptop.
I searched with Google and found information for installing openssh server on Win 7, but I am getting the following error when running ssh-host-config :
The permissions of this folder are shown as read-only (only applies to this folder), checked in gray. I tried to uncheck but after I open the properties again, the box is again checked. Is there a way to change the permissions of this folder?
9 Answers 9
I’m running cygwin 1.7 on Windows 7 x64 and sshd. I don’t remember getting this error when I ran sshd_config, but I just looked at my /var/run directory and it’s set to 777.
Try this in a cygwin shell chmod 777 /var/run
$ chmod 777 /var/run bala@bala-PC
$ ls -l /var total 0 drwxr-xr-x 1 bala None 0 2010-01-17 22:34 cache drwxr-xr-x 1 bala None 0 2010-01-17 22:35 cron drwxr-xr-x 1 bala None 0 2010-01-23 11:46 empty drwxr-xr-x 1 bala None 0 2010-01-17 22:34 lib drwxr-xr-x 1 bala None 0 2010-01-17 22:32 log drwxr-xr-x 1 bala None 0 2010-01-17 22:34 run drwxr-xr-x 1 bala None 0 2010-01-17 22:34 tmp -rw-r—r— 1 bala None 0 2010-01-23 11:44 utmp – Boolean Jan 29 ’10 at 3:42
Sorry to unbury such an old thread, but this question always came up when I googled this specific problem.
After a few months, I finally found a solution. When I set up cygwin, I didn’t have my user and group accounts correctly created in cygwin. The main way to do this is to run:
If you are logging in using a domain user and passwd, you can do:
Or, if you have an incredibly large network like mine, you may not really want that. An alternative is to just user your local users and group plus whatever one you are currently logged in as:
After I did this, I was finally able to run ssh-host-config correctly to create the service.
I had a lot of trouble with this myself. I have found that the default install steps work just fine provided that I:
- Start the Cygwin shell as an Administrative user with the «Run As Administrator» option.
- Have UAC disabled.
- Have real-time virus protection disabled.
Once these steps have been taken, the default install steps are:
- Install «openssh» from the Cygwin installer.
- Start the Cygwin shell as an Administrative user with the «Run As Administrator» option.
- Run «ssh-host-config» from the Cygwin shell.
- Privilege Separation: yes
- New local account «sshd»: yes
- Install sshd as service: yes
- CYGWIN value: ntsec tty
- Different name for «cyg_server»: no
- Create new privileged user account «cyg_server»: yes
- Set «cyg_server» password and keep in a safe place
- net start sshd
After that, everything seems to work fine on both Windows 7 Professional and Home.
If you already have a failed Cygwin sshd installation, it may be best to do a full uninstall and start fresh.
How to navigate to a directory in C:\ with Cygwin?
I’m trying to install PyQt4 so I can mess around with it. The installation guide said I had to install Sip. The last step to installing Sip is to use the make install command. Windows doesn’t have that, so I looked it up and everything I saw said to install Cygwin. So I did. But. sip is in C:\Python31\sip .
Can I run this from the Cygwin command? If so, how would I do that?
Or can I run this from the normal windows command prompt? If so, how would I go about that?
13 Answers 13
I’ll add something that helps me out a lot with cygwin. Whenever setting up a new system, I always do this
This creates a symbolic link to /cygdrive/c with a new file called /c (in the home directory)
Then you can do this in your shell
cd c: is supported now in cygwin
You already accepted an answer, but I just thought I’d mention that the following also works in Cygwin:
I think the cd /cygdrive/c method is better, but sometimes it’s useful to know that you can do this too.
You can just use
As you’ll probably want to do this often, add aliases into your .bashrc file, like:
Then you can just type on the command line:
Define a variable in .bashrc :
then you can use
and the tab autocompletes correctly (please include the / at the end)
On a related note, you may also like:
This allows you to cd a dir by just typing in the dir
To make is persistent you should add it to your
you can try this
Create a file named «overrideBashCdForWindowsPaths» in your HOME folder. Paste the following lines into that file and save it:
Next, type the following command in a terminal, while you are in your HOME folder:
Close your terminal and open a new one. You can now easily change into that Windows folder by simply typing
The script reads the last command, extracts the path and passes it to Cygwin’s path-conversion tool. By naming the function «cd» we sort of ‘override’ Bash’s builtin «cd» and delegate the actual call to it in the very last line.
Cygwin: Введение
Эта статья будет полезна начинающим пользователям Cygwin. Начнем с того, что нам для начала нужно ответить на простой вопрос. Что же такое Cygwin? Cygwin — это UNIX-подобная среда и интерфейс командной строки для Microsoft Windows. В системе Microsoft Windows уже существует подобный интерфейс cmd. Вызвать командную строку можно сочетанием клавиш Win+R. Но зачастую большую часть работы Windows пользователям приходится делать вручную. По другую сторону Linux пользователь уже давно написал bash-скрипт и сидит пьет пиво в сторонке от автоматизированного рабочего процесса.
Так что же мешает сделать это и в ОС Windows? Правильно, абсолютно ничего не мешает. Но для этого нужны дополнительные программы и библиотеки. Программа Cygwin расширяет возможности стандартной командной строки Windows, позволяя автоматизировать некоторые процессы и разрабатывать программы для Linux и других систем.
Выбираем нужную версию, скачиваем и запускаем исполнительный файл setup-x86.exe и setup-x86_64.exe соответственно.
Окно установки 64 битной версии программы
Окно выбор способа установки
Окно выбора пакетов
Окно установки 32 битной версии программы выглядит точно так же как и 64 битной. Следующим шагом будет окно выбора. Откуда устанавливать или скачивать программу. Всего есть три варианта. Первый вариант Install from Internet (downloaded files will be kept for future re-use) установка из интернета причем загруженные файлы будут храниться до следующего повторного использования. Второй вариант Download Without Installing скачать без установки. Третий вариант Install from Local Directory установка из локального каталога. Т.к. у нас нет локальной копии и нам нужно установить то выбираем первый вариант. Следующее окно будет выбор пути установки. Рекомендую выбрать системный диск, к примеру у меня путь установки Cygwin это C:\cygwin64. Следующее окно это выбор пути где будут храниться временный файлы которые будут скачиваться в процессе установки. У меня это C:\cygwin64\package. Потом нужно выбрать как скачивать через прокси или напрямую. Следующим шагом будет выбор репозитория скачки выбираем любой попавшийся или тот что по умолчанию и жмем Далее. После нажатия кнопки далее начнется процесс скачивания основных конфигов. Следом вы сможете выбрать что устанавливать. Чтобы выбрать пакет нужно нажать Skip около названия пакета. Список пакетов которые вам пригодятся:
- gcc-core (в разделе Devel)
- gcc-g++ (в разделе Devel)
- make (в разделе Devel)
- cmake (в разделе Devel)
- automake (в разделе Devel)
- wget (в разделе Web)
- libiconv (в разделах Devel и Libs)
- openssh (в разделе Net)
- nano (в разделе Editors)
- bash (из раздела Base)
- base-cygwin (из раздела Base)
- base-files (из раздела Base)
- cygwin (из раздела Base)
- file (из раздела Base)
- gzip (из раздела Base)
- login (из раздела Base)
- mintty (из раздела Base)
- openssl (из раздела Base)
- run (из раздела Base)
- tar (из раздела Base)
- vim-minimal (из раздела Base)
- cron (из раздела Admin)
- shutdown (из раздела Admin)
- git (все пакеты из раздела Devel)
Также рекомендую полностью установить раздел Perl и Python. После этого жмем далее и произойдет установка нужных пакетов и их зависимостей. После конца установки можно будет запустить сам Cygwin и начать работу.
Мне не симпатизировал ни цвет фона, ни встроенный шрифт и цвет текста поэтому я кастомизировал его. На этих словах я закончу эту статью.
Данная статья не подлежит комментированию, поскольку её автор ещё не является полноправным участником сообщества. Вы сможете связаться с автором только после того, как он получит приглашение от кого-либо из участников сообщества. До этого момента его username будет скрыт псевдонимом.