UNIX Questions and Answers

UNIX Questions and Answers

Most answers refer to Solaris 2.x systems

Hardware Issues

Configuration Issues

NFS Issues

General Issues

Software issues

Networking issues

Security issues

Firewall issues

Performance tuning issues


How do i view and set the open boot prom settings

From the unix prompt use eeprom. From the ok prompt use devaliases, printenv, nvedit and nvalias.

Back to Contents

How do i stop people logging in ?

If the file /etc/nologin exists then only root can login. Whatever the contents of the file are are displayed to whoever is attempting a login.

Back to Contents

How do i boot over the net via a different interface

From the ok prompt type


This will display the possible interfaces. Select an interface then type

nvalias net ^Y

This will set the selected interface to the alias net.

Back to Contents

How do I solve Keyboard Translation

The most likely cause of this is an incorrect XKeysymDB file or an
incorrect pointer to it. Try looking in /usr/openwin/lib or
/usr/openwin/lib/X11. The Installation and Administration
manual for the application should have some information about this.

If logged in as root from another system try
/usr/openwin/bin/kbd-mode -a

Back to Contents

Why do I get the error Stale NFS

This was probably caused by a directory being deleted while another
system was NFS mounted into it. The best action is to cd
out of the directory and perform a umount. Sometimes
halting and restarting the automount daemon is reqired, for example:

/etc/rc2.d/S74autofs [stop/start]. or

/etc/init.d/nfs.server [stop/start].

If none of these work, then it might have to be a reboot.

Back to Contents

How can I configure new devices without

It is advisable to halt and power off the system whenever you attach new
scsi devices. However, if this is not possible try this:

  1. If possible stop the system with < STOP > < A >, connect the device and
    type go
  2. Type:



    tapes / disks (depending on the device attached)

Back to Contents

What does the error RPC Program not registered

Probably the NFS server has got itself a little confused. Check there is
an entry in /etc/dfs/dfstab

Try stopping and restarting the daemon, for example:

/etc/init.d/nfs.server [stop/start]

If this doesn’t work, try a reboot.

Back to Contents

How do I tar to a remote system?

Tar to a remote drive:

tar cvfb - 20 filenames | rsh host dd of=/dev/rmt0 obs=20b

Tar from a remote drive:

rsh -n host dd if=/dev/rmt0 bs=20b | tar xvBfb - 20

Copying directory trees:

cd fromdir; tar cf - . | (cd todir; tar xfBp -)

Copy directory tree to another host:

cd fromdir; tar cf - * | rsh host "cd todir ; tar xf -"

Back to Contents

How do I copy directory structure with cpio?

Use find and cpio

cd fromdir; find . -name -print | cpio -pmd /todir

Back to Contents

How can I increase swap space?

Swapping onto a file system is faster than swapping to a file. If
possible, partition an area of disk as the additional swap area.
Otherwise, create a swap file with the command mkfile (see
man page), for example:

mkfile 100m swappy

Add the swap area with the command swap (see man page) for

swap -a swappy

Back to Contents

Cetting a non sun cdrom to work

The main secret is to get the cdrom to talk in 512 byte sectors. If the cdrom does this then it will work. This is a good FAQ to start with or try the Sun CD FAQ. or of course your manafacturs instruction book.

Back to Contents

How do I find out the speed of my machine?

Use the command psrinfo -v

Back to Contents

How do I carry out NFS performance tuning?

Start with the SMCC NFS Server Performance and Tuning Guide

This is a pkgadd of SUNWabhdw and adds the guide to answerbook

SUNWadhdw is on the “Software Supplement for the Solaris 2.6 Operating
Environment” CD.

Use the command /usr/bin/nfsstat to view the NFS statistics

Back to Contents

What hardware diagnostic programs are

Use SunVTS. This is available on the Software Supplement for the Solaris
2.6 Operating Environment CD.

If you have a fibre problem then try STORtools. You will probably need
a fibre loopback cable in order to get the most out of this.

Back to Contents

How do I make a file system bootable after a

If you have reinstalled the / file system from backup (ie
ufsdump) then you will need to recreate the boot block on
the boot disk. This is done using the installboot command (
read the man page ), for example:
/usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c?t?d?s?

Back to Contents

How do I dual host a system?

  1. Install the network card and cable it up. Make sure that any
    jumpersettings are set.
  2. Add the second interface name and IP to the hosts file and Name
  3. Edit the file /etc/hostname.interface where
    interface is the type, for example, le1 hme1
  4. Reboot the sysyem or manually set it up with ifconfig
    (see manual page)

    ifconfig hmse1 plumb

    ifconfig hmse1 IP-Address

You may also need to perform an add route (see manual page)

route add net destination gateway metric
Back to Contents

How do I find out what patches are on a

Use the command showrev -p

Use the command patchdiag -l this also lists patches you should install.
will need do download a copy from sun. If you have access try
downloading from this is a
tar compressed file.
There is a tar file of patchdiag on this site but i have not set up ftp at the moment of writing this page.

Back to Contents

How much memory does my system have?

Use the command prtconf and grep for the
memory, for example:

prtconf |grep Memory

If you need to know what memory sims are in what slot use the perl script from Micron. A sample script is.

Sample of Memcom Script Remeber to get an official copy.

Back to Contents

How can I play audio CDs and MP3 on my system?

For CD

Download a copy of Workman from

If you have problems with sound then it might be that you cannot use
the internal sound card and will have to plug speekers int the cd
plater itself.

However this might work

edit /etc/rmmount.conf and add

action cdrom


try this before any other cdrom actions

For MP3 files look to the following site


If you wish to read an audio cd under solaris and copy the files to
wav, mpeg, etc then you need the program galette available from Galette

Once you have the files stored as wav files you need to convert them to MP3 using Blade

Back to Contents

What useful Solaris commands are there
for finding out what’s going on?

This is a definite RTFM, but start with these:

ps, iostat, nfsstat,
sar, netstat, snoop,
mpstat, rpcinfo, truss,
prtdiag, crash, psrinfo,
prtconf, arp and uptime

try looking at the enclosed perl script to get an idea of wht to look for.

Perl script to look at how the system is performing

Back to Contents

How do I connnect a Zip Drive?

Helpful info from Iomega at

Zip Drives on Sun

basically edit /etc/format.dat and add :-

disk_type = "Zip" \
: ctlr = SCSI\
: ncyl = 2046 : acyl = 2 : pcyl = 2048 : nhead = 2\
: nsect = 40 : rpm : bpt = 20480

partition = "Zip" \
: disk = "Zip" : ctlr = SCSI \
: 2 = 0, 192480 : 2 = 0, 1159168

Jazz Drives on Sun
Back to Contents

Why do I get .nfsxxxx files on NFS mounted

These are temporary files used by the system to guarantee data
reliability over the unreliable nfs mount. These can be left behind by
an application or process that has terminated abnormally.

Back to Contents

How do I stop printing a banner page?

If this is for just one print, use the -o option, for

lp -o nobanner name

Otherwise, edit the file /etc/lp/interfaces/printername and
change the option nobanner to yes.

Back to Contents

How can I find out and set shared memory?

Use the command ipcs to view what is set.

If you wish to change them, edit /etc/systems and reboot
with -r.

Typically, you would edit one or more of msgsys,
semsys, shmsys.

Check out the sun docunemt on shared memory sunworld document on shared memory

Back to Contents

Number of inodes used and free

use the command df -F ufs -o i

Back to Contents

What block size is my file system

use the command mkfs -m /dev/dsk/c?t?d?s?

look at the bsize value (you need to be root to run this)

Back to Contents

How do I find out which clients are NFS mounting
a server?

Use the command dfmounts

Back to Contents

How do I get rid of defunct processes?

These are caused by an application or process crashing, terminating
abnormally, getting confused
etc. Look for the parent process of these and kill or refresh it.

Back to Contents

What version of bind am I running?

try /usr/ccs/bin/what /usr/sbin/in.named |grep named

Solaris 2.6 bind 4.9.4-P1 

Solaris 2.5.1 bind 4.9.3-P1

Back to Contents

How can I change the hostid?

There are several ways to do this, try:


Back to Contents

Why am I having problems mounting a floppy?

Back to Contents

How do I configure dtlogin for other window managers?

You need to create an Xresourses file to start the window manager.

cd /usr/dt/config/C/Xresources.d
copy Xresources.ow to a new name of your window manager ie Xresourses.kde.

Now edit your Xresources.kde file. Making the changes for your window manager


Dtlogin*altDtsIncrement: True

Dtlogin*altDtName: KDE Desktop

Dtlogin*altDtKey: /usr/local/kde/bin/startkde

Dtlogin*altDtStart: /usr/local/kde/bin/startkde

Dtlogin*altDtLogo: KDElogo

copy the KDE logo to /usr/dt/appconfig/icons/C/

Back to Contents

Dual headed sun system

Try looking at infodoc 11669.

openwin -dev /dev/cgsix0 left -dev /dev/cgsix1 right


edit Xservers with

:0 Local [email protected] root /usr/openwin/bin/Xsun :0 -dev /dev/cgsix0 -dev /dev/cgsix1 right

How do I configure CDE?

The control panel

In this example I will add the workman cd player to the control panel.

Copy the CDE config file dtwm.fp from /usr/dt to your homedirectory/.dt/types

Create an icon and place it in ~.dt/icons. it should have a extension.


Edit the dtwm.fp file
and add following. In this case I am adding it between the help and
trash areas. the position hints is 13 so it should appear towards the
right between the help (book) icon and the trash (waste bin) icon.

CONTROL cdplayer
TYPE icon
PUSH_ACTION cdplayer
ICON Player

Create a file for what to do when the button is pushed. In the example
it is called cdplayer. The file has a .dt extension IE cdplayer.dt. The
contents of this file are.

ACTION cdplayer
LABEL cdplayer
EXEC_STRING /usr/local/bin/workman
ICON somename
DESCRIPTION starts cdplayer

The mouse menu

copy the mouse menu from /usr/dt/config/C/sys.dtwmrc to you home directory ~/.dt/types/dtwmrc.

edit the dtwnrc file adding or removing mouse options. In this case we will create an applications submenu and put the cdplayer in that submenu.

Firstly add the applications menu to the main menu by instering a line like this

"Applications" apps
in the DtRootMenu section. approx line 38
then hgo to the botton of the file and create the application menu. ie.

Menu apps
"CD Player" f.exec "/usr/local/bin/workman"

Back to Contents

How do I stop colour flashing?

Back to Contents

How do i communicate between systems using scokets

There are several ways to do this.  Below is an example of a perl program that sends the string 
"hey now hey now now. Sing this corrosion to me " to port 1250 on a system called mission.
On the mission server there is a program which is called via inetd that picks up this incomming
line and writes it to a file /tmp/outfile. the program is called

Sample /etc/inetd.conf entry
read-socket stream tcp nowait neville /export/home/neville/

Sample /etc/services entry
read-socket 1250/tcp

Sample sending program (
use IO::Socket;
$sock = new IO::Socket::INET (PeerAddr => 'mission',
PeerPort => 1250,
Proto => 'tcp',
die "Socket could not be created. Reason $! \n" unless $sock;
print $sock "hey now hey now now. Sing this corrosion to me\n";
close ($sock);

Sample sending program (
use IO::Socket;
my $FILETOSEND = "/tmp/crappy";
open (INFILE, $FILETOSEND) || die "cannot open file: $FILETOSEND \n";
$sock = new IO::Socket::INET (PeerAddr => 'mission',
PeerPort => 1250,
Proto => 'tcp',
die "Socket could not be created. Reason $! \n" unless $sock;
#now do the sending
select ($sock);
while (< INFILE > )
print $_;
close ($sock);
close ($INFILE);

Sample reading program (
open (OUT, ">/tmp/outfile") || die "cannot open output file \n";
print OUT < STDIN >
close (OUT);

Sample reading program as a deamon (not using /etc/system and /etc/services)
#!/usr/ bin/perl
use IO::Socket;
$sock = new IO::Socket::INET (PeerPort => 1250,
Proto => 'tcp',
Listen => 10,
Reuse => 1,
die "Cannot start deamon on socket Reason $! \n" unless $sock;
while ($this_connection = $server->accept())
print $this_connection;
close ($sock);

Back to Contents

How do i find out what resources a running process is using

Use the proc commands below and others. 
/usr/proc/bin/pmap -x $PID (see what memory is used)
/usr/proc/bin/pldd $PID (see what shared libraries are used)
/usr/proc/bin/pwdx $PID (see what the working directory is)

Download a copy of memtool from Sun.

Back to Contents

How can i program in curses?

If you plan to use curses to do an interface try looking at this site. It might make life easier for you

SCRMGR curses interface

Back to Contents

Get system hardware configuration

Run the command /usr/platform/arch-type/sbin/prtdiag -V

Back to Contents

Run jobs in background during times of light system loading

Try this site
Idalize program

Back to Contents

System stats in html format

Get a copy of DHTMLR (Do HTML Report) forom the belew site.

this is a shell script that gets system info and builds web pages.
DHTMLR program from the Sunsolve site Belgium

Back to Contents

Graphical FTP front ends for X

There are quite a few graphical front ends for ftp available. Below are
a couple of them. Also try looking at the KDE and GNOME sites.

GNU licenses Graphical ftp

llnl xdir

Back to Contents

Security issues and Solaris

Um yes well probably quite a few bits to add here. lets try

Back to Contents

Info on old sun hardware

This is a 7 part document

Back to Contents

Microsoft Internet Explorer and Outlook express for Solaris

Download it from

Internet Explorer

Back to Contents

How to prevent stack overflow

add noexec_user_stack to the file /etc/system

Back to Contents

How to tell if you are in 32 or 64 bit mode

use the command isainfo -v

Back to Contents

Disable CDROM popup under CDE

comment out the stdvolcheck stuff from


Back to Contents

Stop FTP users from logging in

Set their shell in /etc/passwd to /bin/false. Then edit /etc/shells and add a line /bin/false.

Back to Contents

Check for disk errors

Use the commands

iostat -e or iostst -E or netstat -k

Back to Contents

Firewall information

Probably a lot to say here lets start with

Back to Contents

Performance tuning information

Probably a lot to say here lets start with

Back to Contents

Xerox NeWSprinter20 Toner

As far as i can tell this is the toner Xerox XP 15/20

Back to Contents

Connecting a Sun Monitor to a PC

You will need to get a fixed frequency card. Look at this site.

Monitor world

Back to Contents

Connecting a PC Monitor to a Sun

You will need to get a 13W3 to VGA connector.

Some monitors (Notably Sony based ones) will just work. Plug it it and reboot.

If not you will need to set up your monitor configurations at the NVRAM.

To set the NVRAM you need the following info.

Back to Contents

Pinouts for Scsi, Video, Audio, Parallel, serial, etc

A good site to start looking at is:

Back to Contents

What is my screen resolution, etc

Under the X11 environment run the command xdpyinfo. If not running X
then you will need to look at one of the frame buffer config commands.

Unfortunatly these are framebuffer specific but try

System/Framebuffer	Command

Sparc4, Sparcx5 tcx tcxconfig
x86 kdmconfig
Ultra creator ffbconfig
Ultra PGX/M64 m64config
sparc ZX/TZX leoconfig
sparc SX cg14config

If you do not have the OS running but are at the OK pronpt try using nvedit.

Back to Contents

Upper to lower case traanslation using tr

#translate filenames in uppercase to lowercase

for FILE in `ls`
NEWNAME=`echo $FILE |tr [A-Z] [a-z]`

Back to Contents

How to create solaris pkg’d

read this good article.

creating solaris packages

Back to Contents

Mb/Mhz rpm rule of thumb

A vague rule of thumb when looking at disk arrays is MB transfered is 10% of Mhz

for every 1000 rpm of disk you will get about 9 I/O’s second therefore a 10,000rpm disk will have 90 I/O second

If these are in a stripe configuration of 5 working disks the the throughput

could be 400 I/O second

At the time of writing a fully populated D1000 could yeald up to 3000 I/O second

Back to Contents

Online & Offline processors and what running on a processor

useful commnads are mpstat, psrinfo, psrset, pbind

Back to Contents

Rename an e10000 domain

Take a look at this page to show how to remane a domain. The main thing
to remember is to rename the domain on the ssp as well as the domain
Renaming an E1000 Domain

Back to Contents


Powered by ScribeFire.


Unix Interview Questions???

Linux admin interview questions

  1. How do you take a single line of input from the user in a shell script?
  2. Write a script to convert all DOS style backslashes to UNIX style slashes in a list of files.
  3. Write
    a regular expression (or sed script) to replace all occurrences of the
    letter ‘f’, followed by any number of characters, followed by the
    letter ‘a’, followed by one or more numeric characters, followed by the
    letter ‘n’, and replace what’s found with the string “UNIX”.
  4. Write a script to list all the differences between two directories.
  5. Write a program in any language you choose, to reverse a file.
  6. What are the fields of the password file?
  7. What does a plus at the beginning of a line in the password file signify?
  8. Using the man pages, find the correct ioctl to send console output to an arbitrary pty.
  9. What is an MX record?
  10. What is the prom command on a Sun that shows the SCSI devices?
  11. What is the factory default SCSI target for /dev/sd0?
  12. Where is that value controlled?
  13. What happens to a child process that dies and has no parent process to wait for it and what’s bad about this?
  14. What’s wrong with sendmail? What would you fix?
  15. What command do you run to check file system consistency?
  16. What’s wrong with running shutdown on a network?
  17. What can be wrong with setuid scripts?
  18. What value does spawn return?
  19. Write
    a script to send mail from three other machines on the network to root
    at the machine you’re on. Use a ‘here doc’, but include in the mail
    message the name of the machine the mail is sent from and the disk
    utilization statistics on each machine?
  20. Why can’t root
    just cd to someone’s home directory and run a program called a.out
    sitting there by typing “a.out”, and why is this good?
  21. What is the difference between UDP and TCP?
  22. What is DNS?
  23. What does nslookup do?
  24. How do you create a swapfile?
  25. How would you check the route table on a workstation/server?
  26. How do you find which ypmaster you are bound to?
  27. How do you fix a problem where a printer will cutoff anything over 1MB?
  28. What is the largest file system size in solaris? SunOS?
  29. What are the different RAID levels?

Interview questions for Linux admin

  1. Advantages/disadvantages of script vs compiled program.
  2. Name a replacement for PHP/Perl/MySQL/Linux/Apache and show main differences.
  3. Why have you choosen such a combination of products?
  4. Differences between two last MySQL versions. Which one would you choose and when/why?
  5. Main differences between Apache 1.x and 2.x. Why is 2.x not so popular? Which one would you choose and when/why?
  6. Which Linux distros do you have experience with?
  7. Which distro you prefer? Why?
  8. Which tool would you use to update Debian / Slackware / RedHat / Mandrake / SuSE ?
  9. You’re asked to write an Apache module. What would you do?
  10. Which tool do you prefer for Apache log reports?
  11. Your portfolio. (even a PHP guest book may work well)
  12. What does ‘route’ command do?
  13. Differences between ipchains and iptables.
  14. What’s eth0, ppp0, wlan0, ttyS0, etc.
  15. What are different directories in / for?
  16. Partitioning scheme for new webserver. Why?

Unix/Linux programming interview questions

Question 1: What is the major advantage of a hash table? (Asked by Silicon Magic Corp. people)

The major advantage of a hash table is its speed. Because the hash
function is to take a range of key values and transform them into index
values in such a way that the key values are distributed randomly
across all the indices of a hash table.

Question 2: What are the techniques that you use to handle the collisions in hash tables?(Asked by Silicon Magic Corp. people)

We can use two major techniques to handle the collisions. They are open
addressing and separate chaining. In open addressing, data items that
hash to a full array cell are placed in another cell in the array. In
separate chaining, each array element consist of a linked list. All
data items hashing to a given array index are inserted in that list.

Question 3: In Unix OS, what is the file server? (Asked by Silicon Magic Corp. people)

Answer: The file server is a machine that shares its disk storage and files with other machines on the network.

Question 4: What is NFS? What is its job?(Asked by Silicon Magic Corp. people)

NFS stands for Network File System. NFS enables filesystems physically
residing on one computer system to be used by other computers in the
network, appearing to users on the remote host as just another local

Question 5: What is CVS? List some useful CVS commands.(Asked by Silicon Magic Corp.people)

CVS is Concurrent Version System. It is the front end to the RCS
revision control system which extends the notion of revision control
from a collection of files in a single directory to a hierarchical
collection of directories consisting of revision controlled files.
These directories and files can be combined together to form a software
There are some useful commands that are being used very often. They are

cvs checkout
cvs update
cvs add
cvs remove
cvs commit

Unix/Linux administration interview questions

What is LILO?

stands for Linux boot loader. It will load the MBR, master boot record,
into the memory, and tell the system which partition and hard drive to
boot from.

What is the main advantage of creating links to a file instead of copies of the file?

The main advantage is not really that it saves disk space (though it
does that too) but, rather, that a change of permissions on the file is
applied to all the link access points. The link will show permissions
of lrwxrwxrwx but that is for the link itself and not the access to the
file to which the link points. Thus if you want to change the
permissions for a command, such as su, you only have to do it on the
original. With copies you have to find all of the copies and change
permission on each of the copies.

Write a command to find all of the files which have been accessed within the last 30 days.

find / -type f -atime -30 > December.files

command will find all the files under root, which is ‘/’, with file
type is file. ‘-atime -30′ will give all the files accessed less than
30 days ago. And the output will put into a file call December.files.

What is the most graceful way to get to run level single user mode?

A: The most graceful way is to use the command init s.
If you want to shut everything down before going to single user mode then do init 0 first and from the ok prompt do a boot -s.

What does the following command line produce? Explain each aspect of this line.

$ (date ; ps -ef | awk ‘{print $1}’ | sort | uniq | wc -l ) >> Activity.log

First let’s dissect the line: The date gives the date and time as the
first command of the line, this is followed by the a list of all
running processes in long form with UIDs listed first, this is the ps
-ef. These are fed into the awk which filters out all but the UIDs;
e UIDs are piped into sort for no discernible reason and then onto
uniq (now we see the reason for the sort – uniq only works on sorted
data – if the list is A, B, A, then A, B, A will be the output of uniq,
but if it’s A, A, B then A, B is the output) which produces only one
copy of each UID.

These UIDs are fed into wc -l which counts the lines – in this
case the number of distinct UIDs running processes on the system.
Finally the results of these two commands, the date and the wc -l, are
appended to the file “Activity.log”. Now to answer the question as to
what this command line produces. This writes the date and time into the
file Activity.log together with the number of distinct users who have
processes running on the system at that time. If the file already
exists, then these items are appended to the file, otherwise the file
is created.

Solaris interview questions

  1. List the files in current directory sorted by size ? – ls -l | grep ^- | sort -nr
  2. List the hidden files in current directory ? – ls -a1 | grep “^\.”
  3. Delete blank lines in a file ? – cat sample.txt | grep -v ‘^$’ > new_sample.txt
  4. Search for a sample string in particular files ? – grep .Debug. *.confHere grep uses the string .Debug. to search in all files with extension..conf. under current directory.
  5. Display the last newly appending lines of a file during appendingdata to the same file by some processes ? – tail .f Debug.logHere tail shows the newly appended data into Debug.log by some processes/user.
  6. Display the Disk Usage of file sizes under each directory in currentDirectory ? – du -k * | sort .nr (or) du .k . | sort -nr
  7. Change to a directory, which is having very long name ? – cd CDMA_3X_GEN*Here original directory name is . .CDMA_3X_GENERATION_DATA..
  8. Display the all files recursively with path under current directory ? – find . -depth -print
  9. Set the Display automatically for the current new user ? – export
    DISPLAY=`eval ‘who am i | cut -d”(” -f2 | cut -d”)” -f1′`Here in above
    command, see single quote, double quote, grave ascent is used. Observe
  10. Display the processes, which are running under yourusername ? – ps .aef | grep MaheshvjHere, Maheshvj is the username.
  11. List some Hot Keys for bash shell ? – Ctrl+l . Clears the Screen. Ctrl+r . Does a search in previously given commands in shell. Ctrl+u – Clears the typing before the hotkey. Ctrl+a . Places cursor at the beginning of the command at shell. Ctrl+e . Places cursor at the end of the command at shell. Ctrl+d . Kills the shell. Ctrl+z . Places the currently running process into background.
  12.  Display the files in the directory by file size ? – ls .ltr | sort .nr .k 5
  13. How to save man pages to a file ? – man <command> | col .b > <output-file>Example : man top | col .b > top_help.txt
  14. How to know the date & time for . when script is executed ? – Add
    the following script line in shell script.eval echo “Script is executed
    at `date`” >> timeinfo.infHere, .timeinfo.inf. contains date
    & time details ie., when script is executed and history related to
  15. How do you find out drive statistics ? – iostat -E
  16. Display disk usage in Kilobytes ? – du -k
  17. Display top ten largest files/directories ? – du -sk * | sort -nr | head
  18. How much space is used for users in kilobytes ? – quot -af
  19. How to create null file ? – cat /dev/null > filename1
  20. Access common commands quicker ? – ps -ef | grep -i [email protected]
  21. Display the page size of memory ? – pagesize -a
  22. Display Ethernet Address arp table ? – arp -a
  23. Display the no.of active established connections to localhost ? – netstat -a | grep EST
  24. Display the state of interfaces used for TCP/IP traffice ? – netstat -i
  25. Display the parent/child tree of a process ? – ptree <pid> Example: ptree 1267
  26. Show the working directory of a process ? – pwdx <pid> Example: pwdx 1267
  27. Display the processes current open files ? – pfiles <pid> Example: pfiles 1267
  28. Display the inter-process communication facility status ? – ipcs
  29. Display the top most process utilizing most CPU ? – top .b 1
  30. Alternative for top command ? – prstat -a

Powered by ScribeFire.


Blogging using Livewriter.

Indeed after doing a search in google i am able to find out a blogging tool for windows thats live write. Well, it is a product of microsoft and it is good. As i haven’t tested it a lot. but i am finding it usual till now. After downloading it from here and some teawking in my proxy settings i am able to configure it to work on my office’s XP machine.

The original link for Live writer


Blogging using Livewriter.

Indeed after doing a search in google i am able to find out a blogging tool for windows thats live write. Well, it is a product of microsoft and it is good. As i haven’t tested it a lot. but i am finding it usual till now. After downloading it from here and some teawking in my proxy settings i am able to configure it to work on my office’s XP machine.


Converting delimited text to Excel

Description Google Results

Non-technical people need to be able to work with data. They usually end up reaching for Excel or Access because we live in a malevolent Universe.

Fortunately for the Perl kids there are a couple excellent modules already done for you by our friends John McNamara (Spreadsheet::WriteExcel) and Kawai Takanori (Spreadsheet::ParseExcel). Here is an example of how you can turn Excel into delimited plain text: converting Excel to text.

Below is a very useful and fairly generic subroutine that can take all kinds of delimited files and turn them into straightforward Excel files.

sub text_to_excel {
# %args should look something like...
# ( delimiter => "\t",
# recordsep => "\n",
# file => "/path/to/file.txt"
# name => "Sheet Title" )
# the only required args are delimiter and file

# we require instead of use to save on if we never end up using it in
# a larger script or CGI, but use statements at the top of the script
# are clearer for other programmers to follow.
require Spreadsheet::WriteExcel;
require IO::Scalar;

my %args = @_;
my ( $delimiter, $recordsep, $file, $name ) =
@args{qw( delimiter recordsep file name )};

$delimiter and $file or
die "Must provide at least delimiter and file as args to" .

-e $file or
die "There is no file: $file\n";

open F, "< ", $file or croak("Can't open $file: $!");
$/ = $recordsep || "\n";
my @data = < F>;
close F;
$/ = "\n";

my $xls_str;
tie *XLS, 'IO::Scalar', \$xls_str;

my $workbook = Spreadsheet::WriteExcel->new(\*XLS) ;

my $worksheet = $workbook->addworksheet($name||'Page 1');

for ( my $row = 0; $row < @data; $row++ ) {

chomp( my @line = split /$delimiter/, $data[$row] );

for ( my $col = 0; $col < @line; $col++ ) {
$worksheet->write_string($row, $col, $line[$col] || "");
return $xls_str;
use MIME::Lite;  # we want to mail our excel sheet

my $file = '/data/profit_forcast';
my $name = '2006 Profit Forcast';
my $xls_data = text_to_excel( file => $file,
delimiter => "\t",
name => $name );

# we've done all the work. $xls_data IS the excel file in a raw
# format. we could do anything with it now, including writing it to a
# file, but let's send it via email.

my $msg = MIME::Lite->new(From => '[email protected]',
To => '[email protected]',
Cc => '[email protected]',
Subject => $name,
Type => 'multipart/mixed')
or die "PROBLEM opening MIME object: $!";

$msg->attach(Type => 'application/',
Disposition => 'attachment',
Data => $xls_data,
Filename => $name . '.xls')
or die "PROBLEM attaching Excel file: $!";

$msg->send() or die "PROBLEM sending MIME mail: $!";

print "Sent $name!\n";


Anyone who’s dealt with delimited files before knows that this approach is missing a way to balance delimiters. Eg: If your field delimiter is a tab and your record delimiter is a newline and one of the text fields has a tab or a return character in it, it will wreck the results.

To work with this, I often use the NULL character (””) as a field delimiter and a double (””) as a record delimiter. It will never appear in regular files so you don’t have to resort to Text::Balanced or something to ensure your data integrity.

If you will ever have empty fields that cause the field delimiter to double up, you’ll have to get crafty and do something like “”.‘_RS_’.”” for the record separator.

$xls_data = text_to_excel( file      => '/path/to/file.txt',
delimiter => "",
recordsep => "",
name => 'NULL delimited file' );