In the following example, If you want to repeat the command #4, execute !4 as shown below.
[continue reading…]

Sometime you may end up repeating the previous commands for various reasons. Following are the 4 different ways to repeat the last executed command.
[continue reading…]

I strongly believe that this may be your most frequently used feature of history. When you’ve already executed a very long command, you can simply search history using a keyword and re-execute the same command without having to type it fully. Press Control+R and type the keyword.
[continue reading…]

Typically when you type history from command line, it displays the command# and the command. For auditing purpose, it may be beneficial to display the timestamp along with the command as shown below.
[continue reading…]

How to use gzip with tar?

Add option z to the tar command when dealing with tar.gz compressed file.
[continue reading…]

tar command (tape archive) is used to convert a group of files into an archive.
[continue reading…]

Sometime you may want to validate a zip archive without extracting it. To test the validity of the zip file, pass option –t as shown below.
[continue reading…]

Pass the option –P to the zip command to assign a password to the zip file.
[continue reading…]

There are 10 levels of compression provided by zip command.

  • Level 0 is the lowest level, where it just archives the file without any compression.
  • Level 1 will perform little compression. But, will be very fast.
  • Level 6 is the default level of compression.
  • Level 9 is the maximum compression. This will be slower when compared to default level. In my opinion, unless you are compressing a huge file, you should always use level 9.

[continue reading…]

How to zip multiple files?

syntax: zip {.zip file-name} {file-names}

[continue reading…]