Recent Posts
My SysAd Blog -- Unix
Return To Blog Listing
This blog covers UNIX system administration HOWTO tips for using inline for loops, find command, UNIX scripting, configuration, SQL, various UNIX-based tools, and command line interface syntax. What exactly is UNIX? It is an operating system.
Recent Posts Tagged With opensolaris
-
Dump Sybase Database to File
I had a reader ask me offline how to transfer a legacy database to another instance of a database management system (DBMS) on a separate server/workstation. The reader was trying to extract historical statistics via a test database (on a test server)...
-
Troubleshooting the "su: No shell" error
The other day we had a problem with a system account. At first we did not notice the “su: No shell” error on the console (headless server) but after a few reboots it was fairly evident. The message gave us enough feedback to determine the substit...
-
Using Z Shell Brace Expansion to Create Test Files
Here is a convenient way of creating test files using the powerful Z Shell. I have been using this shell for a short while, and I am quickly becoming a fan of it. I used it to support transfer speed tests. To support these tests, I created a specifie...
-
Automounting a User’s Home Directory
A couple colleagues of mine were trying to execute a program on the server that required a special initialization environment, which was called from the /home/loginuser path. The login, loginuser, was not part of the server’s name service domain. I...
-
IT Certification Self-Help Portal
I found this technical self-help website, uCertify.com, very interesting and wanted to share it with some of the readers. The company has been online since 1999. They are offering PrepKits which are interactive software programs that help you learn, ...
-
Finding Open Files with lsof Command
When a file is in use by a process, it is possible to delete the file - OR at least it may appear that is the case. The filename is no longer visible via the ls command, but it is there until the process using it exits.For example, let's say Sysadmi...
-
Setup Mail Client on UNIX-based System
In the last post, a mail server setup was demonstrated. This post will demonstrate the setup of a mail client. Again, the setup of mail client is fairly straightforward. Here is the run.On the client side, ensure the /var/mail directory is present.# ...
-
Setup Mail Server on UNIX-based System
The last post made me think about setting up a mail server on my eBay purchased UNIX-based box at home. As I recalled from a few years ago, this was a fairly straightforward task to accomplish. The task primarily dealt with ensuring the server’s /v...
-
User Unable to POP Incoming Mail via MS Outlook
Yesterday I received a phone call regarding a user having problems with his mail. The user was able to send email but unable to receive it via MS Outlook Client. Usually, I encounter mail related problems due to recent password changes. However, that...
-
List, Remove or Rename Multi-spaced Filenames - UNIX
I know this is a common HOWTO for UNIX system administrators, but I do get this question on occasion. The question is the following: "how do you delete a file with spaces in its name?" Use quotes, "".From experience, I have seen numerous people type ...
-
Log Repeated Login Failures
You can log repeated login failures with the /var/adm/loginlog file. This file is not created by default, so you will have to create it. Most systems will allow 5 login retries before logging the event to this file. By the way, you can modify the max...
-
Strip an Extension From a Filename - UNIX
I received this common question the other day. "How do I strip an extension from filenames using sed?" Frankly speaking, I thought this howto was already posted in this blog, but after further review, it doesn't appear to be. At any rate, here are s...
-
Remove First 10 or 100 or 1000 Lines in a Log File - UNIX
After reviewing my Google Webmaster tools, I've observed several search iterations for "remove first 100 or 1000 lines in a log file." Here's an example to demonstrate removing the first 10 lines, 100 lines or 1000 lines in an .htaccess file.Remove ...
-
Evaluate Constants and Strings with expr Command
The expr command is a handy utility for evaluating constants and strings via the command line interface. Here are a few examples of expressions.# expr 9 \* 981# expr 9 / 91# expr 9 + 918# expr 9 - 90# expr 9 % 90# expr 50 - 100-50# expr 6 + 8 \* 978...
-
Remove the PHPSESSID From URL
The last couple of days I have been trying to remove unsightly PHPSESSIDs from my URLs. Here's how one looked on google.com.http://www.xxxxxx.com/details_xxxxxx__xxxxxxxxxxxxxx-.html?PHPSESSID=976fc83764c21749f95e831xxx6a3bxxI opened up the php.ini f...
-
Get Better Compression with bzip2 Command - UNIX
I was trying out the bzip2 compression command. I did notice better compression rates with larger files (testing large tarballs) compared to gzip or compress. But it does take quite a bit of time to perform the compression. Here's one run I did.# ls...
-
Modify a Command's Scheduling Priority with nice
There may be times when you need to modify the priority of a command. You can do this by using the nice command. It modifies the scheduling priority of the command . 19 is the lowest priority, 1 is the highest priority, and 10 is the default. Here...
-
Check Sent Mail Status with mailq
I had a number of users informed me that their messages were "stuck in the queue or something hanging." Their concerns were confirmed after using the mailq command. After a brief investigation, it was discovered was a small hiccup with DNS.Here's a...
-
Recovering a Corrupted Mailbox -- UNIX
The other day I had user who was having problems popping mail from the mail server. My first thoughts were wrong password, POP server issue or permissions. Well, it was none of the above. Then I started thinking about the mailbox itself. Here's what...
-
The Popular XV Image Viewer for UNIX
Yesterday, I received an email asking me about a versatile jpeg image viewer for UNIX. My initial thoughts were to use the common browser or the image related utilities in /usr/openwin/bin -- imagetool or snapshot.Then I started thinking about XV. X...
-
Display a Specified Number of Lines From Multiple Files
Here's an ad-hoc way of viewing a specified number of lines that begins with line one. In this example, the templated report has 8 lines and only its values change each day.I only want to show the first 5 lines for each file. Here's a quick and dirty...
-
Delete Extra Spaces Between Words in a File
I had a file peppered with extra spaces, which were between the terms (chars need to be contiguous). I could read it but it was fairly annoying. I used the tr utility to delete most of the extra spaces and then vi'ed the file to rid it of the rest. T...
-
Manage Removing Directories from a Stack with popd
I thought about adding the popd command verbiage to the last post (pushd), but I do like to keep these HOWTOs pithy. The pushd command was used to push directories onto a stack, so now I'm going to use the popd to remove directories from the stack....
-
Manage Adding Directories to a Stack with pushd
While working on my FreeAdLists personal project at home, I decided it was time to better manage my pwd efforts. I quickly grew weary and impatient (exacerbated by the fact I'm fighting a nasty cold and acute rhinitis) of changing directories so many...
-
Download an XML feed with wget
For one of my projects, I was attempting to download a 70MB XML feed. Unfortunately, it was taking forever to download via HTTP and crashing my MSIE 6.0 and Firefox 2.0.0.7 browsers. I ended up using the wget utility to complete the task. Here's what...
-
Ping Multiple Workstations and Mail Results
Here's a simple Z Shell script to check for network connectivity. If you have several dozen workstations, manually pinging each one can be a laborious task. This script pings and mails the results to a group alias. You can automate by scheduling it w...
-
Use .htaccess to Deny Internet Protocol (IP) Address or Domain Name
You can use the .htaccess file to deny sites that are wreaking havoc on your site. I have a dozen or so IPs from a couple countries that are doing just that to one of my sites. You can block specific IPs/IP blocks or deny by domain names.The first tw...
-
Joining and Renaming Multiple Files Using a for loop
I'm doing this personal project where I parsed almost 26,000 items into a particular format. I then parsed 300 of those items into a unique filename, so I ended up with 86 unique files. Lastly, I added a header and footer to each unique file and then...
-
Delete Tabs, Newlines, Carriage Returns, or Spaces from a File
There are times when you might want to delete formatting characters from a file. The tr command does an excellent job of performing this task. Here are some examples.Remove tabs# more filenameesoft esoft esoftesoft esoft esoft# cat filena...
-
Evaluate NFS Statistical Information with nfsstat
The nfsstat command is used to show the statistical information of Network File System (NFS) and Remote Procedure Call (RPC). It's useful for showing NFS activity between the server and client. Here's a few examples.Show stats# nfsstatEvaluate NFS mo...

