Showing posts with label qualifications. Show all posts
Showing posts with label qualifications. Show all posts

Monday, March 26, 2007

Unix, pipes, scripts, oh my!

Let me show the power of the shell! There some things that you just can't do clicking a mouse or pecking on the keyboard stretching your fingers between letters and the alt or ctrl keys. Cron and at are you friends along with pipes. I work a lot on remote terminals at the command line and have become quite competent, even writing a few short scripts that do quite a lot. I'm not familiar with the latest version of Windows shell Monad so I won't compare it and just stick to what I know.

Let's try this, say you want a directory listing of everything in your home folder. Well in Windows you would open up your My Documents . But that doesn't save it in file, it just shows it to you. What about the command prompt, Start->Run->cmd enter in "dir" and there it is. But that still isn't in a file; okay copy, open notepad, paste it in. Now you have your home folder listing in a file. Bash or csh or ksh is much easier!

cd ; ls -l >> myhome.txt

That's it. cd changes directory to your home, ls -l gives a directory listing in long format, >> is the redirect command. Redirect takes the output from a command and sends it somewhere else. Usually it's used to create log files, here it takes the output and saves it in a file. Sometimes output is sent to the null device /dev/null; this will just send it nowhere. Redirect can also work the other way as in sending an input file to a command for processing.

Here is a common command I use:
ps -ef | grep db2
Here I use the pipe. Pipes are used usually in a chain of commands, the output of one command is used as the input for the next command. In the example I take the output of the ps command, process, and send to grep, pattern searching, looking for anything containing db2. You can add any number of commands to chain as long as it makes sense:
tail -f `ls -tr *backup* | tail -1`
This chain will get the most recently modified file that has backup in the name. The back ticks will return the commands between them. In effect tail -f will wait for ls -tr *backup* | tail -1 to execute and use the results in the command. tail -1 returns the last line of ls -tr *backup*. Adding it up the command will continously display the contents of the latest backup file.

Normally ps returns process sorted by their id, suppose we want the only db2 process sorted by name saved in a file:
ps -ef | grep db2 | sort >> db2process.txt

Let's find out who has an account
cat /etc/passwd | cut -f 1 -d : | sort
cat just spills out the contents of a file, sends the output to cut field 1 delimited by ":" and then sends it sort.

Command chains can become quite cryptic and long:
cd dba ; tail `ls -tr *backup* | tail -1` | (grep Finished && ls -ltr *backup*) || (tail -f `ls -tr *backup* | tail -1`)
My favorite, because I wrote it, change to the dba directory and tail the most recent backup file looking for "Finished" then show the listing otherwise keep tailing the file.

More to follow...








Sunday, March 18, 2007

Prospective employers please read this!

This is my cover letter/intro in a more informal setting. I am currently
working as a level 2 support tech supporting both Windows and Unix
servers. I have been working on remote systems using Remote Desktop and
command line/shell commands. I have written a couple of scripts to save
time and allow me to watch other monitors. I have written a program to
consolidate notes for various accounts. This program also stores the
many passwords we have to have for the accounts we monitor. It also
makes automatic backups of notes and passwords with a time/date stamp.
There is an option to paste either as plain text or formatted. Using the
scripts/programs I wrote I have cut down the time to do repetitive task
by over half. This is the sort of employee you need, looking for ways to
save time and money.

I have proven leadership skills. Eight years in the U.S. Army, the last
four years in a leadership position. I graduated in the top 20% of a
class of over 500 students in the Primary Leadership Development Course.
I was chosen above my pears for a position designated for a higher rank
than what I held as Training NCO. The position covered training
schedules, files, records, making phone calls/appointments for the Unit
Command and First Sergeant, physical security and Information/Automated
System security, ensuring all clerks were properly trained. While
deployed to Kuwait in 2002 I was chosen to lead a team at the Forward
Deployed Headquarters. We were in charge of monitoring several long
range RADAR and satellite images and reporting anything to the Forward
Commander.

Before being in the Army I was a shift manager for a family restaurant.
I worked there for ten years, working my up from busboy to shift
manager. I was in charge of thirty employees, scheduling, food costs,
ordering and inventory and of course customer service.

I am ready for any challenges.