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 Tags

Articles tagged with: shell

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.

Generating complex SQL queries with shell scripts

February 21, 2006 – 9:08 am
shell_0004

It is sometimes necessary to use complex select and insert queries with dozens of variables. Writing such queries by hand is a tedious process and the chance of making a mistake is high. A few …

Handling errors and trapping system calls

December 2, 2005 – 11:20 am
shell_002

In the course of writing a shell script it is important to consider possible error and unexpected interrupts. Let’s say you wrote an interactive script that allows users to archive old files to free up …

Passing shell variables to awk and sed

December 2, 2005 – 10:23 am
shell_002

By default awk and sed do not expand shell or system variables and do not pass their own variables back to the shell. To use shell variables awk and sed statements must be included in …

Find largest files

November 19, 2005 – 11:17 pm
shell

How to find the largest files in the directory tree on Solaris.