Q

Two Linux and Unix commands you might not know you need

For Brad Casey, the usefulness of Linux and Unix commands is in the eye of the beholder, but here are a couple hidden gems admins might not know.

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

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.
brad1505@hotmail.com

This was first published in April 2013

Dig deeper on Linux servers

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

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:

SearchWindowsServer

SearchEnterpriseLinux

SearchServerVirtualization

SearchCloudComputing

Close