Unix time to human readable format

Some log files such as squid log uses uses Unix time as timestamp, which looks like some random number generated number. To convert to human readable format, eg in yyyy-mm-dd hh:mm:ss format, run the following Unix command: echo <timestamp> | awk ‘{ print strftime(“%Y-%m-%d %H:%M:%S”, $1); }’ Replace <timestamp> with the unix timestamp. the format for strftime…

Continue Reading »

Linux Version

To find out the Ubuntu version the server is running, the information can be found in file /etc/issue. Alternatively, run this command: lsb_release -a To find out the kernel version, run this command: uname -a These commands are probably applicable to other linux builds.

Ubuntu server: Setup website

Copy files to destined directory. Go to /etc/apache2/sites-availabe, edit the ’site’ file. The default is ‘default‘. If creating a new site file, after creating and editing the file, run sudo a2ensite file. To disable the site, run sudo a2dissite file. After the site file is edited and saved. Run sudo service apache2 restart. Now use…

Continue Reading »

Convert file format for DOS and Unix

Most of my development works are done on Linux/Unix. I use / evaluate a lot of open source projects and some files has ^M when edited from this platform. This is because the file was saved in dos format which uses a different EOL (end of line character). To overcome this problem, just run this simple…

Continue Reading »