Find the answer to your Linux question:
Results 1 to 5 of 5
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Installing Cygwin and questions regarding the Linux CLI

    Hello and thank you all! Just some background on myself first since I'm new to this forum! I really really love creating applications and computer programs! It is just so fun and I love knowing what happens behind the scene. Specifically, I like algorithm design and I enjoy applying mathematics to programs (although I've only done simple applications and graphics/games so far). I also really like fiddling around with hardware and making projects with microcontrollers. I aim to become a computer engineering scientist (that is right, I said scientist). I am currently running Windows 7 but I have high respect for the idea of open source and plan to transition as soon as I can afford a secondary computer where I can store work and then can have this laptop free to mess around on until I'm familiar and comfortable with linux.

    On to my questions. I request please to answer as if I'm a total noob, which I more or less am.

    So at the moment, I'm doing a course called 'Startup Engineering' and we are going to use something called Cygwin which is used to emulate a Unix command line interface. During the installation, I found myself a little bamboozled and I also have a few questions about what Cygwin is and how it differs with MSYS.

    1. What is Cygwin? "a collection of tools which provide a Linux look and feel environment for Windows" and "a DLL (cygwin1.dll) which acts as a Linux API layer providing substantial Linux API functionality" is not helpful to someone who has never used Linux.

    My understanding: This might be stupid, but is it just a way to bring over syntax/commands used on a real linux command-line to windows?

    2. While installing Cygwin, we had the option to choose from MULTIPLE packages. What are these packages? Should I get all of them?

    My understanding: One can CHOOSE which 'commands' they want to bring over. Just a way of customization. If you DON'T choose ALL packages, you will have a condensed version of the linux CLI which won't be able to interpret all commands a normal, real one would. Just as an example, I also have msys which has the 'make' command. But cygwin does not recognize it. Is that right? Do I need to install the appropriate package?

    3. Here is the code in a batch file called cygwin. It launches the program
    echo off
    chdir C:\cygwin\bin
    bash --login -i
    What does bash do? When I type in 'bash /?,' bash is not recognized. I've never done cli scripting but I'm almost sure that batch files run as if they were typed into the windows CLI. So what is going on?

    4. HOW does cygwin translate unix commands? What exactly happens when I type ?

    Finally, does anyone have a link to where I can learn linux cli scripting? Or perhaps the name of a book?

    I really really appreciate it. It is late here so I will check back tomorrow!
    Last edited by anonymousxyz; 06-25-2013 at 04:09 AM.

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Excellent questions! I'll try to explain...

    1. Cygwin is a Linux environment that runs on Windows. Yes, it is a collection of tools to provide that Linux "look and feel" to Windows. Yes it provides DLL's that allow you to run programs written for the GNU compiler suite (GCC) and compiled inside cygwin on Windows, just as though they were native Windows applications. Yes, it implements pretty much 100% of Linux API's.

    FWIW, cygwin doesn't just emulate the Linux API's - it implements them for Windows.

    2. There are many packages (programs) for Linux. Cygwin supports most of those. You can install as many, or few, as you need/want. Myself, I pretty much install all of them, provided I have enough disc space!

    3. Bash is a shell, much like cmd.exe is for Windows (or powershell, if you prefer). There are a lot of online manuals for bash, and when you installed cygwin, it should have installed the man pages, so once in the bash shell, run the command "man bash" for a LOT more information than I can give you here!

    4. The bash shell is an interpreter. It takes input, looks up the command (internal to the shell, or external) and executes it. This is exactly what cmd.exe does for Windows. Just the syntax is different. Again, read the man page. When you installed cygwin, it should have installed in your Start menu a link to "Cygwin Terminal", which is the cygwin bash interface. Start that and enjoy!
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Aha, I see. So 'bash' is the actual terminal, not a command. That makes sense in the context of which I was reading on the internet. And in this case, it is not a 'command' for cmd, but an executable in the 'bin' directory. I understand.
    And bash shell = cmd except it simulates the unix look-and-feel, simply as a convenience and nothing more. Is the implication then that for every unix command, there is a windows equivalent command that can be typed in cmd to get the exact same result?

    Once again, simply to satisfy my curiosity, what is this line about:
    --login -i
    (in the code above)
    They are being passed in as parameters and I see an executable named login, but why does it need to login and what are the 'login' and 'password'? Also, when I launch just the bash executable, it looks like everything opens all fine. So what is the difference? And what is 'i' referring to?

    And thanks for the reference to the manual page. I will read through it and even online resources (and there are ALOT) are good now that I know what they were refering too. Lol, you can just imagine what I was thinking what I was reading when I thought 'bash' was just a command or a syntax thing in the linux shell.

  4. $spacer_open
  5. #4
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    As for "--login -i" I never used it. I just start the Cygwin Terminal (bash) and go from there. Yes, you can run Windows executables from the bash shell that puts you into, including cmd.exe and Windows command scripts. Yes, bash is a command - it starts the bash shell which is an interpreter, much like cmd.exe, but with different sub-commands and syntax. It can do a lot more than cmd.exe, which is why I recommended you read the man page. Once in the Cygwin Tterminal, execute the command "man bash", and it will give you a lot of information about what it can do.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  6. #5
    Thank you very much!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts