In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article focuses on "common commands for Linux environment development". Friends who are interested may wish to have a look. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn the "common commands for Linux environment development"!
1. Pack and compress command tar
It is often encountered to package and decompress the source code under linux. If you still use linux's X window to do it, then you will out. The following are the common command parameters of the tool and examples of its application:
Main commands:
-c create package
-x unpack
-t list the contents of the package
-r add files to the specified package
-u update the files in the package
Optional commands:
-j use bzip2 for compression or decompression when creating or unpacking a package
-z use gzip to compress or decompress when creating or unpacking a package
-Z use compress to compress or decompress when creating or unpacking a package
-f followed by the specified package file name
-v displays the packing / unpacking process
-C specifies the path after unpacking
For example:
Tar-czf tmp.tar.gz / tmp zips the "/ tmp" directory to tmp.tar.gz
Tar-xzf tmp.tar.gz-C / home unpack the tmp.tar.gz package to the "/ home" directory
Tar-t tmp.tar.gz to view file information in the tmp.tar.gz package
2. File lookup command find
Suddenly I don't know which path xxx.c is under. You're not still using the X window in linux to search this file, are you? Find is the search tool for simple rape.
The command format is:
The path expression that find is looking for
For example:
Find. -name 1.txt looks for the file "1.txt" in the current directory and its subdirectories
Find / tmp-name 1.txt looks for the file "1.txt" in the "/ tmp" directory and its subdirectories.
In addition, find supports fuzzy lookup:
Find. -name * test*.c
For more advanced usage, please refer to the man manual, etc.
3. File content lookup command grep
I was looking at a bug, looking at the log, and suddenly I found a key log message, so which source file did this information print out? This is the time to use grep.
File content Lookup Command grep
The grep command is used to find the specified pattern match in the format:
Grep [command options] matching patterns to find [files to find]
For example:
Grep cams test.txt looks for cams strings in the "test.txt" file
Grep-r cams / root/cams looks for the cams string in all files in the "/ root/cams" directory and its subdirectories
In addition to finding files, the grep command can redirect any output stream to grep for lookup:
Ps-ef | grep ora looks for all process information that contains "ora" in the process name.
In fact, the above are the simplest and most commonly used uses of grep. For more advanced uses, please refer to grep's man manual.
4. ELF file analysis tool readelf
This command can be regarded as a more advanced command, which is not commonly used as mentioned above, but it is also a very practical software. Here we introduce some simple uses.
Query all the information of the file
Readelf object-file-name-a
Query elf header
Readelf object-file-name-h
Query symbol table
Readelf object-file-name-s
Query all section details
Readelf object-file-name-t or readelf object-file-name-S
Dump information about a section
Readelf object-file-name-p section-name | section-index
Readelf object-file-name-x section-name | section-index
Readelf object-file-name-R section-name | section-index
At this point, I believe you have a deeper understanding of the "common commands for Linux environment development". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.