How to get the CPU temperatur in command linux on Linux?

Posted on

Most modern servers or computers have sensors to detect the temperature of various components. On Linux, how to get the CPU core temperatur in command linux? First, make sure the package “lm-sensors” is installed on your Linux and the command sensors works for you. Then, you can use this piece of script to get the
Read more

How to exclude last N columns in Bash on Linux?

Posted on

How to exclude last N columns of a string in bash? The point is that the number of columns in each line is uncertain (but > N). For example, I would like to remove the last 2 columns separated by ‘.’ in the following lines. systemd.3.gz systemd.mount.3.gz systemd.mount.f.3.gz The simple cut command cut -d’.’ -f1
Read more

How to calculate the average of value in lines of a text file on Linux by a script?

Posted on

How to calculate the average of value in lines of a text file on Linux by a script? The file.txt is like: Run 0: Time used: 22.235331711 seconds. Run 1: Time used: 20.784491219 seconds. Run 2: Time used: 21.851638876 seconds. What I want it to calculate the average time. awk is handy for this purpose:
Read more

How to `cut` a String Using a String as the Delimiter in Bash?

Posted on

Is is possible to cut in Linux using a string as the delimiter? cut –delimiter=”delim” -f 1,3 cut reports: cut: the delimiter must be a single character The most closest solution that I find is using awk/gawk: awk -F ‘delim’ ‘{print $1; print $3}’ From the manual: -F fs –field-separator fs Use fs for the
Read more

svn: how to clean up my repository directory?

Posted on

I have a local svn repository. I work in the repository, e.g. compiling latex documents and building software packages, and there are many useless temporary files there. How can I clean it up by automatically clean these temporary files like the git clean -f in git? svn seems has no built-in function for this. But
Read more

Script: Checking Alive Servers from a Server List

Posted on

With a list of servers, it is common that one or more are down or crash. Lots cluster management tools can detect the aliveness of servers. However, it can be easily done with ping with a Bash script. I summarize the script that I used and share it here: check-alive-server.sh. Usage: usage: ./check-alive-server.sh file Each
Read more