Tasks on Command Line – Simple as Pie

 Command Line, Products  Comments Off on Tasks on Command Line – Simple as Pie
Apr 242015

Newton, Galileo, Dante and Shakespeare never used todo lists or notes apps to accomplish great feats.

Stalin and Hitler killed tens of millions without a single todo or notes app.

But lesser mortals, these days, it seems can’t function without a collection of notes apps or todo lists on their PCs and mobile devices to get through the day.

And if these apps are not cloud-powered to enable synchronization of the notes and todo lists across devices, the collective wrath of users descends on the hapless developer.

Such are the unusual times we live in!

Although I’m as guilty as the next Joe in hoarding notes and todo apps on my PC, tablet and smartphone, I’ve never been an intensive user of any of these apps. On the Mac, I use the free versions of Evernote and Eisenpower and on my Linux desktop my preferences are Task Coach and CherryTree.

If you ask me, there’s nothing you can’t accomplish by jotting down tasks on an index card. Nabokov famously wrote his masterpieces on index cards.

But lately I’ve been drawn to a todo utility called task.

A big plus of task for Linux administrators who live and breathe on the command line is that it’s convenient since you don’t have to go outside the command line and open an application to get to your todo list.

You see, task works essentially on the command line.

Installing Task

Task is available for both CentOS 7 (RedHat and Fedora) and Ubuntu (LinuxMint 17) distributions.

The latest version of task for Ubuntu is 2.2.0-3 and for CentOS it’s 2.4.2.

If you’re running Fedora, CentOS or RedHat, use yum to install task.

$ sudo yum install task

If you’re on an Ubuntu system, go with the below command.

$ sudo apt-get install task

How Task Works

The beauty of task lies in its simplicity. Continue reading »

 Posted by at 8:27 pm

How to Check Memory Use by Applications

 Command Line, Linux  Comments Off on How to Check Memory Use by Applications
Apr 232015

Once in a while I run into a situation where I feel one of the work computers running Linux (of course) might be running slow.

The first thing I check is the memory installed and utilized through the use of free -m command.

The Free command is not perfect but good enough.

thomas@workpc ~ $ free -m
             total       used       free     shared    buffers     cached
Mem:          4798       1701       3097        147         70       1147
-/+ buffers/cache:        483       4315
Swap:         3930          0       3930

The data column under free in the second line is what you should look for.

With 4.31GB “free” under that column, no issues there!

Applications & Memory Use

Next, I look at applications that are drawing the most memory.

To check memory used by various applications, a plethora of options are available on the command line.

You can check memory use by all applications and processes or examine just the memory used by the top-5, top-10 or top-20 applications.

Here are a few commands to help you quickly check memory used by different applications. I have tested them on LinuxMint 17 but they should work on other Linux distros too.

1. Memory, CPU & others

The below command is one of my favorites because besides memory, it also provides CPU use and the PID (process ID).

$ ps -eo pmem,pid,pcpu,rss,vsz,time,args | sort -k 1 -r

2. Top 20 Processes
If you’re looking for memory use by the top 20 processes, go with the below command.

Unlike some of the other commands, this one will give you only memory use and percentage.

$ ps aux | awk '{print $2, $4, $11}' | sort -k2rn | head -n 20

3. Top 10 Processes
Now if you’re looking for memory use by the top 10 processes, run either of the below commands.

ps aux | awk '{print $2, $4, $11}' | sort -k2rn | head -n 10


$ ps aux --sort=-%mem | awk 'NR<=10{print $0}'

4. Top 5 Processes
If you’re looking for memory use by just the top five processes, issue the below command in the terminal.

$ ps -eo pmem,pcpu,vsize,pid,cmd | sort -k 1 -nr | head -5

5. Top is Tops
For a lot of folks, the top command is tops when it comes to checking memory and other parameters of their computer.

Run top
Once inside top, press m

A big plus is that top comes installed with every Linux computer.

6. Htop Tops Top

Lately, htop, a gussied up, ‘colored’ version of top, has drawn a lot of defectors from top.

$ htop

On Debian (or its spawns like Ubuntu and Linux Mint you can install htop easily:

$ sudo apt-get install htop

Go ahead and try out these commands on your Linux system and see which of your applications is grabbing the most memory.

 Posted by at 9:58 pm

Strong Passwords – First Line of Defense

 Security  Comments Off on Strong Passwords – First Line of Defense
Apr 232015

In the current dangerous era of relentless hacking, the first line of defense for any computer or network is the password.

You just can’t afford to make a mistake with password management.

If you mess up on using a strong password, all is lost.

Passwords to Avoid

Here are some tips on how to avoid making some common mistakes when it comes to the password.

1. Never use a password of less than 12 characters.

The shorter the password the easier it is to crack.

2. Avoid a single dictionary term for password creation even if they are complicated words like prestidigitator.

The single word rule applies to both English and foreign terms.

As a native English speaker, you may think foreign words like leibchen, dummkopf or dilwale sound cute and unique.

But don’t forget your “cute and unique” words are familiar to millions of Germans (the first two words) and hundreds of millions of Indians (last word).

3. Do not use even the reverse of dictionary words.

Password cracking tools like John the Ripper will make mincemeat of dictionary passwords or its reverse in a matter of seconds.

4. Never ever use personal information like Social Security Numbers, TAX ID numbers, birthdays, names, anniversaries, family members’ names, pet names, names of famous personalities like Angelina Jolie, George Clooney or George Washington or a school name.

Don’t even think of using Julia Roberts or Amitabh Bachchan in reverse.

5. Refrain from using sequence of keys on the PC’s keyboard layout.

If your password is asdfghjkl;’ or qwertyuiop[], change it immediately and then call your health insurance company to check if your policy covers psychiatric treatment. 😉

6. Never use the same password on multiple machines.

By using different passwords, even if one of your servers or computers is compromised the other machines are still secure.

7. And above all, do not fall prey to the temptation of writing down passwords.

You’ll invariably lose it and the piece of paper will fall into the hands of nasty elements.

What is a Strong Password?

Ideally, a strong password will be a combination of uppercase and lowercase letters, digits and special characters.

Security experts recommend a high entropy value for passwords.

So what the heck is entropy?

Represented in bits, entropy is the uncertainty level associated with a random variable. Higher the entropy of your password, the stronger it will be.

So a password with an entropy value of 128 will be more secure than one with a value of 56.

A password of less than 10 bits of entropy is not advisable.

Those who spend considerable time on security matters say a good idea for a password is to use a passphrase (a combination of multiple words that you can remember).

So 2%Kennedy 36DMonroe MafiaY? Bobby2? might not be a bad passphrase/password.

Use Password Generator

If for some reason you can’t come up with a strong enough password, use the password generator in your Linux system.

I occasionally use the command line utility pwmake, which comes with CentOS 7, RedHat 7 and Fedora 21.

If you’re using Ubuntu or Linux Mint, you can get pwmake by installing libqualitytools.

A big plus with pwmake is that you can specify the desired entropy.

For a home computer, an entropy of 12 is not a bad deal.

$ pwmake 12

But in businesses or government organizations, you definitely want a tougher password and must therefore opt for higher entropy of at least 58.

$ pwmake 56

I’d recommend an entropy of 128 for large commercial establishments and government agencies.

$ pwmake 128

RedHat 7 and CentOS 7 use the pam_pwquality module to check a password’s strength against a set of rules.

Also, use the pmquality.conf module in the etc/security folder to configure password requirements. Continue reading »

 Posted by at 9:02 pm

10 Crucial Yum Commands for CentOS 7

 Command Line, Linux  Comments Off on 10 Crucial Yum Commands for CentOS 7
Apr 222015

Yum (Yellowdog Updater, Modified) is at the core of the CentOSRed Hat and Fedora package management systems.

On Linux distros like CentOS 7, RedHat 7 or Fedora 21, if you want to update, install or remove packages, list installed packages or update the entire system while at the same time ensuring automatic dependency resolution then the command line tool you must deploy is yum.

Yum also comes in handy while enabling or disabling repositories (package sources).

To update, install or remove packages via yum, you must have superuser privileges (via su or sudo).

Now let’s take a look at some of the key Yum commands you ought to be familiar for CentOS 7.

1. Check for Updates

$ yum check-update

The above command only checks for and lists available updates but it will not install them.

There’s no need to be logged in as a superuser to check for available updates.

2. Update a Single Package

More often not, you’ll be required to update only a single package, not all the packages.

Use the below command if you wish to update just a single package and you know its name.

$ yum update package_name

3. Update All Packages

If you intend to update all packages along with their dependencies, go with either of the below commands.

$ yum update


$ yum upgrade

I usually go with yum update if I’m updating multiple packages.

4. Search Packages

You can check enabled repositories for packages you wish to install on your CentOS 7 or RedHat 7 system.

There’s no need to know the name of the package during the search.

Let’s say you heard about a good RSS package but forgot its name. So just use rss in the search string.

$ yum search search_string

Search Multiple Packages
Yum lets you search for multiple packages simultaneously.

In the below example, I’m searching for the Cherrytree notes app and the Quiterss RSS reader. Continue reading »

 Posted by at 11:09 am