Two-way conversion of Unix time (seconds since 1970) and regular time

I found using of Unix time to be very useful in various shell scripts and here are two simple commands to convert Unix/Linux date command to Unix time format and back to regular formating: To convert Unix time to simple (regular) time please use: date -u –date=”1970-01-01 1187769064 sec GMT” where 1187769064 is input Unix time. The output will be: Wed Aug 22 07:51:04 UTC 2007 To get Unix time […]

Read more →

 

Find out where Unix/Linux executable binary is located

There are two commands that may help you to find where executable binary is located regardless it’s Unix or Linux system. They are whereis and type. First locates source/binary and manuals sections for specified files and second tells what exactly shell executes when you type a certain command. The next picture shows examples of these commands work.

Read more →

 

Can’t find usable shell script encryption solution…

It sounds a bit cheesy but I can’t find any usable solution on how to encrypt Linux/Unix shell script in order to protect it’s source code when it’s still executable. There was a post here about how to protect shell scripts, but I found SHC bug. Just run script that is encrypted with shc and execute command ps ax and you’ll see full source code at ps‘s output (newline characters […]

Read more →

 

One more way to count CPUs in Linux

Here is one more way to find out how many CPUs are used by Linux: cat /proc/cpuinfo | grep “^vendor_id” | wc -l As for me I use this way to make sure that SMP kernel should be installed. You’re welcome to suggest your ways of doing the same in comments. Thank you in advance!

Read more →

 

Automatic "zombie" processes killing (shell script)

Here is a shell script example that can be run by cron for automatic killing of “zombie” processes in Linux system: zombies.sh

Read more →