OpenSource For You

TIPS & TRICKS

-

Listing the number of directorie­s owned by users To list the users that own the highest number of directorie­s on the filesystem, use the following command:

ls -l <path> | awk ‘{ print $3 }’ | sort | uniq -c | sort -n -r

—Vinit Khandagle, vinit.khandagle@gmail.com Making terminal keystrokes invisible while typing To make characters invisible in the terminal while typing from the keyboard, use the following command:

$stty -echo

To get back to the default option, type:

$stty echo

To clear the ‘history’ of your command, type:

$history -c

—Benedict Nicholas, benedictni­cholas@yahoo.com Search the possible man pages for your keyword If you want to know which command to use for a particular need of yours, just use a keyword to search the man pages for the commands related to this keyword. To search, you need to use the appropos command as shown below:

#apropos keywords

For example, if you want to know the commands for the keyword ‘search’, just type the following command to display these:

#apropos search

—Yakub Pasha Shaik, yakubpasha­sk@gmail.com

Check your mouse using cat!

Whenever you are confused about whether your mouse is working or not, you can check it with the help of the cat command in Linux. This is really handy while troublesho­oting a remote system using the terminal.

$sudo cat/dev/psaux

After issuing the command, move your mouse, and if you see characters floating on your screen, it indicates that your mouse is working.

—Jatin Dhankhar, dhankhar.jatin@gmail.com

Rename multiple files

To rename all files from a given directory, we can use the xargs command as shown below:

[bash]$ ls -1 | xargs -t -i mv {} {}.new_extention.

—Narendra Kangralkar, narendraka­ngralkar@gmail.com Disable the beeping sound in the bash terminal In Red Hat Linux 4 or 5, while working in the terminal mode, pressing TAB results in a beep. To stop this sound, follow the steps given below:

Open your /etc/inputrc file:

$ vi /etc/inputrc

Remove # to uncomment the following line:

set bell-style none Save and close the file. Now press TAB to auto complete a command and you will no longer hear any beep.

—Suresh Jagtap, smjagtap@gmail.com

Does your CPU support virtualisa­tion?

Here is a simple command that will confirm whether your computer’s CPU supports virtualisa­tion or not.

When you execute the following command… [root@server1 ~]# egrep ‘(vmx|svm)’ --color=always /proc/ cpuinfo

…the output will be something like what’s shown below: flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall

nx mmxext fxsr_opt rdtscp lm 3dnowext 3dnow pni cx16 lahf_lm cmp_legacy svm extapic cr8_legacy misalignss­e flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall

nx mmxext fxsr_opt rdtscp lm 3dnowext 3dnow pni cx16 lahf_lm cmp_legacy svm extapic cr8_legacy misalignss­e

[root@server1 ~]#

If nothing is displayed as an output of the command, your processor doesn’t support hardware virtualisa­tion.

—Suresh Jagtap, smjagtap@gmail.com

Find the factors of a number

To find the prime factor of a number, use the factor command. It is available in GNU/Linux by default.

Shown below is an example to illustrate how this command works.

[bash]$ factor 25

25: 5 5

[bash]$ factor 10241

10241: 7 7 11 19

—Narendra Kangralkar, narendraka­ngralkar@gmail.com Are you worried that a hidden app is stealing your Internet bandwidth? If you think that your Internet is too slow, or that your Internet provider app shows a lot of uploads and downloads that you are not doing knowingly, you might like to know which applicatio­ns are eating up the bandwidth in your system.

Nethogs is a utility that will help you to get informatio­n on who or what is using the bandwidth. You need to install it if it’s not already installed on your system. Use your distributi­on package manager to install it. On Ubuntu, you can install it using the following command:

sudo apt-get install nethogs

This utility shows bandwidth usage process wise, instead of per protocol or per subnet. This is what an end user like me would like to know.

So run the following command to check if any other process other than your browser is using the bandwidth:

sudo nethogs ppp0 <ENTER>

In place of ppp0, give the interface name that is connected to the Internet.

The output will look like what’s shown below:

 ??  ??
 ??  ??
 ??  ??
 ??  ??
 ??  ??
 ??  ??
 ??  ??
 ??  ??
 ??  ??
 ??  ??

Newspapers in English

Newspapers from India