I have put together a few Linux commands and utilities which may interest CLI enthusiasts, while being useful to systems administrators and power users. Here is a list and a brief description of each of these.
A reminder
A simple reminder can be created by combining the at and the xmessage commands. The at command can be used to schedule a command to be run once, at a particular time. Type the command at the prompt with the time as an option. The command then displays its prompt, where the commands to be run can be typed, one per line. Ctrl-D should be used to close the prompt.
The xmessage command displays a simple dialogue box with a message. This can be combined with the at command to set reminders. The message can be from the command line, a file or even the standard input. The user can click on one of the buttons in the dialogue box to close the box. This can also be used to display multiple options to the user and to accept the users choice.
$at 6 pm at>xmessage Time for the meeting Ctrl-D
The leave command
The leave command can be used as a simple reminder. It accepts time in the hh-mm format, where hh is in hours and mm is in minutes, in the 12-hour format, whatever be the time given. It keeps displaying a message in the terminal from which the leave command was given. The reminder is given 5 minutes before the actual time, 1 minute before the time, at the time mentioned in the command and every minute after that, until the user logs out. It prompts users to fill in the time if no argument is given as part of the command. To remind you to leave at 5 pm, you have to give the following command:
$leave 1700
The ranger utility
The ranger utility is a text based file manager, written in Python, and it uses the ncurses library to provide an interface for the file system. The user interface is minimalistic and the navigation is very easy. It is available in most of the popular Linux distributions.
The utility can be installed in an Ubuntu system by the following command at the prompt:
$sudo apt-get install ranger
The file system can be navigated with this utility. It displays a three-column layout, with the left pane showing the current directorys parent directory, the middle column showing the current directory and the third pane showing a preview of the file. Many of the key bindings are the same as in the vi editor. The file system can be quickly navigated by using the keyboard, with the left (arrow) key used for going to the parent directory, the right (arrow) key to enter the selected directory, and up and down arrow keys used to browse the current directory.
The column at the right extreme displays a preview of the file. The default programs are used to display files. The less utility is used to display a text file, zipped files are uncompressed and displayed, the PDF files are displayed as text files and the image files are displayed using coloured ASCII art, though the clarity may not be good.
Ranger also includes a command interface, which helps you execute commands and manipulate files from within it. Several other options and features can be found by using the man command or from online sources.
The multitail command
The multitail command is far better compared to the tail command for monitoring files. It allows the administrator to monitor multiple files and is particularly useful for monitoring the log files. One additional feature is that it allows you to monitor the output of command(s) as well. Written using ncurses, it creates multiple windows for monitoring the files and works in most of the popular Linux distributions.
The utility can be installed in an Ubuntu system by the following command at the prompt:
$sudo apt-get install multitail
The syntax for multitail is as follows:
$multitail /var/log/squid/access.log /var/log/messages
You can have the two files displayed in two columns with the -s option, as follows:
$multitail -s 2 /var/log/squid/access.log /var/log/messages
You can easily monitor more than three files with this command by adding more file names in the command.
It allows you to view two different files in different colours with the ci option. The -I option can be used to merge the output of the two files.
$multitail -ci blue /var/log/squid/access.log -ci red -I /var/log/messages
The command is also interactive and allows you to scroll through the files, and choose a file to view from the list of open files by typing b.
You can view the outputs of the commands instead of a file with the -l option.
multitail /var/log/squid3/access.log -l ping 192.168.3.100 -l ping 192.168.3.70
You can even use a wild card for a file name. The most recent file matching the wild card is opened, and the moment this is done, the lines of the new files are displayed instead of the lines of the older file. There are numerous other options and features that users can refer to in the manual.
Saidar: Yet another system monitoring tool
Saidar is a simple, lightweight, curses based monitoring tool which may be useful for systems administrators. It uses the libstatsgrab library to access key parameters of the system. It gives brief information and statistics of the system including the hostname, uptime, CPU usage, processes, RAM, swap area, free space, disk usage, network traffic, disk I/O, etc. The information gets refreshed after a default delay time of 3 seconds. The -c option can be used to display the key values in the output in colour.
The tool can be installed by the apt-get command in an Ubuntu system.
The cleanlinks command
The cleanlinks command searches under the current directory for dangling symbolic links and deletes them. It then removes the empty directories recursively in the currently working directory.
To use the command, make the directory from which you want to remove the empty directories as the current directory and then use the following command:
$cleanlinks
The compgen command
Giving the compgen command will result in all the available commands in the Linux system being listed. The command is:
$compgen -c