Useful Commands for Linux Users – Episode 6

Using the command-line in your everyday activities more than the GUI sometimes shows the geek you are. If you haven’t read the Episode 5 of this tutorial, here it is.

Here is another useful commands that will help you to make good use of the terminal.

Command execution time

The command below prints out the duration or how long a command takes before it is executed:

time <command>

time-ls-unixmen

Display processing tree

This is helpful to display the process tree:

pstree -p 

$pstree-p

Change all file names to lowercase

This command changes file names containing capitals to lowercase in current directory, it really good for renaming images from a digital camera which contains Uppercase, lowercase and numbers to lowercase and numbers only.

rename 'y/A-Z/a-z/' *

rename-lowercase-unixmen

Viewing installed packages

This command enables you to view packages installed on your computer:

dpkg --get-selections

installed-packages

Listing hardware connected to ports

Hardware connected to USB ports:

lsusb

$lsusb

Also, for PCI:

lspci

Listing empty files and directories

With this command, you can find all empty files and directory in your current directory:

find  -empty

find-empty-files

For empty files in the home directory from your present working directory use:

find ~ -empty

Linux distribution info

This prints information about the Linux distribution you are using:

lsb_release -a

$lsb_release-a

Let terminal guess commands 

Some commands are very difficult to recall in certain situations , thus the apropos command prints possible commands relating to a specific text and what they do:

apropos <text>

apropos

Clearing Terminal

Don’t be worried about this command. Everyone knows about it. Simple:

clear

But a simpler and faster way of doing this is to do this:

CTRL + L