And Windows, use the editor to the necessary knowledge of Linux computer file system and C language learning initial grasp.
1. Classification and operating system kernel
Kernel: Linux, Unix, NT, Linux kernel is responsible for five working ① ② file management device management network management ④ ③ ⑤ Process Management Memory Management
Operating System: Windows family, MacOS, Ubuntu series, Redhat series, centOS and deepin, is the basis of various software applications integrated in the kernel basis
2.Linux system document management system
Linux system does not have the concept of Windows System C \ D \ E and other letter, adhering to all forms of interpretation file, follow FHS (Filesystem Hierarchy Standard) standard established inverted tree file system
Stored under each directory and the kernel function
/ Root directory
/ Bin basic user can command binaries
/ Boot and boot-related files
/ Dev device files (accessed through the device driver file)
/ Etc System configuration files
/ Home user's home directory
Library / lib executable programs need to connect
/ Sbin system two mechanisms file
/ Mnt / hgfs / share shared directory
3.shell terminal command (terminal, the black box, shortcuts Ctrl + alt + T, the terminal interface and then open a terminal Ctrl + shift + n)
linux @ ubuntu: ~ $: Linux represents the username @ hostname represents Spacer Ubuntu: ~ character represents the interval represents the average user's home directory $ (# denotes super user)
Common system command 4.Linux
①whoami see the usernames
②hostname view the host name
③su root super-user access, password is not displayed when successfully entered identity is root @ ubuntu: / #
④sudo passwd root: Reset the superuser password
⑤exit exit super user terminal or terminal
The common commands 2
① ls see a list of files in the current directory
ls -a show hidden files (. .. or the beginning of the file)
ls -l display file attribute information (ll) (wrx (421 weight) represents the implementation of the file read and write permissions, octal representation 0777, dsp-lcd file type (b block device file, d directory, s socket file, file conduit P - general documents, l linked file, c character device file))
ls -i display the file number iNode
ls -R recursively file display that displays the files in the hierarchy
ls -lh speak file properties into a corresponding order of magnitude
②cd switching of absolute and relative paths path distinguish
cd cd ~ return home directory
cd ../ return to the upper directory cd ../ ../ return to the parent directory cd - to return the last operation directory
cd / mnt / mnt absolute path to open the file can be filled with the tab key or the Find
pwd displays the current absolute path of the working document
clear clear screen Ctrl + l (actually turn on a)
③touch ac create the file (if the file exists, modify the file timestamp)
④mkdir a Create a directory (-m to assign permissions, -p create recursive)
⑤rm ac delete files or directories (-r documented need in the directory, you can delete multiple, can also be used to delete multiple wildcard *)
⑥chmod 0777 hello hello modify file permissions (file permissions of all files shared 777 that wrx)
⑦cp copy (-r -a to copy files recursively)
⑧mv cut or rename mv 1.c 2.c to rename 1.c 2.c mv hello / test / cut to document test /
⑨echo 111 to the printing terminal echo 11> hello, c redirect print to a file (as additional printing >>)
⑩cat test.c test.c display the contents of the file
6. common commands 3
vi or vim not commonly used commands
vi test.c test.c create and open the file exists directly open
vi has three modes, each mode command follows:
Command line mode (mode entered, press Esc to enter)
Copy 3 Copy yy copy row line 3yy
shear dd shear cut line 3dd three rows
Paste Paste p
revocation u revocation
aligned gg = G or press the left mouse button to select the keyboard the equal sign key
Find
a string / want to find
/ ^ string search string, the string is displayed to highlight the first occurrence of child
/ $ string search string, the string is displayed sub highlight the end of the
n lower a
on a N
: Find Nohl highlighting canceled insert mode: press command line mode I (the current position of the insert) I (first row insertion) a (current position of the insert) a (OK bit insertion) o (inserted into the lower one) O (row insertion)
Line mode:
: Q (quit) unmodified files Exit
:! Q (quit no save) force-quit
: w (save) Save
: wq or x (save quit) Save and exit
:! Wq (force save quit) compulsory save and exit
: wqa save and exit all files
: n Jump line
: set nonu canceled line numbers
: set nu show line numbers
Set Mouse
: set mouse = can be copied
: set mouse = a cancel copy
hold the shift, the mouse to select, release the shift, right 12.04
hold down shift, the mouse to select, without releasing shift, right 14.04 16.04
must insert mode when pasted , right past paste
: 60,65y copy
: 60,65d cut
:% s / hello / abc / g replace all (no / g to replace all the first line):
:% S / old string / new string / g
: 3,4s / Hello / ABC / g alternatively All, 3-4 lines per row
open multiple files
: vsp 1.c open vertically 1.c
: SP 1.c opened horizontally 1.c
Use gcc ac command to compile hello.c file in the terminal, the default file name is not specified production production a.out, ./a,out view the result of the program in the terminal
So far, the command in the Linux environment to learn C language used in basic enough, you can begin to edit and run the following first C program under Linux, and this has just started feeling very painful, much more difficult to use than Windows, but with When you're comfortable or very comfortable