≡ Menu

Command Line Tips and Hacks

Command line tricks, tools, tips and hacks to help you get the most out of the shell prompt in Linux, *BSD, Apple OS X and Unix like operating systems ( rss feed ) .

How to use parallel ssh (PSSH) for executing ssh in parallel on a number of Linux/Unix/BSD servers

Recently I come across a nice little nifty tool called pssh to run a single command on multiple Linux / UNIX / BSD servers. You can easily increase your productivy with this SSH tool.

More about pssh

pssh is a command line tool for executing ssh in parallel on some hosts. It provides specialties includes:

  1. Sending input to all of the processes
  2. Inputting a password to ssh
  3. Saving output to files
  4. IT/sysadmin taks automation such as patching servers
  5. Timing out and more

Let us see how to install and use pssh on Linux and Unix-like system.


How to protects Linux and Unix machines from accidental shutdowns/reboots with molly-guard

Oops! I did it again. I thought I was logged into my home server. Turns out I rebooted the db server. Another my not so favorite is typing "shutdown -h 0" into the wrong terminal. I know a few people who have admitted to doing that here.

My anger that can't be contained
Is there any end to the madness? Do I need to suffer from accidentally random reboots and shutdowns? After all, it is human nature to make mistakes, but one should not keep on making the same mistakes again and again.

Linux / Unix Desktop Fun: Christmas Tree For Your Terminal

Let us create Linux or Unix console Christmas tree just for fun and profit. First, you need to install a Perl module called Acme::POE::Tree. It is an animated Christmas tree module. I've tested this on Linux, OS X and Unix-like system.

15 Useful Linux and Unix Tape Managements Commands For Sysadmins

Tape devices should be used on a regular basis only for archiving files or for transferring data from one server to another. Usually, tape devices are all hooked up to Unix boxes, and controlled with mt or mtx. In this tutorial you will learn about:

  • Tape device names
  • Basic commands to manage tape drive
  • Basic backup and restore commands

Display Awesome Linux Logo With Basic Hardware Info Using screenfetch and linux_logo Tools

Do you want to display a super cool logo of your Linux distribution along with basic hardware information? Look no further try awesome screenfetch and linux_logo utilities.

Linux Server See the Historical and Statistical Uptime of System With tuptime Utility

You can use the following tools to see how long system has been running on a Linux or Unix-like system:

  • uptime : Tell how long the server has been running.
  • lastt : Show the reboot and shutdown time.
  • tuptime : Report the historical and statistical running time of system, keeping it between restarts. Like uptime command but with more interesting output.

Collecting Ubuntu Linux System Information

For new computer or Laptop or server, I need to collect the information about its hardware. This is also useful when you need to replace a disk or memory with a vendor. In order to replace hardware you need all information in advance. In this post, I'm going to list commands that you can use to collect the hardware information.
Ubuntu Linux Server Collecting System Information

Learning bash scripting for beginners

Bash (Bourne-Again SHell) is a Linux and Unix-like system shell or command language interpreter. It is a default shell on many operating systems including Linux and Apple MacOS X. Shell scripts are a fundamental part of the Unix programming environment.

If you have always used a graphic user interface like KDE or Gnome or MS-Windows or Apple OS X, you are likely to find bash shell confusing. If you spend some time with the bash shell prompt and it will be difficult for you to go back.

Learn bash

Here are a list of tutorials and helpful resources to help you learn bash scripting and bash shell itself. You should read the following documents if you are interested in learning the basics of shell scripting.

A Shell Primer: Master Your Linux, OS X, Unix Shell Environment

On a Linux or Unix-like systems each user and process runs in a specific environment. An environment includes variables, settings, aliases, functions and more. Following is a very brief introduction to some useful shell environment commands, including examples of how to use each command and setup your own environment to increase productivity in the command prompt.

20 Unix Command Line Tricks – Part I

Let us start new year with these Unix command line tricks to increase productivity at the Terminal. I have found them over the years and I'm now going to share with you.