Copy Code code as follows:
#include
#include
int main ()
{
Char castdoutline[1024]; One line of information in the standard output of the PS command
char* pctmp = NULL; A string that points to a space split
Char caselfpid[10]; PID
Copy Code code as follows:
#include
#include
#include
#include
int main (int argc,char **argv)
{
int mode;
int Mode_u;
int mode_g;
int mode_o;
Char *path;
if (argc{
printf ("%s \n", argv[0]);;
Exit (0);
}
1. Preface
Time is very important to the operating system, from the kernel level to the application layer, the time expression and precision of the same. The Linux kernel uses a constant named Jiffes to compute the timestamp. Application layer has
Function: Copies the specified input file to the specified output file, and can be converted to format during the copy process. You can use this command to realize the function of the diskcopy command under DOS. First use the DD command to write the
Xargs is a filter that passes parameters to a command and is a tool for combining multiple commands. It divides a data stream into small enough chunks to facilitate the processing of filters and commands. Typically, Xargs reads data from pipes or
1. Use of time-related random numbers
Generate output Unixtimestamp (%s) and current time nanosecond data (%N, accurate to one-seconds) using the data command. )
The former ensures that the output does not repeat in different seconds, and that the
1, the simplest way
Copy Code code as follows:
: .... Comment Content
Block
The input is redefined to the previous command, but: it is an empty command, so it is equivalent to a comment.If a command with an inverted
In the process of doing keyword cleaning, you need to filter out a class of words that do not conform to the end of a word, the idea is to put this batch of words according to the last word sort, so think of the first of these words to reverse, such
Learn to use shell analysis log only one morning!!!
Many places to share the log analysis of the shell script, but basically did not say the specific meaning of each command, learning cost is very high, summed up here, to facilitate the quick start.
Copy Code code as follows:
#!/bin/bash
function Pinghost {
Ping $1-c 1-w |grep rtt|cut-d "/"-f6
}
Tmp_fifofile= "/tmp/$.fifo" # script runs the current process ID number as filename
Mkfifo $tmp _fifofile # Create a new random FIFO pipeline
Sometimes when we process and view files, there are often a lot of empty lines, in order to be beautiful or need, it is necessary to remove these lines, the following methods:
1) with the TR command
Copy Code code as follows:
Cat
One of my colleagues once asked me this question: how do I delete all files in the directory except some files under Linux? At the time, I told him that he could solve it by pattern matching. But in fact, besides, there are other methods, which are
Verifying IP address legality using the shell
How to use:
Copy Code code as follows:
[Root@yang python]# bash check_ip.sh IP address
Execution Result: The return value of 0 checksum is valid, not 0 illegal.
Shell code:
Copy
The Linux terminal executes to delete the invalid link file.
Copy Code code as follows:
#!/bin/sh
Usage (){echo "Removebroken 0.1, a shell script to remove broken link files."echo "License:mit, (c) Chenzhiqiang"echo "Usage:"echo "$--
Copy Code code as follows:
#!/bin/bash
Path=/bin:/sbin:/usr/bin:/usr/sbin
Export PATH
I=1
While [$i-lt] #硬盘数量, 12 blocks apart from the system disk
Todo
J= ' echo $i |awk ' {printf '%c ', 97+ $i} ' #系统盘是sda, if the other needs to modify
First Use W to view the current logged-in user, run the W command is the current user, need to keep, other all kicked off.
Method One, the traditional way to find the names of other terminals, and then find the response process to kill
Copy
Linux how to count the current directory under the number of files, and how many directories?
Write a script with the shell below, put it in the current directory, and execute it.
Copy Code code as follows:
#!/bin/bash
#脚本名称
One line can be done, output 32 or 64.You can use "getconf word_bit" and "getconf long_bit" to get the number of digits for WORD and LONG, and 32 and 64 for 64-bit systems respectively.The reference code is as follows:
Copy Code code as
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.