DirectoryComputersBlog Details for "My SysAd Blog"

My SysAd Blog

My SysAd Blog
My UNIX-based blog covers a collection of tips for installations, programming, scripting, configuration, SQL, maintenance, troubleshooting, and command line syntax. What exactly is UNIX? Unix stands for UNiplexed Information and Computing System--ori
Articles: 1, 2, 3, 4, 5, 6, 7

Articles

ASCII, HTML and Conversion Tables - Decimal, Hexadecimal, Octal, Binary
2007-06-02 15:29:00
Here are two convenient lookup tables for ASCII and HTML. Also included is a conversion table for decimal, hexadecimal, octal, and binary. The tables are in Spanish and English.
More About: Tables , Sion , Html , Conversion , Version
Create a Crontab That Preserves Existing Entries
2007-06-02 12:27:00
I've had a few queries on how to create a new crontab that preserves the existing entries.You will need to ensure that the user making the edits has cron permissions -- check /etc/cron.d/cron.allow and /etc/cron.d/cron.deny. Note: for the first example, you may have to set the EDITOR variable. Here's the syntax.#cd /var/spool/cron/crontabs#crontab -l > esofthub#crontab -e esofthubmake your edits:wq!OR#vi esofthubmake your edits:wq!#crontab esofthubFYI: What do the six fields meanminute 1-60hour 0-23day of month 1-31month of year 1-12day of week 0-6 (zero is Sunday)Your edit/addition/scriptThe following entry will kick off every minute* * * * * echo "I'm kicked off every minute"
More About: That , Create , Exist , Preserves , Reserves
Download Solaris 10 Operating System at no Cost
2007-06-01 11:58:00
Get access to Solaris 10 software, the most advanced operating system on the planet -- at no charge.Join the Free Solaris ProgramGet the following free:Solaris 10 Download or Free Software KitSolaris 10 Entitlement DocumentSolaris How to GuidesAccess to Solaris Learning Centersand more...
More About: System , Operating System , Cost
Convert Decimal to Hexadecimal, Octal or Binary using typeset
2007-05-31 15:27:00
Here's a quick and dirty way of converting a decimal number to hexadecimal, octal, or binary. Below is an inline script followed by a normal shell script file.#ksh# for i in 100 102 103 104 105 110 1000> do>> typeset -i16 hex> hex=$i> print $i equals $hex in hexadecimal>> typeset -i8 oct> oct=$i> print $i equals $oct in octal>> typeset -i2 bin> bin=$i> print $i equals $bin in binary>>print> done 100 equals 16#64 in hexadecimal100 equals 8#144 in octal100 equals 2#1100100 in binary 102 equals 16#66 in hexadecimal102 equals 8#146 in octal102 equals 2#1100110 in binary 103 equals 16#67 in hexadecimal103 equals 8#147 in octal103 equals 2#1100111 in binary 104 equals 16#68 in hexadecimal104 equals 8#150 in octal104 equals 2#1101000 in binary 105 equals 16#69 in hexadecimal105 equals 8#151 in octal105 equals 2#1101001 in binary 110 equals 16#6e in hexadecimal110 equals 8#156 in octal110 equals 2#1101110 in binary 1000 equals 16#3e8 in hex...
More About: Convert , Types , Cima , Vert
Calculate with the Basic Calculator -- bc
2007-05-30 15:44:00
You can do simple command line calculations with the basic calculator, bc, such as add, subtract, multiply, division, modulus, sqrt, raise a number to a power, logarithms, exponential, compute sines, cosines, loops, functions, and more. Here are some really basic examples -- scale was used to represent precision. I have used the bc command while in the single user mode.#bc12-12012+122412*1214412/121scale= 312/121.00012%1202^38sqrt(12)3scale=3sqrt (12)3.46422/73scale=622/73.142857scale=10 22/73.1428571428
More About: Calculator , Basic , Late , Calculate
Exclude Files or Directories from an Archive using tar
2007-05-28 04:45:00
Sometimes you might want to routinely backup certain files or directories that are on a mass storage device (RAID), but you don't want to backup the entire RAID. You can do this by using the tar command's exclude option. You probably want to exclude the exclude and tarball files. Here's an example of its use.First I create the exclude file and give it an arbitrary name, filesDir_to_exclude#cat > filesDir_to_excludefilesDir_to_excludeeso fthub.tartemp1temp2temp2junklarge_directo rylarger_directorymassive_archive_directo ry...Control d#cd /raid#tar cvfpX esofthub.tar filesDir_to_exclude *
More About: Archive , Directories , Files , Archi , Tori
Encrypt and Decrypt the Contents of a File
2007-05-27 13:42:00
Here's a simple way to encrypt the contents of a message using the crypt command. The security level is fairly weak but it's not meant to be PGP. Here an example to encrypt and decrypt the contents of a file.To encryptEncrypt with mykey in the open# crypt mykeynot_encrypted_file>encrypted_filePro mpted for mykey # cryptnot_encrypted_file>encrypted_fileEnt er key:mykey To decryptDecrypt with mykey in the open# crypt mykeyencrypted_file | morePrompted for mykey # cryptencrypted_file | moreEnter key:mykeyMail the encrypted file as an attachmentUse a mail client such as Netscape, FireFox, or dtmail because it's easier to move the binary file.#dtmail
More About: File , Contents , Tent , Crypt , The Con
Remove the UNIX root Password
2007-05-26 16:41:00
From time to time, passwords are lost or forgotten - even root's password. One way of removing the root password is to boot to single user mode from an installation cdrom. Mount the /root partition and blank out the encrypted password field in the shadow file. Here's an illustration.ok boot cdrom -s#mount /dev/dsk/c0t0d0s0 /mnt#vi /mnt/etc/shadowroot:blank this field out:6445::::::daemon:NP:6445::::::bin:NP: 6445::::::...:wq!#cd /#umount /mnt#reboot -- -sChange the root password in single user mode#passwd root#exit
More About: Unix , Password , Pass , Sword , Root
How to do a Review and UNIX System Administration
2007-05-25 13:12:00
I've decided to take a page out of John Chow's "Make Money Online" anchor text campaign. It involves starting my own anchor text endeavor. ?My SysAd Blog? has a Google Page Rank of 5 which means it?s fairly popular. I will linkback to anyone who reviews this blog and uses the following anchor text: UNIX system administration. What?s in it for you? This blog gets several thousand unique visits per week (thanks Google), so there's a good chance the backlink will generate some traffic for your site and your site also gets a backlink on a PR5 blog. It?s that simple. Because I want to maintain my pithy post style, I will only process 5 links at a time. But first, here are some basic ground rules. Please don't bother reviewing my site if your site is related to the following genre: racist, sexist, gambling, pornography, scams, illegal pyramids/Ponzi schemes, pills/pharmacy/Viagra, or spammy type sites.Here are the instructions: My SysAd Blog is a simple HOWTO blog that deal...
More About: System , Unix , Review , Administration , Trat
Display the Address Space of a Process
2007-05-24 16:37:00
The pmap command is used to display the address space of process ID. It shows the specific allocation of private and shared memory in kilobytes and the permissions for each mapped file. We've used it to troubleshoot database issues with memory. Here's an example. pmap -x 25632563: in.telnetdAddress Kbytes Resident Shared Private Permissions Mapped File......-------- ------ ------ ------ ------total Kb 1792 1528 1120 408
More About: Space , Display , Proc , Pace
Drop a Sybase Database and its Device
2007-05-20 17:12:00
Occasionally, you may have to drop a Sybase database and its device. You will have to drop the database before dropping its device. Then confirm whether the database and device was dropped or not. Here's an example. #isql -Usa -Ppassword1>use master2>go1>sp_helpdb2>go1>drop database MYDB2>go1>sp_dropdevice MYDB_device2>go1>sp_helpdb2>go1>sp_helpde vice2>go
More About: Database , Device , Taba , Vice , Base
Extract the Contents of a Compressed Tar File
2007-05-18 11:25:00
A colleague of mine asked about extracting the contents of a compressed tarball into a particular directory. I suggested downloading the tarball into the /tmp directory. It was a fairly large tarball consisting of several hundred megabytes. Here's an example of what was done.#cd /tmp#zcat compressed_tarball.Z | (cd /export/opt; tar xvfp -)
More About: File , Contents , Esse , Extra , Trac
Identify Process Hierarchy for Application
2007-05-17 18:00:00
Occasionally, you might want to print out the process hierarchy for an application. This can be done using the ptree command. This command can print out the parent and child processes. Here?s an example of its use using Netscape?s PID.# ptree -a 5321 /etc/init - 274 /usr/dt/bin/dtlogin -daemon 292 /usr/dt/bin/dtlogin -daemon 311 /bin/ksh /usr/dt/bin/Xsession 356 /usr/dt/bin/sdt_shell -c unset DT; DISPLAY=:0; 359 -sh -c unset DT; DISPLAY=:0; /usr/dt/bin/dtse 372 /usr/dt/bin/dtsession 379 dtwm 404 /usr/dt/bin/dtexec -open 0 -ttprocid 2.16H6ao 01 371 1289 405 /usr/dt/bin/dtterm 407 /sbin/sh 531 ./netscape 532 ./.netscape.bin -xrm *appDir: /usr/dt/appconfig/n 534 (dns helper)
More About: Proc , Application , Process
Get Information on a Domain Name
2007-05-15 13:54:00
I was curious as to how many yahoo.com variations were out there. I used the whois utility, which is an Internet user name directory service, to ascertain that information.# whois yahoo.comWhois Server Version 1.XDomain names in the .com and .net domains can now be registeredwith many different competing registrars. Go to http://www.internic.netfor detailed information.YAHOO.COM.ZZZZZZ.MORE.INFO.AT .WWW.BEYONDWHOIS.COMYAHOO.COM.ZZZZZ.GET.L AID.AT.WWW.SWINGINGCOMMUNITY.COMYAHOO.COM .ZOMBIED.AND.HACKED.BY.WWW.WEB-HACK.COMYA HOO.COM.VNYAHOO.COM.VIRGINCHASSIS.COMYAHO O.COM.UNIQUELYUJEWELS.COMYAHOO.COM.TWIXTE ARS.COMYAHOO.COM.TWYAHOO.COM.SGYAHOO.COM. OPTIONSCORNER.COMYAHOO.COM.MXYAHOO.COM.MO RE.INFO.AT.WWW.BEYONDWHOIS.COMYAHOO.COM.J OSEJO.COMYAHOO.COM.JENNINGSASSOCIATES.NET YAHOO.COM.IS.N0T.AS.1337.AS.SEARCH.GULLI. COMYAHOO.COM.HKYAHOO.COM.ELPOV.COMYAHOO.C OM.DALLARIVA.COMYAHOO.COM.BRYAHOO.COM.BGP ETERSON.COMYAHOO.COM.AUYAHOO.COMThe registry database contains only .COM, .NET, .EDU domains andregistrars.
More About: Information , Domain Name , Form , Format
Nested Inline For Loop for Recursive Directory Creation
2007-05-11 06:12:00
The inline script will create 5 recursive directories and recursively change the directory permission bits to read, write and execute for the owner and for all others read and execute.Here's the syntax.#sh#cd to_creation_dir# for i in dir_1 dir_2 dir_3 dir_4 dir_5> do> for j in 2005 2006 2007> do> for k in jan feb mar apr may jun jul aug sep oct nov dec> do> for l in mon tue wed thu fri sat sun> do> for m in log1 log2 log3 log4 log5> do> mkdir -p $i/$j/$k/$l/$m; chmod -R 755 $i/$j/$k/$l/$m> done> done> done> done> done
More About: Directory , Creation , Nest , Line , Este
Add String to Filenames Using an Inline For Loop
2007-05-10 20:53:00
A friend of mine had about 500 files in a directory. Based on specific extensions, he wanted roughly 300 of them to have a prepended string attached. An inline script was used to accomplish the task. Here's a simple example.Here's the busy work part#ls *.specific_extension_1 > mylist#ls *.specific_extension_2 >> mylist#ls *.specific_extension_3 >> mylistor#ls *.specific_extension_1 *.specific_extension_2 *.specific_extension_3 > mylistNow for the inline for loop#sh#for filename in `cat mylist`domv $filename PREPEND_STRING$filenameecho $filename changed | tee -a /tmp/logfiledone
More About: Sing , Line , String , Ames , Names
Dump Sybase Database to Tape
2007-05-09 16:41:00
Obviously, it's always a good idea to backup your database to a spare system disk, RAID, or to another slice on the system disk. But I think it's equally important to backup the database to something offline, i.e. tape. If the tape hasn't been initialized before, you will have to add the keyword init. You will only have to do that once. Again, it's a fairly straightforward process. Here's the syntax.#isql -Usa -Ppassword1>use master2>go1> dump database MYDB to mytapealias with init2>go
More About: Database , Taba , Base , Sybase
Load Sybase Database From Tape
2007-05-09 15:55:00
On occasion, you may have to restore a database via tape. This is a fairly simple and straightforward task to perform. Here's the syntax to load a Sybase database from tape. First, get a list of the database filename(s) on the tape#isql -Usa -Ppassword1> load database MYDB from mytapealias with listonly2>goNext, restore the database from tape and then put it online1>use master2>go1>load database MYDB from mytapealias with file = 'MYDBXXXXXXX'2>go1>online database MYDB2>go
More About: Database , Load , Taba , Base
List Logged In Users on System
2007-05-08 12:55:00
Here are three handy commands to ascertain who is logged onto a local system. The first one is the who command, which provides a list of users. The second one is the whoami command. It shows the current user. The last command is the finger command, and it displays user information.The who command#whoThe whoami command#whoamiesofthubThe finger command#finger esofthubOther notable commands to ascertain logged in users on the network (rwho and rusers can bog large networks down due to broadcasts)The rwho command#rwhoThe rusers command#rusers
More About: System , List , Users , Stem
Lookup an Internet Protocol (IP) Address for a URL
2007-05-06 17:08:00
Sometimes it might be necessary to lookup an IP address for a URL. The nslookup command can provide you that capability. Here's an example.#nslookup some_urlname.comHere's the output of nslookupServer: xxx.xxx.net (DNS server)Address : x.x.x.1Non-authoritative answer:Name: xxxx.comAddresses: xxx.xxx.xxx.12 xx.xx.xxx.13 (the IP addresses for some_urlname.com)
More About: Internet , Lookup , Intern , Look
Define Two IPs on a Network Interface Card (NIC)
2007-04-30 13:36:00
A friend and I were talking about creating a virtual network connection. In this case, we were thinking about defining two IPs on one physical Network Interface Card (NIC). I will use the FastEthernet interface, hme, as an example.#vi /etc/hostname.hme0esofthubFor the virtual#vi /etc/hostname.hme0:1esofthub-virtEnsure that you populate the name service (files, nis, nis+, etc) with the virtual's IP address.
More About: Face , Fine
Create Virtual Screen Covering Two Monitors
2007-04-27 13:52:00
A few days ago, a customer asked me how to make two monitors act as one. To make this happen, Solaris has an option called xinerama, which allows the mouse and windows to traverse both monitors. The framebuffers must be the same type. Here's the syntax.#vi /etc/dt/config/Xservers:0 Local local_uid@concole root /usr/openwin/bin/Xsun :0 +xinerama -dev /dev/fbs/jfb0a -dev /dev/fbs/jfb0b -nobanner
More About: Screen , Ring , Monitor , Cover , Virtual
Copy Contents of One Tape to Another
2007-04-26 15:26:00
The dd command can also be used to copy the contents of one tape to another. Here's an example of the syntax. Obviously you will need two tape drives to accomplish this task.#dd if=/dev/rmt/0 of=/dev/rmt/1
More About: Contents , Another , Copy , Tent
Create a Clone Disk Drive
2007-04-26 15:05:00
You can use the dd (data dump) command to create a backup disk drive. It will create a mirror image, which includes the partition table, of your boot disk by copying it bit by bit. In the example below, I'm using slice 2 because it represents the entire disk. Here's the syntax.Disk to Disk (Ensure the disks are the same size)#dd if=/dev/rdsk/c0t10d0s2 of=/dev/rdsk/c0t11d0s2 bs=128 (default 512)Disk to Tape#dd if=/dev/rdsk/c0t10d0s2 of=/dev/rmt/0 bs=128
More About: Drive , Clone , Lone , Create
Change Filename Extensions with Inline Script
2007-04-24 15:48:00
I want to quickly change the filename extensions for a directory with hundreds of *.dta files. The extension will be changed from *.dta to *.dat. I will use a simple inline script to accomplish the task. Also, I want to set the file to read all. Here's an example.#cd /directory_with_datafiles#csh#foreach filename ( *.dta )?set base=`basename $filename .dta`?mv $filename $base.dat?end#chmod 444 *.dat
More About: Extensions , Change , Script , Name , Tension
Determine Why a Process is Hanging with truss
2007-04-20 17:55:00
The truss utility may help you determine why a particular process is hanging. The truss command executes the specified UNIX command, and then truss provides a data profile (trace) of the specified command's execution. It's a very useful troubleshooting tool. Here's an example below.#truss -d unix_command
More About: Mine , Proc , Process , Term
Repeat the Previous UNIX Argument
2007-04-18 15:46:00
Here's a handy shortcut. Instead of having to retype the argument of a previous command, I use this syntax. Below is an example of copying a SQL script directory to a backup directory on the RAID.#csh#ls -l /home/esofthub/scripts/user_sqlscript_dir #cp -pr !$ /raid/mybackup/.
More About: Unix
Repeat the Previous UNIX Command
2007-04-15 03:42:00
Here's a handy command to know, especially when the command line syntax is long. I've included an example for both c and ksh shell.For C shell#csh#vi this_is_a_very_long_filenametext:wq! (saves and quits vi)Repeats the command#!!For ksh shell#ksh#vi this_is_a_very_long_filenametext:wq! (saves and quits vi)Repeats the command (r is a built-in alias fc -e -)#r
More About: Unix , Comm , Command
Install a Solaris Boot Block
2007-04-13 11:04:00
Here's a convenient procedure to know. Usually after a recovery, I use it to install a server's or workstation's boot block. For most people, the second argument is a little difficult to remember. Here's an example.ok boot cdrom -s#/usr/bin/installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c1t1d0s0
More About: Tall , Bloc , Solaris , Block , Lock
Change Access and Modification Times on a File
2007-04-11 18:46:00
If you ever needed to arbitrarily change the access and modification times on a file, here's how to do it. I can see this being useful when you are performing a find event. You can also use a reference file to set the times on a target file or directory.Here's the time set to Apr 10, 2007 18:16 (6:16pm)#touch -t 200704101816 filename#settime -f reference_file target_filename
More About: Change , File , Access , Times , Modification
More articles from this author:
1, 2, 3, 4, 5, 6, 7
40530 blogs in the directory.
Statistics resets every week.


Contact | About
© Blog Toplist 2008 - SEO by FeWorks
eXTReMe Tracker