Ubuntu download
Understanding the virtual machine Vmware
A virtual machine refers to a complete computer system with complete hardware system functions simulated by software and running in a completely isolated environment. Next, we will install Ubuntu via Vmware.
Download VMware Workstation Pro | CN
Ubuntu download
Ubuntu System Tutorial Practical Operation 1: Download and Installation of Ubuntu Image_bilibili_bilibili
Using Ubuntu
Introduction to Ubuntu system
Ubuntu is a Linux distribution operating system mainly based on desktop applications. Its name comes from the word “ubuntu” in Zulu or Hausa in southern Africa, which means “humanity” and “my existence is because of everyone’s existence.” It is a traditional African value. Ubuntu is based on the Debian distribution and the GNOME desktop environment. Starting from version 11.04, the Ubuntu distribution abandoned the GNOME desktop environment and changed it to Unity. Previously, people thought that Linux was difficult to install and use. After the emergence of Ubuntu, these became history. Ubuntu also has a huge community power, and users can easily get help from the community.
Learn more about Ubuntu_Baidu Encyclopedia (baidu.com)
Open the terminal under Ubuntu
1. Open the terminal with the search box
Click the icon in the upper left corner of the Ubuntu desktop to enter the search box. Enter “term” to pop up the terminal “Terminal” program and run it, as shown in the figure below:
2. Use the right button to open the terminal
Right-click on the desktop or in any directory in the file browser and select “Open in Terminal” in the pop-up menu bar.
3. Shortcut keys to open the terminal
Use the shortcut to open the terminal. The shortcut is “Ctrl + Alt + T”. Using the shortcut can directly call up the Ubuntu terminal in most cases.
Ubuntu common commands
Commonly used Shell commands
Directory operations | ls, cd,pwd, mkdir, rmdir; |
File operations | touch, cat, cp, rm, mv, chmod; |
File processing | grep, head, tail, wc, find, which, whereis, locate; |
Compression command | bzip2, bunzip2, gzip, unzip, tar; |
Process operation commands | top, ps, kill; |
Disk operation commands | mount, unmount; |
Power on and off commands | shutdown, halt, poweroff, reboot ; |
Other commonly used commands | echo, more, less, help, man; |
The most commonly used Ubuntu commands
1.cd: Switch directory
Go to another directory at the same level cd ../directory name cd .. means entering the upper directory cd ../.. to enter the upper directory, and you can add more later. Go to another directory at the same level cd ../directory name cd - //Returns to the last directory cd ~ //Enter the home directory, which is the abbreviation of /home/user name
2.ls: Display the contents of the current directory
List all files in a directory
ls -a
3.cat: Display text file content
Print the text content in the terminal.
cat <file name> //Print inside the terminal, different from gedit
Learning text editing software (vi/vim)
(1)vi/vim
1.vi brief description
All Unix Linux systems have a built-in vi text editor, but other text editors may not exist. But currently we use the vim editor more. vim has the ability to edit programs, and can actively identify the correctness of syntax by font color, which facilitates program design.
2.vim brief introduction
Vim is a text editor developed from vi. vim is vi IMproved. It has made many improvements on the basis of vi, such as: adding multi-level undo, multi-window operation, recovery after crash, and increased stability. Functions such as keyword auto-completion and contextual auto-completion are widely used among programmers.
3.Start VIM
vim + file name #In this directory, if the file exists, open it directly. If the file does not exist, start from the end of the file and create a new file. vim -R + file name #Open the file in read-only mode, but can force saving vim -r + file name #Restore the file that exited abnormally last time vim -M + file name #Open the file in read-only mode and cannot force save vim + number + file name #starting from line num vim + /string + file name #Open file and place the cursor on the first found string
4. Commands in command mode
Cursor movement operation instructions
Command | Description |
---|---|
k | Move cursor up |
j | Move cursor down |
h | Move cursor left |
l | Move the cursor right |
shift + 6 | Move the cursor to the beginning of the line |
shift + 4 | Move the cursor to the end of the line |
gg | Move the cursor to the first line |
G | Move the cursor to the last line |
ctrl + b | Scrolling operation, scroll up |
ctrl + f | Scrolling operation, scrolling down |
Number + G | Quickly move the cursor to the specified line |
Number + up and down arrow keys | Based on the current cursor, move n lines up/down |
Number + left and right arrow keys | Based on the current cursor, move n lines left/right characters |
Delete operation command
Command | Description |
---|---|
x | Delete the character where the cursor is located
td> |
dd | Delete the entire line |
2dd | Delete 2 lines downwards , and so on |
dw | Delete a word (not applicable to Chinese) |
d + shift + 4/shfit + d | Delete to the end of the line |
d + shift + 6 | Delete to the beginning of the line |
Copy and paste instructions
Command | Operation |
---|---|
yy | Copy the entire row where the cursor is located |
3yy | Copy 3 lines downward, and so on |
y + shift + 6 | Copy to the beginning of the line, excluding the character at the cursor position |
yw | Copy a word |
p | Paste to the next line after the cursor |
P | Paste to the line before the cursor |
cc | Replace the entire line, that is, delete the line where the cursor is located and enter insert mode |
r + |
Replace the letter where the cursor is with the specified letter |
R | Replace continuously until Esc |
/ + |
Search downward (after entering the search, enter n and N to continue the search, n is Find the next content, N to find the previous content, enter noh and press Enter in command line mode to cancel the search) |
? + |
Search upward (after entering the search, enter n and N to continue searching, n is to search for the next content, N is to search for the previous content, enter noh and press Enter in the command line mode to cancel the search) |
Undo operation command
Command | Description |
---|---|
u | Undo the last operation |
ctrl + r | Redo the last undone operation |
Insert mode commands
Command | Instructions |
---|---|
i | Enter insert before the current cursor Mode |
I (capital i) | At the beginning of this line, enter insert mode |
a | After the cursor, enter insert mode |
A | At the end of this line, enter insert mode |
o | Insert a new row after the current row and enter insert mode |
O | Insert a new line before the current line and enter insert mode |
s | Delete the current character and enter insert mode |
S | Delete all text in the current line and enter insert mode |
In insert mode, the h, j, k, l keys cannot be used to move the cursor, but the cursor movement keys must be used.
Last line mode commands
Command | Instructions |
---|---|
:q! | Force quit vim, no Save |
:q | Exit vim |
:wq! | Force save and exit vim |
:wq | Save and exit vim |
😡 | Save and exit vim |
:w |
Save as |
:saveas |
Save as |
:set nu | Show line number |
:set nonu | Cancel line number |
:ce(center) | Content of this line Centered |
:ri(right) | The content of this line is centered on the right |
:le(left ) | The contents of this row are on the left |
Helloworld output under Ubuntu
step 1. Create program folder
Open terminal
mkdir + filename (create file)
cd + filename (open file)
step 2. Create program project file
mkdir + filename (create file)
cd + filename (open file)
step 3. Use vim to create and open the hw.c file
vi hw.c
step 4. Save and exit vim
Click “ESC” to return to normal mode, press “:” to enter command mode, use “:x” to save and exit vi
step.5 Use gcc command to compile hw.c file
gcc common commands
Compile link without options | Usage: #gcc hw.c Function: Preprocess, assemble, compile and link hw.c into an executable file. |
Option -o | Usage: #gcc hw.c -o hw Function: Preprocess, assemble, compile and link hw.c to form the executable file hw. The -o option is used to specify the file name of the output file |
Option -E | Usage: #gcc -E hw.c -o hw.i Function: Preprocess hw.c and output hw.i file. |
Option -S | Usage: #gcc -S hw.i Function: Assemble the preprocessing output file hw.i into hw.s file. |
Option -c | Usage: #gcc -c hw.s Function: Compile the assembly output file hw.s and output the hw.o file. |
No option link | Usage: #gcc hw.o -o hw Function: Link the compiled output file hw.o into the final executable file hw. |
Option -O | Usage: #gcc -O1 hw.c -o hw Function: Compile the program using compilation optimization level 1. |
gcc hello.c -o hello
step 6 compile and run
Devc + + A program for converting decimal numbers to binary numbers based on “euclidean division”
1. Code
#include <bits/stdc + + .h> using namespace std; void Computational_function(int decimalNumber)//Computational function { if(decimalNumber == 0) //In the first case, if the input decimal number is 0, the output binary form is also 0. { cout<<"The result of converting decimal to binary is:"<<decimalNumber<<endl; return; } else { int binaryNumber[32]; //Define an array to store binary numbers. int i=0; while (decimalNumber > 0) { binaryNumber[i] = decimalNumber % 2;//The remainder of a decimal number of 2 is the basic algorithm for converting decimal to binary. decimalNumber /= 2; i + + ; } cout<<"The result of converting decimal to binary is:"; for(int j=i-1;j>=0;j--)//The elements in the reverse output array are binary numbers. { cout<<binaryNumber[j]; } } cout<<endl; } int main() { int decimalNumber; cout<<"Please enter the decimal number to be calculated:"; cin>>decimalNumber; Computational_function(decimalNumber); return 0; }