Two Linux and Unix commands you might not know you need

What are some lesser known, but highly useful Linux and Unix commands, and what do they do?

Requires Free Membership to View

Throughout my time as a system administrator, I've noticed that a handful of commands are utilized disproportionately regularly, compared to the total number of commands available to the Linux administrator. For example, chmod, ls, mkdir and |more are a few commands that the typical Linux administrator would be hard pressed to not invoke during the execution of his daily duties. In terms of "lesser known, but highly useful" commands, I would argue that these are really specific to every admin's situation. So I can really only speak to a couple of commands that come to mind:

watch -n1 --difference "echo "Uptime"; uptime; echo \n ; ps -eo pcpu,pid,args | sort -k 1 -r |grep -v watch | head -10; echo "\n" ; tail /var/log/cron| grep check_load"

This command allows the system administrator to conduct real time monitoring of the local system within the command line. The output is similar to what the Windows administrator would see within the Task Manager. So the focus within this command revolves around the percentage of CPU an application is consuming, the application's process ID and the command utilized to invoke the application.

history|awk '{print $2}' |awk '{print $1}' | sort | uniq -c | sort -rn | head -10

This command allows the system administrator to view the most used commands on whatever machine he is on at the time of use. There are similar commands that allow the administrator to view the most utilized commands over an entire network, but I prefer to focus on this command because this allows the administrator to log in to his assigned box and view what commands have been utilized on that specific box. If the administrator notices any anomalies, he can infer that someone else was executing commands from his computer.

About the author:

Brad Casey is an expert on network security with experience in penetration testing, public key infrastructure, VoIP and network packet analysis. He also covers system administration, Active Directory and Windows Server 2008, with interest in Linux virtualization and Wireshark captures. He spent five years in security assessment testing for the U.S. Air Force.

This was first published in April 2013

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: