Showing posts from June 13, 2011

Ubuntu General Tips - 1

I have been using Ubuntu for almost two years and having faced few issues, I planned to write a series on the steps I followed to resolve it.
1. Append date into to log in Ubuntu:
When we use commands in log, we write the output to some file, that will make debugging easier. Say for instance, we run an ant script and want to write the log to a file. In normal case, we would give the following command,
ant command > filename
But in cases where we need to take periodic backup or log the output, its better to append date with the log. You can assign the date to the log dynamically using the date property  of Ubuntu. The Syntax for appending/setting date to a log dynamically is by using  `date +"%F"`
Eg., When you want to take backup of postgres database daily, you can use this command in the terminal.
[sourcecode] pg_dump -U postgres databasename  > bkp-`date +"%F"`.out [/sourcecode]2. Command to Compress and Extract files in Ubuntu:
Compress and Decompress using…