In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Overview:
Linux is a free and open source UNIX-like operating system. It runs major Unix tools, applications, and network protocols, and supports 32-bit and 64-bit hardware. The kernel of the operating system was first released by Linus Torvaz on October 5, 1991.
Originally as a free operating system for personal computers that support Intel's x86 architecture, Linux can now run on servers and other large platforms, such as mainframes and supercomputers. Linux is also widely used in embedded systems, such as mobile phones (Mobile Phone), tablet computers (Tablet), routers (Router), television (TV) and video game consoles.
Basic directives in Linux:
1.rm instruction: rm is a delete instruction, but add the-r (recursive delete) option when deleting a folder, and-f means mandatory deletion, so use it with caution.
2.cp and mv instructions: I personally like to memorize these two instructions together, cp is a copy, mv is mobile, their rules of use are after the instruction + [option] [source file] [target file], so of course also support the operation of the folder, only need to add-r option on it.
3. Compress and decompress:
① tar:
There are two ways of tar, gzip (commonly used) and bzip2
Gzip:
Compress: tar-zcvf / tmp/etc.tar.gz / etc-- > compress the contents of the etc folder to the / tmp/ directory and name it etc.tar.gz
Unzip: tar-zxvf etc.tar.gz
② zip and unzip
4.find instruction: usage: find [path]-name (name to be found) Note: the name here can use a wildcard character (*).
Linux permissions:
There are two kinds of users under linux: ordinary users and superusers (root).
There are two ways to switch from an ordinary user to a superuser: su and su -, but there is a difference between these two ways. The path to root after using the su instruction is still the current home/ user, that is, although you have the rights of the superuser, you are not really a superuser, but the path to the superuser after using the su-instruction is / root.
1. Classification of file visitors: file owner, user group to which the file owner belongs, other
two。 File types and access permissions:
D: folder
-: ordinary files
L: soft links (Windows-like shortcuts)
B: block device files (such as hard drives, optical drives, etc.)
P: pipe fil
C: character device files (serial devices such as screens)
S: socket file
Basic permissions:
i. Read (4): for files, Read has permission to read the contents of files; for directories, it has permission to browse the directory information.
ii. Write (2): for files, Write has the permission to modify the contents of files; for directories, it has the right to delete files in mobile directories.
iii. Execute (1): execute has permission to execute files for files and access to directories for directories
You can modify the permissions of a file through the chmod command.
Text editor vim:
Normal mode, insert mode, bottom line mode
Some important commands in normal mode: (seven types: remove, delete, replace, delete, delete, remove, delete, delete, remove, delete, delete, delete
1. Move to the end of the line, ^ to the beginning of the line, gg to the beginning of the text, G to the end of the text
2.x Delete the character at the cursor position and dd delete the whole line
3.yy and p
4.r replace the character where the cursor is located, R replace the character where the cursor is located (sec stop)
5.U revocation, restoration of [ctrl+r] revocation
6.cw changes the location of the cursor to the suffix (not commonly used)
7. [ctrl+g] displays the line number, [# G] jumps to # line
Gcc/g++ in Linux Compiler
The first thing to know is the four phases of code generation and the tasks accomplished by each phase:
1. Preprocessing: macro replacement and expansion of header files and removal of comments
Gcc-E test.c-o test.i
two。 Compiling: checking syntax and generating assembly code
Gcc-S test.i-o test.s
3. Assemble: generate machine-recognizable code
Gcc-c test.s-o test.o
4. Links: generate executable file (test)
Gcc test.o-o test
Of course, gcc test.c-o test is most commonly used to generate executable files directly from the source code.
Note: the system will implement most of the library functions in the libc.so.6 library file, in the absence of a specific indication of the system will be in the path "user/lib" under the search will be linked to the corresponding library functions, which is the role of links, and library functions are divided into static and dynamic libraries, which we will explain in detail later.
About static and dynamic links
1. Static linking refers to linking the dependent dynamic library to the executable program, so it is relatively large, but can be executed normally on different platforms.
two。 Dynamic linking refers to loading the functions in the dependent dynamic library into the symbol table, and dynamically linking the dynamic library to execute the code in the dynamic library when running the program, so you must give the dependent dynamic library when you use it on different computers, otherwise you can't run it if you can't find it.
3. The default linking method of the compiler is dynamic linking. If you want to use static linking, add the-static option to the compilation options.
About Makefile:
Using make one-click compilation, the key in the Makefile file is to complete the compilation of the generation target according to the dependent target, but the dependent file written in the forefront is useless once it is generated (always just to generate the first target). Generally, when you want to compile multiple files through a makefile file, you have to use pseudo-target to determine, and the dependent file after the pseudo-target is the file to be generated, thus solving this problem.
Predefined variable: $^: all dependent objects
$@: all target objects
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.