How to use the gzip compression command-linux operation and maintenance
How to use the gzip compression command: [gzip [option] source file], such as [gzip install.log]. gzip is a command that is often used to compress and decompress files in the Linux system. [root@localhost ~]# gzip install.log #Compress the instal.log file [root@localhost ~]# ls anaconda-ks.cfg install.log.gz install.log.syslog #Compressed file is generated, but the source file also disappears Retain source file compression When using the gzip command to compress a file, the source file will disappear, thus generating a compressed file. At this time, some people will have obsessive-compulsive disorder, so they asked the author: Can the source file not disappear when compressing the file? Well, it’s possible, but it’s awkward. [root@localhost ~]# gzip -c anaconda-ks.cfg >anaconda-ks.cfg.gz #Use the -c option, but do not let the compressed data output to the screen, but redirect it to the compressed file, so that the file can be compressed without deleting the source file [root@localhost ~]# ls anaconda-ks.cfg anaconda-ks.cfg.gz install.log.gz install.log.syslog #You can see that both the compressed file and the source file exist
What are the methods of creating new files in linux-linux operation and maintenance
The methods of creating a new file in linux are: 1. Use the redirection symbol to create a file; 2. Use the touch command to create a file; 3. Use the echo command to create a file; 4. Use the printf command to create a file; 5. Use cat command to create a file. cat is one of the most commonly used commands in Unix-like systems. It provides three functions related to text files: displaying the contents of a file, combining the contents of multiple files into one output, and creating a new file.
Write the wc command in c language – count the number of characters, words, lines – linux operation and maintenance
We know that there is a very commonly used command on the linux operating system, the wc command used to count the number of characters, words and lines. Today, let’s try to use C language to write a program with similar functions (Note: Reading this article requires a certain C language foundation). When writing this program, you need to master the usage of two functions, getchar() and putchar(). getchar is used to read a character from standard input, and putchar is to print a character to standard output. It is relatively simple to count the number of standard input characters. As long as the getchar function can still read characters, the variable for counting the number of characters will automatically increase by 1. Counting the number of rows is also simple, as long as the character read is a newline character \n, the variable of the statistical function will be incremented by 1. The main difficulty here is how to count the number of words. My idea here is to set a state variable IN_WORD. When the characters read are blank characters (spaces, horizontal tabs, newlines) are all blank characters), the IN_WORD value is 0, and the number of counted…
What are the common commands of the vi editor-linux operation and maintenance
Editor linux php Write your review! Let’s make a fuss, see everything Member Login | User Registration recommended reading list Apache server cannot be opened when XAMPP is installed on MAC After installing MAMP, when starting the service, it prompts that Apache fails to start, and port 80 is occupied. Checking the process, I found that there are several httpd. [detailed] Crayon Shinchan 2023-08-25 16:27:54 list docker deploy ES docker deploy ES… [detailed] Crayon Shinchan 2023-08-25 16:08:50
How to clear files in a certain directory in linux-linux operation and maintenance
How to clear files in a directory in Linux: 1. Use the “rm -f *” command to delete all files in the current directory; 2. Use the find command to find common files and delete them; 3. Use the “rm- f `find . -type f`” command to delete all ordinary files; 4. Use the for loop statement to delete files. Recommendation: “Linux Tutorial” 10 kinds of files in the Linux deletion directory Method After reading the article, I suddenly thought of the method of deleting all files in the directory in Linux; I have sorted out a few, and if there are any shortcomings, I hope readers will not hesitate to enlighten me! Delete files in the current directory 1.rm -f * #The most classic Method, delete all types of files in the current directory 2.find . -type f -delete or find . -type f -exec rm -f {} \; #Use the find command to find ordinary files and delete them or use the find command to delete them 3.find . -type f | xargs rm -f #The parameter list is too long; too many files to delete 4.rm-f `find . -type f` #Delete all ordinary files 5.for delete in…
How to use the routeadd command – linux operation and maintenance
The route add command is used to display and modify entries in the local IP routing table, use ROUTE without parameters to display help, the code is [route [-f] [-p] [command [destination] [ mask netmask] ….]. Route add command usage: 1. Specific functions This command is used to display and modify entries in the local IP routing table. Use ROUTE without parameters to display help. Second, detailed syntax route [-f] [-p] [command [destination] [mask netmask] [gateway] [metric metric] [if inte***ce] Third, parameter description -f Clear all routes that are not primary routes (routes with subnet mask 255.255.255.255), loopback network routes (routes with destination 127.0.0.0 and subnet mask 255.255.255.0), or multicast routes (destinations with 224.0.0.0, the route with subnet mask 240.0.0.0) entries in the routing table. If it is used in conjunction with one of the commands (such as Add, Change or Delete), the table is cleared before running the command. -p When used together with the Add command, the specified route is added to the registry and the IP routing table is initialized when the TCP/IP protocol is started. By default, the added route will not be saved when the TCP/IP protocol is started, and the permanent route list will…
How to use the nslookup command-linux operation and maintenance
How to use the nslookup command: 1. [nslookup www.baidu.com] query the IP address corresponding to the domain name; 2. [nslookup -qt=ns www.baidu.com] query which DNS is used for the domain name server. Related learning recommendation:Linux video tutorial The above is the detailed content of how to use the nslookup command. For more information, please pay attention to other related articles on 1024programmer.com!
What is the command to run a file under linux-linux operation and maintenance
The command to run a file under linux is: [./filename.sh]. Specific method: First execute the [chmod 777 filename.sh] command to grant file permissions; then execute the [./filename.sh] command to run the file. Run the c language file and execute the following command: (Video sharing: linux video tutorial) sudo gedit test.c gcc -o test filename.c ./test Run the .sh file First of all, you must enable the permission, and then execute the following command chmod 777 filename.sh ./filename.sh
How to obtain IP-linux operation and maintenance through the command line under Linux
linux Write your review! Let’s make a fuss, see everything Member Login | User Registration recommended reading linux C++ written test record September 16, 2021 1. Function templates are all inline by default. Further study is required. The parent class destructor is a non-virtual function, and the subclass is a virtual function_zhl11a’s column-CSDN blog_The parent class destructor is a non-virtual parent class destructor… [detailed] Crayon Shinchan 2023-08-25 16:26:59 jenkins Jenkins tutorial (1) – install and configure jenkins under linux 1. CICD introduces the development and release of Internet software, and has formed a set of standard processes. If the development workflow is divided into the following stages: coding-construction-integration-test-… [detailed] Crayon Shinchan 2023-08-25 16:26:15
How to use the grep command to view the process under linux-linux operation and maintenance
How to use the grep command to view the process under Linux: Execute the [ps -ef | grep xxx] command to view the process. The ps command is used to display the process, and the grep command is used to match and output global regular expressions. View process command: (Video tutorial sharing: linux video tutorial) ps -ef | grep xxx ps: process show show process Parameters: e show all programs. f Display UID, PPIP, C and STIME fields grep: global search regular expression(RE) and print out the line Global regular expression matching and output