Making Things Easier in Cygwin

Поделиться
HTML-код
  • Опубликовано: 23 авг 2024

Комментарии • 31

  • @mehdicharife2335
    @mehdicharife2335 3 года назад +2

    Thanks man, that was very useful.

    • @mgc9002
      @mgc9002  3 года назад +1

      You're welcome

  • @mgc9002
    @mgc9002  8 лет назад +2

    I just discovered a neat feature of the mintty terminal: if you drag & drop a file/folder from Windows Explorer into the terminal, the full *NIX-style pathname gets dumped in. The best part? It will automatically enclose the pathname in quote marks if there are spaces!

    • @mgc9002
      @mgc9002  8 лет назад

      My recent video solely about mintty features: ruclips.net/video/YDOEEyOk1bc/видео.html

  • @smyrtgyz
    @smyrtgyz 6 лет назад

    Thank you for your time!

  • @k.l.dyellow6463
    @k.l.dyellow6463 6 лет назад

    very nice. thanks Mike!!

    • @mgc9002
      @mgc9002  6 лет назад

      +kang li you're welcome! I do plan on recording some more videos this year; hope they will be useful too

    • @k.l.dyellow6463
      @k.l.dyellow6463 6 лет назад

      Michael Chu please! I also watched your other recordings as well. I setup both cgwin and as well as run a Ubuntu bash on Windows Pro. One thing would be nice to share how is your bashrc, profile....I am currently trying to setup ls_color to get my shell in colors. Thanks

    • @mgc9002
      @mgc9002  6 лет назад

      Not much to show on that, I'm afraid. My .bashrc has basically just the items discussed in this video, plus a handful of other settings, e.g. "set -o vi" which lets you use vi-style keyboard strokes to edit the command line. Colour is something I've been playing with in shell scripts, but I've been happy with what the shell displays by default so haven't tweaked that at all.

    • @mgc9002
      @mgc9002  6 лет назад

      @kang li, Perhaps a bit too late, but I found this old article on customizing the Mintty colours. Didn't follow through with the instructions (since I'm happy with my setup), but you may be interested:
      randomartifacts.blogspot.com/2012/10/a-proper-cygwin-environment.html

  • @billma12345
    @billma12345 8 лет назад

    i was wondering the same question about bashrc vs bash_profile haha. seems like you'd only use bash_profile if you want something executed right when you login and then use bashrc when you're already in the terminal

    • @mgc9002
      @mgc9002  7 лет назад

      I think you're right! I just added some dummy "echo" commands into both, and it looks like both are run when you open a new terminal (regardless of how many you already have open), and only the bashrc runs when you start a bash shell within an existing session.
      Can't think of when I would really need that, since I rarely start shells within shells ...

  • @rgriff29
    @rgriff29 8 лет назад

    thank you for the great tutorial

    • @mgc9002
      @mgc9002  8 лет назад

      You are most welcome! You may also enjoy the "mintty" video, which demonstrates some very nifty features built into the terminal: ruclips.net/video/YDOEEyOk1bc/видео.html

  • @Lowzenza4
    @Lowzenza4 6 лет назад

    How do you get your cygwin shell to open with your working directory prined out? I used export PS1="\w $ " but my prompt is always ~ $ only. How does everyone have their profile name show up?

    • @mgc9002
      @mgc9002  6 лет назад

      @Lowzenza Short answer for you: add \u to get your username too:
      export PS1="\u \w $ "
      Extended answer: the Bash shell lets you customize your prompt quite a bit.
      For example, to show name and directory in different colours, try this:
      export PS1='\[\e[32m\]\u \[\e[33m\]\w\[\e[0m\]
      \$ '
      The 32 before \u (username) makes it green; the 33 before \w (working directory) makes it yellow; and the 0 near the end resets the terminal to black. If you want other colours, you can check the first 2 columns in this Wikipedia table: en.wikipedia.org/wiki/ANSI_escape_code#3.2F4_bit
      If you are interested in seeing all the available codes to customize the prompt, check the 'bash' manual page under the heading "PROMPTING". Here's a command you can copy+paste into your terminal to jump right to that section:
      man --pager='less -p ^PROMPTING' bash
      I prefer to start my PS1 with
      so there is a blank line before the prompt. e.g.
      export PS1='
      \[\e[32m\]\u \[\e[33m\]\w\[\e[0m\]
      \$ '

  • @awakekat
    @awakekat 8 лет назад

    Just wondering how to autoload the .bashrc file into cygwin when it starts. Thanks. I am a mac person and it just works there. Learning to setup windows for my students.

    • @mgc9002
      @mgc9002  8 лет назад

      +Katherine Wakefield Hi Katherine. The .bashrc file will automatically execute when you open a Cygwin terminal.
      Or, were you asking how to customize the .bashrc for everyone that uses the computer with Cygwin? If so, I believe you can make edits to the "/etc/skel/.bashrc" file; new users get a copy of this file when their home directory is created.

    • @awakekat
      @awakekat 8 лет назад

      Um well for me opening my Cygwin it does not load my .bashrc file. I have several aliases such as "D" = Desktop and it doesn't go there. it also does not under stand "ls"

    • @mgc9002
      @mgc9002  8 лет назад

      I think your Cygwin shortcut isn't configured properly. Try right-clicking on the Cygwin shortcut and checking the value of the "Target" field. It should read something like this:
      C:\cygwin64\bin\mintty.exe -i /Cygwin-Terminal.ico -
      The hyphen at the end is key: it runs bash as a login shell, meaning .bashrc will be loaded.
      Please give that a try. If it doesn't work, let me know what is showing up in the Target field for your Cygwin shortcut.
      For your reference, I took screenshots of what I'm seeing on my computer - hope it helps:
      goo.gl/photos/LoMGeYnsPrP131Jd8

    • @awakekat
      @awakekat 8 лет назад

      The target looks exactly like yours - thanks for the photo. :(

    • @mgc9002
      @mgc9002  8 лет назад

      +Katherine Wakefield It could be that the installation somehow got messed up, and a fresh reinstall will fix things. (At work, my colleagues and I have had to resort to this from time to time.)
      Cygwin does not have a real uninstall process, so to try this, just rename/relocate the existing C:\cygwin64 folder, then run the installer again.
      Another thing you could try is to start the bash shell directly. Try the following command in the Windows command prompt (or from the Windows "Run" prompt):
      C:\cygwin64\bin\bash.exe --login -i

  • @houssemgargouri6173
    @houssemgargouri6173 7 лет назад

    thanks but i have problem in the command ipconfig and ifconfig it said bash : command not found any solution ?

    • @mgc9002
      @mgc9002  7 лет назад

      +Gargouri Houssem ipconfig should be available as a Windows command, but ifconfig is not normally available so it is normal that you cannot find it.
      It sounds like your $PATH variable is not set up properly. Try echoing both $PATH and $ORIGINAL_PATH variables. Both should show paths starting with /cygdrive/ ...
      Here is a reference link for you about how the path is set:
      cygwin.com/faq/faq.html#faq.using.path

    • @houssemgargouri6173
      @houssemgargouri6173 7 лет назад +1

      it worked with this path : export PATH=$PATH:"/bin:/cygdrive/c/Windows/system32" thx

  • @1sbollap
    @1sbollap 8 лет назад

    thank you for the video. cygstart filename.txt is opening a file in notepad. how can i change that to open in notepad++

    • @mgc9002
      @mgc9002  8 лет назад +1

      +1sbollap cygstart uses the same program that Windows would use to open a file. So, to make it use Notepad++, you must set Notepad++ as the default file handler for .txt files

    • @mgc9002
      @mgc9002  8 лет назад +1

      +1sbollap cygstart uses the same program that Windows would use to open a file. So, to make it use Notepad++, you must set Notepad++ as the default file handler for .txt files

    • @1sbollap
      @1sbollap 8 лет назад +1

      Thank you very much. I went into Notepadd++ > Settings > Prefs > File Associations and added .txt to Registered exts and it worked