How to find out all files with replication factor 1 in HDFS?

Posted on

How to find out all files with replication factor 1 in HDFS? The hdfs dfsadmin -report shows there are blocks with replication factor 1: Missing blocks (with replication factor 1): 7 How to find them out? You can run hdfs fsck to list all files with their replication counts and grep those with replication factor
Read more

How to change the maximum uploading size for PHP with Apache on Linux?

Posted on

How to change the maximum uploading size for PHP with Apache on Linux? PHP has parameters to control the maximum uploading size. Here, we use Ubuntu 18.04 LTS default version as an example. First, open the php.ini configuration file using your favorite editor /etc/php/7.2/apache2/php.ini Then, find the following parts ; Maximum size of POST data
Read more

How to add a prefix string at the beginning of each line in Bash shell script on Linux?

Posted on

How to add a prefix string at the beginning of each line in Bash shell script on Linux? For example, assume we have a file a.txt: line 1 line 2 I want to have, pre line 1 pre line 2 You may use sed, the stream editor for filtering and transforming text: sed -e ‘s/^/pre
Read more

How to detect whether a file is being written by any other process in Linux?

Posted on

How to detect whether a file is being written by any other process in Linux? Before a program open a file to processes it, it wants to ensure no other processes are writing to it. Here, we are sure after the files are written and closed, they will not be written any more. Hence, one-time
Read more

How to make CentOS Linux to load a module automatically at boot time?

Posted on

How to make CentOS Linux to load a module, say ixgbe, automatically at boot time? I am using CentOS 7. You can create a text file <some name>.conf in the /etc/modules-load.d/ and list the modules to be loaded there, one per line. The systemd-modules-load.service daemon will read these files and load the modules. Check more
Read more

How to get the highest temperature from all sensors in a server on Linux?

Posted on

It is useful to monitor a server node’s temporary. Among all the sensors’ temperatures, the higher one may be a very important one. How to get the highest temperature from all sensors in a server on Linux? You can use this command to get the the highest temperature from all sensors in a server on
Read more

WPS’ wpp program reports “libbz2.so.1.0: cannot open shared object file” on CentOS 7

Posted on

WPS’ wpp program reports “libbz2.so.1.0: cannot open shared object file” on CentOS 7 as follows: $ wpp /opt/kingsoft/wps-office/office6/wpp: error while loading shared libraries: libbz2.so.1.0: cannot open shared object file: No such file or directory The reason: wpp will tries to dynamically link ‘libbz2.so.1.0’ $ ldd /opt/kingsoft/wps-office/office6/wpp | grep libbz2 libbz2.so.1.0 => not found libbz2.so.1 =>
Read more

Killing Running Bash Script Process Itself and All Child Processes In Linux

Posted on

In Linux, how to kill a process and all its child processes? For example, a Bash script A starts B, B starts C and C calls rsync. I would like to kill A and all its child processes all together. How to do this? There are possibly many answers to this question. One of the
Read more

How to get the running process’ parent process’ ID in Python?

Posted on

How to get the running process’ parent process’ ID in Python? In Python, you can get the parent process’ pid by calling os.getppid(): import os ppid = os.getppid() One example: The shell’s pid: $ echo $$ 21779 Start a python REPL and get its parent pid (the shell’s): $ python Python 2.7.5 (default, Nov 6
Read more

How to get the running process’ parent process’ ID in C / C++?

Posted on

How to get the running process’ parent process’ ID in C / C++? In C and C++, you can call the getppid() library function which is a function from the POSIX library. #include <sys/types.h> #include <unistd.h> pid_t getppid(void); getppid() returns the process ID of the parent of the calling process. Example usage: getppid.c #include <stdio.h>
Read more

Getting Process Own Pid in C and C++

Posted on

How to get the running process’ pid in C / C++? In C and C++, you can call the getpid() library function which is a function from the POSIX library. #include <sys/types.h> #include <unistd.h> pid_t getpid(void); getppid() returns the process ID of the calling process. An example C program to get self process ID getpid.c:
Read more