Linux learning day2

Grant permissions
rwx
1 1 1 binary number 111 is converted to decimal 7
1 0 1 5
chomod command: chmod 715 core
-rwx–xr-x 1 linux linux 28942336 Oct 15 2015 core
sudo + command: borrow permission from the system to complete the command operation

[File operation]
Create: touch file name // Note: the file name is followed by the suffix. C
delete: rm file name
Move: mv file name target path under the original path
Note: mv file name 1 file name 2: rename file 1 File 2
copy: file name target path under cp original path

[Folder operation]
Create: mkdir folder name // create empty folder
mkdir -p folder 1 / folder 2 / folder 3 (create three folders with embedded relationship at the same time)
delete: rmdir folder name // You can only delete the empty folder
rm -r folder name // delete a folder completely
Move: mv folder name target path under the original path
Note: mv folder name 1 folder name 2: rename folder 1
Copy for folder 2 : cp -r folder name target path
cp 1.c 3.c created the same as 1.c

Ping www.baidu.com to
test whether the virtual machine network is unobstructed
ctrl + c to terminate the process

[Vi editor]
A text editing tool under Linux
Entry method: vi File name // Note: If the file does not exist, create and edit, if the file exists, edit directly
Three modes:
1. Command line mode, enter vi editing the default mode is
2. insert mode, text edit mode, press the keyboard command mode 'a' / 'i' / 'o' in insert mode, then return to command mode esc
3. underlying schema, command-line mode Press the space bar to enter the bottom mode, press [Esc] to return to the command line mode

Enter wq in the bottom mode (q only exits) and press Enter to save and exit the vi editor.
Simple operation
Command line mode:
yy: copy the line where the cursor is located
nyy: copy the cursor down n lines
p: paste // paste the copied content Cursor line next line
dd: Cut the cursor line
ndd: cut the cursor down n lines of content
gg: cursor moves to the first line of the first line
G: cursor moves to the last line
u: undo
ctrl + r: reverse undo / / Is to make the revoked thing appear again

Underlying mode: 2,
4y: copy lines 2-4 2,
4d: cut lines 2-4
/ word: find the word string // n look down, N look up
w: write save
q: exit
wq: save and exit
x: save and exit
! : Put it behind the command and force the command operation

[Hello world]
#include <stdio.h>
int main () {
printf (“Hello World \ n”);
return 0;
}
program writing to execution flow
1.vi editor to write the file, save and exit
2.gcc file name // The gcc editing tool compiles the file to generate a binary executable file. The default is a.out // gcc 3.c -o test. The executable file is named test
3. ./executable file

Published 12 original articles · Like1 · Visits 197

Guess you like

Origin blog.csdn.net/qq_39338091/article/details/105248905