Question: How do I find out what time I executed a command previously on Unix OS? The history command doesn’t display timestamp. Answer: Set HISTTIMEFORMAT as shown below. Please note that there is a space before the last single-quotes. $ export HISTTIMEFORMAT='%F %T ' After the above setting, history command will display timestamp in front [...]
Linux
Question: I would like to understand the basics of how to write and execute a ruby program on Linux OS. Can you explain it with a simple example? Answer: In this article, let us review very quickly how to write a basic Hello World ruby program and execute *.rb program on Linux or Unix OS. [...]
This article is part of on-going Unix Sed Tutorial series. In previous articles, we discussed about sed print operation and sed delete operation. In this article let us review how to use sed substitute command “s”. The `s’ command is probably the most important in `sed’ and has a lot of different options. The `s’ [...]
wget utility is the best option to download files from internet. wget can pretty much handle all complex download situations including large file downloads, recursive downloads, non-interactive downloads, multiple file downloads etc., In this article let us review how to use wget for various download scenarios using 15 awesome wget examples. 1. Download Single File [...]
Question: How do I Install Java on Ubuntu or Debian OS? Answer: If Java is not installed, you’ll get the following error message when you do java -version. # java -version The program 'java' can be found in the following packages: * gij-4.3 * java-gcj-compat-headless * openjdk-6-jre-headless * cacao * gij-4.2 * jamvm * kaffe [...]
Question: I’m unable to do su – on Ubuntu. It says “su: Authentication failure”. How do I fix it? Also, is it possible for me to login to Ubuntu using root account directly? Answer: Let us address these two question one by one. Warning: Enabling root is not recommended. If possible, you should always try [...]
Question: I would like to understand the basics of how to write and execute Perl program on Linux OS. Can you explain it with a simple example? Answer: In this article, let us review very quickly how to write a basic Hello World Perl program and execute *.pl program on Linux or Unix OS. 1. [...]
In the previous sed tutorial we discussed about Unix sed command basics and printing lines from a file using sed address and patterns. In this article, let us review how to delete lines from a file using address and patterns with 8 awesome examples. “p” command prints the buffer (remember to use -n option with [...]