Basic GNU/ Linux usage
This blog post is not intended to be a comprehensive tutorial, it’s just a quick primer on the basics I’ve used/recalled over the past few days on a small project. The notes are for understanding content, and the links to some good learning materials are at the end of the article.
[TOC]
As an ordinary user, the PC side of the common operating systems are: Windows, Mac OS, and the Unix-like system (GNU/Linux).
1. GNU/ Linux selection
- As a server | Fedora series: CentOS, RedHat, Fedora
- Personal development | Debian series: Ubuntu, Debian (raspberries pie – Raspbian)
- Like | over the Arch Linux
- Embedded | tailoring Linux itself
OS for embedded devices (in possible order of learning): Bare Code Development -> uCOS-II -> uLINUX-> Linux Kernel -> Roadmap
Others: RT-Thread, Free RTOS, VxWorks, Windows CE
2. System installation
This section is an area that is left out of the general tutorial, but I’ll brief it here.
2.1 System installation scheme
For personal development, the system I choose is Ubuntu. Currently, there are two mainstream versions, 18.04 and 16.04. The version number of Linux is specific, so I won’t go into details here. I used Ubuntu 18.04 as my environment for developing deep learning, and Ubuntu16.04 as my environment for installing Synopsys EDA Tools. System installation, there are generally three solutions:
-
Buy a new computer, toss
Not reality.
But there’s another option: buy a Raspberry Pi, configure Raspbian, and learn the basics.
-
Install two systems on your computer
No problem, but had better have certain computer toss over experience, otherwise the operation is not good may lose the original operating system file.
-
Use software like VMware to create a GNU/ Linux virtual machine for use
Recommend it.
- Other solutions: cloud server, novice not recommended.
2.2 System installation reference
If you choose Option 1:
- Since the purchase of PC: (because it is a local hao player ->) direct selling computer to help you install/circle of friends 50 pieces of ocean for help
- Raspberry Pi: Refer to the video to buy and install Raspberry Pi, or your own Google
If you choose Option 2:
- My main machine is the Lenovo Saver Y7000, the reference link for installing Windows and Ubuntu 18.04 dual systems, and it is feasible to test
Disk allocation process, if encountered “Windows system compression volume compressible space is far less than the actual remaining space “reference.
My computer is configured as: 8G + 8G DDR4, 100G + 375G Disk. Dual systems are primarily designed to train deep learning models. A total of 100GB is allocated to Ubuntu, with subitems as follows:
/ 20G; // primary partition, including system and software, as large as possible Swap 20G; /* Swap is set to 2 times the physical memory when the physical memory is 512Mb-2G; When physical memory is 2G-4G, swap is set to 1.5 times of physical memory; When there is 4G-8G physical memory, swap is set to be equivalent to physical memory; When the physical memory is larger, it is set to 0.75 times; */ boot 512M; // Boot partition, containing OS kernel and booted program, 200M-1g /Home 59.5g; // Logical partitions, similar to Windows My documents, are as large as possible
If you choose Option 3:
- You can find the relevant tutorials online to download VMware installation
- I installed Synopsys EDA Tools in Ubuntu 16.04 using a virtual machine solution, see the link
3. Basic use
GNU/ Linux does not display the password when you enter it. Do not enter it as if the word is not typed. Simply type Enter.
The default reader has completed the user and password setting during the system installation steps, and has successfully entered the graphical interface (in this case, the desktop).
The GNU/ Linux system provides two ways to interact:
-
GUI, graphical user interface
The system provides the user with a graphical interface, and the user can complete the operation by clicking the mouse and typing the keyboard.
-
CLI, command line interface
The system provides the user with a Shell for operations, which the user completes by typing commands.
The GUI operates in much the same way as Windows and Mac OS, and is used to solve some common tasks (documentation, chat, video, games…). CLI operation is the focus of GNU/ Linux system learning, learning, open the terminal, face CLI can.
Again, assume that the reader has some simple requirement that he or she wants to implement using the CLI.
3.1 Concept of working environment
Watch the line where the terminal cursor blinks, starting with Your_User_Name@Host_Name ~$. Where ~ represents the current work environment. To understand this working environment, we can conduct a simple little experiment.
First we know that there are two commands:
ls
Is for List, which lists all files in the current working environmentcd
Convert To stands for Convert To, which is to switch to the current working environment
So we’re going to input first
cd Desktop
Then press Enter. You can see that the ~ on the line with the blinking cursor has changed to ~/Desktop, indicating that we have reached the Desktop below ~.
This Desktop right here is equivalent to our Desktop. And then we type in
ls
I hit enter, and you can see that nothing comes back. That’s because there’s nothing on our desktops right now. So let’s minimize our terminal program, right click on the desktop, create a new folder, and put your own name on it. Then open the terminal program again and type again
ls
Hit Enter, and now we can see that it returns the name of the new file that we created on our desktop.
So, we know the concept of working environment, which is what folder we’re in right now.
3.2 Basic command structure
The input instructions in the terminal are mainly composed of three parts, such as the file copy command cp:
cp -r Desktop/test Desktop/test2
In this command, cp stands for copy, which refers to an application,
-r is the parameter to the program, which is used to specify the files in the folder,
The following Desktop/ Test and Desktop/ Test2 can be thought of as the action objects of the application.
Copy all folders from the test folder to the test2 folder on the desktop.
You can test this by creating two folders on your desktop first.
Anyway, the basic command structure is:
Application - Program arguments to one or more action objects
The next step, then, is to learn more commands, learn their parameters, and become a Linux expert, but it’s boring because it’s not task-driven.
So, the next thing we should do is actually give ourselves something to work with,
- For example, try using the C/C++ toolchain on Linux (GCC, G++, GDB);
- Another example is to configure a deep learning environment (Anaconda+Python+OpenCV+ PyTorch +TensorFlow-GPU).
- For example, build a simple personal small website based on LAMP(Linux, Apache, MySQL, PHP)…
Basically, what you do is you find a tutorial that looks good, and then you type it line by line.
There may be a lot of commands that don’t know what’s going on, but the typing process corrects a lot of habitual Typo in the first place…
4. Learn how to use GNU/ Linux a little systematically
Before, I had been pounding along with other people’s tutorials, practicing my hand feeling as much as possible, and forcing myself to check some basic instructions. Anyway, after a few times, common such as ls, mv, CD, rm, mkdir, nano, su… These should be almost some impression, namely received a simple task, can independently find the relevant posts to solve.
The motivation to continue learning how to use it might be that the task becomes more complex; Or they have special needs that are not available online; Or, start to step into a specific field, where people share information that you will use GNU/ Linux by default.
At this point, the recommended book is: Bird Brother’s Linux Private Kitchen. (I recommend buying the latest edition)
The recommended network learning materials are: Linux does not start to start
If you don’t understand something at this stage, it’s quite normal, because this is when you really start to learn an operating system (before using Windows and Mac OS, you used other people’s applications built on the operating system!).
If you really have an interest in this piece, you can read the in-depth understanding of computer system books, computer literacy basis.
A little more specialized, can go this way: computer composition principles -> operating system principles -> computer network -> (parallel) computer architecture
The GNU/ Linux command query URL can be: query
The key points of this stage can be: file system, text editor, permission management, Git+GitHub, as well as several remote access tools.
5. Scripting languages
It can be said that after learning the basics of 4, the reader will be proficient in using GNU/ Linux for their daily work, but this does not reflect the benefits of using the CLI. It’s time to learn something called a scripting language, whose main purpose is to help users quickly complete a series of tedious operations. When it comes to scripting languages, Python is certainly the most popular. The main scripting languages are:
- Python
- Csh
- Bash
- Makefile
- Perl
- TCL
For the average user, Python and CSH should suffice. You may need to learn more Bash and Makefile to build an operation or embedded front end. Then do digital IC design, may have to learn.
6. Deep
This section is beyond the scope of this blog post titled “GNU/ Linux Basics “.
At the end of the day, GNU/ Linux is just an operating system, so here are some things to consider:
-
Looking Down: Porting and Driver Development for GNU/ Linux
For embedded software engineers, part of the work is to develop applications based on the operating system; The other part of the work is to tailor and port the kernel of GNU/ Linux, or to develop drivers for certain devices. The former requires a fairly high understanding of both the hardware and software of the development platform, while the latter requires a deep understanding of the source code of the Linux kernel and familiarity with the hardware on which the operating system is based.
-
Looking up: network applications, servers and operational maintenance
If we replace the embedded scene with the large-scale server cluster scene, that is, we become the operation and maintenance engineers of the Internet company, then what we need to consider at this time is how to build a better network communication and development platform for our back-end/front-end students to show their skills. This scenario requires both proficiency in server architecture and a solid network foundation.
Of course, the source code of the Linux kernel is also Magi, you can learn the way others write code.