Featured »

March 2, 2022 – 2:00 pm

Books have been written on the subject of awk and sed. Here’s a small sample of commands I put together over the years that are useful for everyday system administration tasks. Most of these tasks …

Read the full story »
Networking

Unix and Linux network configuration. Multiple network interfaces. Bridged NICs. High-availability network configurations.

Applications

Reviews of latest Unix and Linux software. Helpful tips for application support admins. Automating application support.

Data

Disk partitioning, filesystems, directories, and files. Volume management, logical volumes, HA filesystems. Backups and disaster recovery.

Monitoring

Distributed server monitoring. Server performance and capacity planning. Monitoring applications, network status and user activity.

Commands & Shells

Cool Unix shell commands and options. Command-line tools and application. Things every Unix sysadmin needs to know.

Home » Archive by Category

Articles in Commands & Shells

Force NTP Time Update on Linux

February 21, 2011 – 8:36 pm
time clock watch

Imagine this: you created the /etc/ntp.conf file, enabled and started the ntpd service, and… the system time is still off. Is there a way to force time sync with the NTP server? It must be your lucky day. All you have to do is to connect to your box as root and run the following command…

Find Command with Multiple Exec Statements

February 10, 2011 – 12:32 am
shell_001

This is a very simple one, but somehow I always forget the correct syntax. I want to use the “find” command to locate files and then use several “exec” statements to perform various operations on whatever “find” finds. In the following example I am making sure that all /etc/*.conf files are owned by root and that they don’t have permissions greater than 644.

Modifying Solaris Services

September 9, 2010 – 4:33 pm
di-logo-solaris-orange

Recently I ran into an issue: the sshd service on a Solaris 10 box needed to be used with a custom configuration file. By default, the sshd service will use /etc/ssh/sshd_config. I needed it to use /etc/ssh/sshd_config_custom. I could not just modify the default configuration file. Don’t ask why – it’s complicated. So here’s what I ended up doing and this process is applicable to modifying any other Solaris 10 (and above) service.

Substitute Commands Depending on User ID

September 9, 2010 – 2:44 pm
picard-facepalm-text-569

Here is a quick example of how to substitute system commands based on who tries to run them. A customer of mine has recently deployed a security audit application on his servers. The application has a few bugs that the vendor has not yet resolved. For example, the security audit agent looks at the output of the “mount” command to see if any filesystems are mounted without the “nosuid” option.

NFS “Not Owner” Error

August 30, 2010 – 11:34 pm
network_cable_01

The “not owner” error is displayed on the client system (usually Solaris) when attempting to mount an NFS share from a server. This error may appear even though the share is correctly exported and the client system has full access. If you are getting a “permission denied” error, then this article is not for you and you should check here instead.

Forcing Linux to Reboot

January 29, 2010 – 3:21 pm
boot

Until I branched out a few years ago from supporting Unix server to working with Linux clusters, I never really encountered this issue: you type “reboot”, “init 0”, or “shutdown” as root and… nothing happens. Or the system starts going down but then hangs on unmounting a filesystem or unloading a module. I think this happened once to a colleague of mine who was rebooting a Solaris server, but this is a common problem with Linux.

WordPress File Upload Size Limit

December 25, 2009 – 9:24 pm
wordpress_0004

By default, WordPress will not allow you to upload a file larger than 2Mb. This limit is not set by WordPress itself, but by detaul PHP configuration. This configuration file is usually /etc/php.ini, but normally …

Reboot Remote Windows Workstation

December 10, 2009 – 9:53 am
windows-logo-readerszone

When using RDP, sometimes the session may lock up and you may need to reboot your workstation remotely. This can be done using the “shutdown.exe” command from your local PC. First, make sure you can …

Slow SSH login in SuSE Linux

November 3, 2009 – 6:17 pm
chameleon_01

Starting with SuSE 10 and including both openSuSE and SLES an annoying SSH problem appeared. When you SSH to the server (via PuTTY and such) you get the “login” prompts right away, but the “password” …

Shell Scripting for HPC Clusters, Part 2

October 23, 2009 – 12:30 pm
shell

This is the second installment of a multipart guide for beginner Unix sysadmins supporting HPC clusters. You can view the first part of the guide here.
Searching, Replacing, Comparing
Try to work with a large cluster and …

Shell Scripting for HPC Clusters, Part 1

October 10, 2009 – 12:59 am
shell_003

This is the first installment of a multipart guide for beginner Unix sysadmins supporting HPC clusters.
“For” and “While” Loop Constructs
The main challenge of supporting a Linux cluster is ensuring a homogeneous environment. Aside from small …

Web Hosting Providers and php.ini

October 9, 2009 – 4:07 pm
Grapevinesnail_01

The php.ini is the primary configuration file for the PHP – a popular scripting language used for Web development. Most Web hosting providers offer preinstalled PHP on their servers. If your search on PHP has …

Automatically Validate HTTP Proxies

August 5, 2009 – 4:14 pm
computer_security_it_privacy_0002

Let’s say you downloaded a long list of Web proxy servers. Now you are stuck with the task of weeding out the proxies that are dead, slow, fake, or otherwise unusable. There are some applications …

Shell Random Number Generator

August 4, 2009 – 2:58 pm
shell_001

Sometimes, in the course of writing shell script, a need arises for some random input. Using the built-in $RANDOM shell variable will give you a random number from 0 to 32767 . Let’s take a …

Wget and User-Agent Header

June 29, 2009 – 12:41 pm
computer_security_it_privacy_0003

As you may already know, Wget is a popular (particularly in the Unix world) command-line downloader and Web crawler application. You can read more about Wget in one of my earlier posts on the subject. …

Numeric File Permissions in Unix

June 27, 2009 – 7:50 pm
shell_001

Suppose you are working with a Web server and your task is to make sure that no files or directories have permissions “777”. It would be easy to just recursively change permissions for all files …

Controlling Process CPU Utilization

March 9, 2009 – 12:36 pm
Grapevinesnail_01

Let’s say there is a process on your Unix/Linux system that sometimes tends to consume all CPU resources and become unresponsive. At the same time, you do not want to terminate the process at the …

Encoding Videos for XBox 360 and PS3

January 1, 2009 – 4:47 pm

Both Xbox 360 and PS3 support a variety of video codecs and are capable of playing high-definition video files. One of the most popular formats for HD video files is Matroska (MKV), which provides excellent …

Random Filename Chooser

June 17, 2008 – 9:02 pm
lock code

This is a rather peculiar little script with a purpose that may not be immediately apparent. The script will look for files in the specified folder; it will then pick one at random from the …

Scali Manage (Platform Manager) CLI Guide

June 5, 2008 – 10:24 pm
trash

Scali Manage – the bloated and unpredictable HPC cluster management tool – has recently been acquired by Platform Computing Corp. It is to be integrated into Platform LSF and Platform OCS products. I can’t say …

Dealing With Disk Hogs

June 1, 2008 – 5:49 pm
hard_disk_drive_hdd_0005

Some users and application developers believe that any free disk space on the server belongs to them. Suddenly you get an email alert saying that a server “xyz” ran out of disk space in /home. …

Useful SysAdmin Scripts: Search-and-Replace

June 1, 2008 – 3:03 pm
binoculars watch security rifle gun

Let’s say you moved your server to a new network and now it has a different IP address. You know your users have a habit of hard-coding the server’s IP into their scripts. So you …