Some suggestions for learning Linux Programming

Source: Internet
Author: User

I have used Linux for 3 or 4 years. I have accumulated some experience from the old cainiao to the current cainiao, and now I want to share it with you, especially for beginners.

There are three methods to get the Linux environment:

I have used these three methods. Currently, I am a dual system, but for beginners, I strongly recommend the first method. Yes, it is extremely strong. The reason is simple: cygwin is easy to install and does not need to be dispersed.

Security dual system partition may be a bit scruples (in fact it is not that complicated), security virtual machine is more troublesome, I bought this book "laruence's Linux private house dish-cainiao" at the beginning, the book is good, but to be honest, it is not suitable for beginners. The book teaches you how to install virtual machines, install virtual machines and then install Linux. After the installation, you need to communicate with the virtual machines, such as the network, shared folders, and switch the mouse over something. In the end, I didn't want to learn about Linux, instead, I learned about virtual machines. In addition, it takes a long time to start a virtual machine. If you do not enable the virtual machine, you cannot use Linux. Therefore, we strongly recommend that you do not use the virtual machine.

Next we will focus on cygwin. On the official website of cygwin (www.cygwin.com), the introduction to cygwin is: Get that Linux feeling-on Windows (the feeling of finding Linux on Windows), which is really great.

Go to the official website to download the Installation File setup.exe and you will be able to install it. It is worth mentioning that this installation package is not only used to install Linux, but also used to update Linux and install new software packages. For example, you want to use the editor emacs in this Linux environment, the gcc compiler, the Debugger gdb, and the automatic compilation tool make are all installed by running the installation file. It doesn't matter if you are not familiar with these tools. I will introduce them later. This blog aims to get an environment and familiarize you with some basic bash commands.

I will not go into details about the installation process. By default, the next step is OK. During this period, you will be asked to choose to download the source, the Directory of the downloaded file, and so on. This step is important, but it is important to select a software package, each update adds or deletes a software package here, as shown below:

Search for what you want to install in the search box, and then select it below.

After the installation is complete, you will witness a miracle. If you install cygwin by default, you will see the cygwin icon on the desktop, and find the cygwin directory under drive C of Windows. The directory structure is as follows:

Cygwin is equivalent to the Linux root directory "\", where the directory is the most basic directory of the Linux system, no matter how you install Linux, No matter what version you install Linux, these directories are available in the root directory. Among them, bin is a common command, etc is a configuration file, lib is a library file, and usr is a header file. However, the most important directory is home. From then on, this home is your home. There is your own room in the home, and the room name is your username. Since then, no matter how hard you waste in the Windows world, remember to go back to your own home. Because we installed the lite version, only you have one directory. If there are other users, there are other directories in home.

How can I get back to my room? Click the cygwin icon on the desktop:

A black hole window is displayed ,:

It may be a bit darker than you think, as you think, but there is no error. Countless great cows are faced with such a dark window and have written countless excellent software. From then on, you will also be a member in front of the dark window, but don't be nervous, don't be afraid, I will walk you through the dark road in front of the dark window.

Let's first introduce several simple commands:

  • Ls: list the content in a directory. The default value is the current directory.
  • Cd: jump to a directory
  • Mkdir: create a directory
  • Echo: display text
  • Rm: delete a directory or file

When we opened this window, our location was in our room. Next, I want to use the commands just now to do some things. I paste them in the text below. What have I done? I will use a double slash (//) to watch them behind.

Eric @ Eric-PC ~
$ Ls // default parameter to display the content of the current directory
// The current directory has nothing
Eric @ Eric-PC ~
$ Mkdir "hello world" // create a directory named hello world in the current directory

Eric @ Eric-PC ~
$ Ls // display the content of the current directory
Hello world // The directory you just created

Eric @ Eric-PC ~
$ Cd hello \ world // enter the hello world Directory

Eric @ Eric-PC ~ /Hello world // the current directory is displayed.
$ Ls // display the content of the current directory. The current directory is hello world and there is nothing in it.

Eric @ Eric-PC ~ /Hello world
$ Cd .. // enter the parent directory. Two vertices... indicate the parent directory, and one vertex indicates the current directory.

Eric @ Eric-PC ~
$ Echo "hello world" // display text: hello world
Hello world

Eric @ Eric-PC ~
$ Echo "hello world"> text // display text hello world and save it in the file text

Eric @ Eric-PC ~
$ Ls // display the content of the current directory, which contains a directory and a file
Hello world text

Eric @ Eric-PC ~
$ Ls-l // The ls command with parameters. Use the long list mode to view more information.
Total 1
Drwxr-xr-x + 1 Eric None 0 Feb 17 19:21 hello world //
-Rw-r -- 1 Eric None 12 Feb 17 19:22 text //

Eric @ Eric-PC ~
$ Rm text // delete a file text

Eric @ Eric-PC ~ // Display the directory content
$ Ls
Hello world // there is only one directory left

Eric @ Eric-PC ~
$ Rm-r hello \ world // to delete a directory, use the rm command with parameters. The-r parameter indicates that the directory is deleted.

Eric @ Eric-PC ~

$ Ls // the contents of the Directory are displayed. All contents are deleted.

Eric @ Eric-PC ~
$ // Now you need to use these commands...

These commands are easy to use, but they can also be very complicated, because I did not mention many parameters. Search for them by yourself.

Now, this blog is about to end. I will write more content later.

Finally, remember that you now have a Linux Home in the Windows world. No matter how long you are doing in the Windows world, remember to go back to your Linux home and check it out, cd and ls.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.