Extract The First Two Layers Of Zip Files

If you have a few zip files in a folder, and the zip file had compressed some child zips, the following shell script can help you to extract them. The compressed information in our example look like: Shell script: #! /usr/bin/bash # find zips in current path files=() find . Read more…

Shell Script – Rename Files’ Suffixes Recursively And Find Folders

Rename Files’ Suffixes Recursively And Find Folders Find Folders To find all folders in the current path, I wrote a simple shell script file. It ignores invisible folder which path looks like ./.XXX. #! /usr/bin/bash dirs=() find . -type d -print0 >tmpfile while IFS= read -r -d ‘\0’; do dirs+=(“REPLY”) Read more…

Shell Script – Rename Files’ Suffixes One By One

The following shell script is used to rename the files suffix at the current directory. After giving it the executable permission, we can use it like Code snippet: Result:

Shell Script – Rename Files One By One

The following shell script is used to rename the files at the current directory. After giving it the executable permission, we can use it like Code snippet: Result:

PHP exec return error code 127

I always get the error code 127 from my web application. I didn’t figure it out because it’s successful to run the program in the shell environment. The core logic in the calling function is like the following code snippet.

Use NC To Create TCP/UDP Connection On Shell

We often use TCP and UDP connections in Internet communication. TCP (Transmission Control Protocol) is connection-oriented, it tracks all data sent. By contrast, UDP (User Datagram Protocol) doesn’t care about datagrams it sent, all information is no sequencing. In other words, UDP is unreliable. Both socket technologies can be used Read more…

Shell

Preparation Knowledge SSH is a very useful tool which supports to use all kinds of commands to control remote computer for developers. Before interacting with the server, users are required to login with a username and password to be certified. But it’s inconvenient for us to input password every time Read more…

Shell Script Practice Set 1

notes ${} 和$[] $[expression] can calculate easily.${expression} can tell us the value of a element in array. eg val1=23 val2=24 echo val1+val2 echo [val1+val2] #it is equal to echo(( val1+val2 ) [[email protected] workspace]$./incalc.sh 23+24 47 assign values to array. array=(echo {1..10}) echo {array[0]}” “{array[9]} [[email protected] workspace]$ ./array.sh Read more…

Shell – Use SHA To Check File Or Text String

SHA is a series of encrypting algorithm which includes sha1, sha256, sha512 and so on. They calculate a checksum based on a file or text string. We can use the result to judge whether two objects are the same. There is a terminal tool called shasum on Unix style operating Read more…

MP4 To GIF