Skip to content

Command List for Windows and Unix

Important UNIX and Windows commands for use.

Quite an old collection and some commands can be irrelevant now and for some commands expecting MKS tool kit or Cygwin on Windows.

1) To know the Ethernet and other Ip address details:
> ipconfig /all —- for Windows Desktop
> ifconfig -a —- for Solaris and Linux Desktop

2)To check the protocol and N/W statistics
> netstat -rn

3) To know whether a system is alive and know its ip-address:
> ping -s host-name for Solari/Linux workstations
> ping hostname  for Windows workstations

4) Find a file/directory in command line
> find (./dir-name) -name “hello.java”
> find (./dir-name) -name “hello.java” -print
> find (./dir-name) -type d –> This will list the fully qualified directory name inside dir-name name.

5)Remote login to a machine
> rlogin hostname/ipaddress in Win/Solaris/Linux

6)Telnet into a machine(Windows)
> telnet hostname/ipaddress

7) Information of Threads for a particular Process
ps -LP “process-id”

8)To mount a file system in Linux
U shd be at the point of sqindia/export
$ for i in 1 2 3 4 5 6 7 8 9
> do
> mkdir disk0$i
> mount sqindia.india.sun.com:/export/disk0$i disk0$i
>done

9)Find the disk space in Solaris
df -k will show total space mounted
du -k shows the space used

10)To create a Symbolic link
ln -s oldfilename(from what) slinkname(to here)

11)To Set CLASSPATH variable in Solaris and Linux
ksh> set CLASSPATH=classpath1:classpath2:classpath3:.
ksh> export CLASSPATH
ksh> export CLASSPATH=classpath1:classpath2:classpath3:.
In Windows:-
ksh> set CLASSPATH=classpath1;classpath2;.

12) To set the Path variable
ksh / sh > setenv PATH path1:path2:path3:$path:. ****In Solaris and Linux
> export PATH

> setenv PATH=path1;path2;path3;%path%;. ****In Windows

13)To find the processor configuration
> psrinfo -v ——- In Solaris
> prtconf
> prtconf -v
> eeprom

14)Find the system diagnostic info to find the error log
> dmesg — In Solaris

15)Find the patches that have been installed
showrev -p — In Solaris

16)To find the audio and videocards
$ sndconfig —-In Solaris for Sound cards
else check this file etc/modules.conf

17) Command to find whether a system supports which bit kernel
$ getconf HW_CPU_SUPP_BITS /// In Solaris and Linux
$ getconf KERNEL_BITS or: $ file /stand/vmunix

18) Command to find whether running 32 bit or 64 bit processor
$ isainfo

19) Command to recursively change the permissions of a directory
$ chmod -Rf  722 dir-name

20) Again few more points on system configuration
/usr/sbin/psrinfo
/usr/sbin/prtconf
RAM: prtconf | grep -i mem
CPU: mpstat
or
/usr/platform/`uname -m`/sbin/prtdiag
Try /usr/platform/`uname -m`/sbin/prtdiag. This will give you the amount of memory installed and speed and number of processors.

The command “prtconf” does it. If you want more and better details get sysinfo off the network.

dmesg | egrep ‘cpu|mem’

21) Get CPU, RAM and other etc info in Solaris and Linux
cat /proc/cpuinfo

22) ipcs – report inter-process communication facilities status

23) vmstat – reports virtual memory statistics regarding kernel thread, virtual memory, disk, trap, and CPU activity.

24) prstat – report active process statistics

25) /etc/logindevperm file help to set the drivers of the devices in the solaris environment.

26) mdb – modular debugger: The mdb utility is an extensible utility for low-level debugging and editing of the live operating system, operating system crash dumps, user processes, user process core dumps, and object files. For a more detailed description of mdb features, refer to the manual, Solaris Modular Debugger Guide.

27) kstat – disply kernel statistics: The kstat utility examines the available kernel statistics, or kstats, on the system and reports those statistics which match the criteria specified on the command line. Each matching statistic is printed with its module, instance, and name fields, as well as its actual value.

28) ptree – help to print the process in a tree hierarchical format.

29) mpstat – report per-processor or per-processor-set statistics

30) umask – get or set the file mode creation mask

31) rctladm – display or modify global state of system resource controls

32) arp – address resolution display and control

33) fmdump – fault management log viewer: The fmdump utility can be used to display the contents of any of the log files associated with the Solaris Fault Manager, fmd(1M). The Fault Manager runs in the background on each Solaris system. It receives telemetry information relating to problems detected by the system software, diagnoses these problems, and initiates proactive self-healing activities such as disabling faulty components.

34) dbx usage manual and commands :

%> dbx /java/jdk/latest/binaries/solaris/bin/java
(dbx) dbxenv rtc_inherit on # command needed for the leak checking to follow the fork/exec of child processes, which java does.
….
….
(dbx) check -leaks
….
….
(dbx) run -version
….
….
(dbx) cont

35) awk – pattern scanning and processing language
ls -l | awk ‘{print $2}’

36) sed – stream editor

>cat file
I have three dogs and two cats
>sed -e ‘s/dog/elephant/g’ -e ‘s/cat/tiger/g’ file
I have three elephants and two tigers

37) dump – dump selected parts of an object file
The dump utility dumps selected parts of each of its object file arguments.

The dump utility is best suited for use in shell scripts, whereas the elfdump(1) command is recommended for more human-readable output.

38) elfdump – dump selected parts of an object file
The elfdump utility symbolically dumps selected parts of the specified object file(s). The options allow specific portions of the file to be displayed.

The elfdump utility is similar in function to the dump(1) utility, which offers an older and less user-friendly interface than elfdump, although dump may be more appropriate for certain uses such as in shell scripts.

Archive files, produced by ar(1), can also be inspected with elfdump. In this case each object within the archive is processed using the options supplied.

39) ypcat hosts

ypcat helps to print all the hosts with its ipaddress in the local domain.

ypcat hosts | grep timetone

Prints the ipaddress and hostname of the timetone server.

40) /usr/ucb/ps -auxwww | grep java

This command should get you the whole command line for the running JVM including the memory settings.

41) ldd – list dynamic dependencies of executable files or shared objects
ldd /usr/lib/libc.so
libm.so.2 => /lib/libm.so.2
/platform/SUNW,Sun-Blade-1000/lib/libc_psr.so.1

42) nm – print name list of an object file

ldd /usr/lib/libc.so
libm.so.2 => /lib/libm.so.2
/platform/SUNW,Sun-Blade-1000/lib/libc_psr.so.1

nm /platform/SUNW,Sun-Blade-1000/lib/libc_psr.so.1 | grep memset

43) logname – command on Windows
Which gets you the current user-name.

$logname
Administrator

44) Remove tailing CTRL M characters from each line
In vi, do a :%s/^M//g
linux/solaris: dos2unix

Java Code on sqlplus

Trying something new. This blog page gives steps to write, compile and execute a piece of java code on sqlplus. So if you are lonely with no java compiler sqlplus got the answer to your java code.

Here it is.

Step-1: Write Java code by following below sql syntax.

ops@sqindia:/opt/10g > create or replace and compile java source
named “ABC”
2 as
3 import java.util.*;
4 import java.text.*;
5 public class ABC
6 {
7 static public void java_get_timezone( String[] p_timezone )
8 {
9 Date d = new Date();
10 DateFormat df2 = new SimpleDateFormat( “z” );
11
12 df2.setTimeZone( TimeZone.getDefault() );
13 p_timezone[0] = df2.format(d);
14 }
15 }
16 /

Java created

Step-2: Create a SQL procedure get_timezone which will create a java instance and call the particular method.

ops@sqindia:/opt/10g > create or replace
2 procedure get_timezone( p_timezone out varchar2 )
3 as language java
4 name ‘ABC.java_get_timezone( java.lang.String[] )’;
5 /
Procedure created.

3. Anonymous block to invoke the above created procedure.
ops@sqindia:/opt/10g > declare
2 tz varchar(25);
3 begin
4 get_timezone( tz );
5 dbms_output.put_line( tz );
6 end;
7 /
IST

Quite amazing; this facility really helps when you have only sqlplus in hand to validate a piece of java code.

Wisdom Education Trust

Straight from the inspiring note of Mr APJ Abdul Kalam “If I am authorized, I will remove the word impossible”. Yes I personally like this statement very much; nothing is impossible in this world. But I think only a healthy mind with good education will help an individual in handling the some thing called impossible.

In this context let me introduce a trust that is started by my old college mates. Which they call it “The Wisdom Education Trust” or WET in short. A non-profitable trust formed by 6 guys with great vision and working towards promoting the education in rural villages. The trust is started in January 2007 and main motto of this trust is to provide money, guidance to up lift the poor & intelligent students. The motto of the service says that “Education is the most powerful weapon in the entire universe.”. This is the second year for the WET after a very enriching success the last year; where in the last year the community found 15-20 deserving students. Provided them scholarships which basically includes paying tuition fees, providing books, giving guidance etc.

Deeply motivated by the fact recently I joined the trust and the process of finding deserving students is as follows:

1. Schools authorities send some nominations of students who are smart & intelligent but very poor.

2. The student data is checked & thoroughly verified.

3. Then a final list is prepared out of them who definitely require scholarships or economical support.

4. Funds are raised from friends to meet the current year requirements.

The domain for the WET is registered and found as http://www.wet-mission.com .

Wishing good luck for WET.

Boring evenings with out IPL

After the breath taking action for 45 days the Indian premier League (IPL) ended on Sunday 01 June and Rajasthan Royals emerged as the Winners of the tournament. As everybody knows that IPL is the cricket form of the English Premier League (EPL) and the UEFA Champions League; popular Soccer tournaments. The IPL is a very big hit in the cricketing world which brought lot of action, drama and money. A typical 20-20 game will last only for 3-3.5 hrs; which instilled non-stop and scintillating action to the game and to its enthusiasts.

I think the 20-20 version of cricket is really a great invention and it is threatening the popularity of one day format of the game. This made the first version of the IPL a big success and it left over good memories to cherish. The 20-20 will help in attracting the Europeans and Americans to the cricketing world; also help in globalizing the game.

Regarding the grand final of the tournament it was really electrifying till the last ball of the match. Each team fought to their skin and tried their level best to win. The match brought us the memory of the ICC Twenty20 world cup final between India & Pakisthan; where India emerged victorious of the world cup in the last over of the match. At one point of time I thought that the Chennai Super Kings upsets the Rajasthan Team. But Rajasthan’s winning consistency has paid off and emerged as winners of the tournament. The inspirational & legendary leg spinner Shane Warne lead the Rajasthan team; he didn’t lose his spin rhythm despite of his retirement from Cricket. And not the least the Chennai Super Kings skipper Dhoni need a special applause for his captaincy and he proved himself again as the Mr Cool & Composed of the cricketing world.

Evenings are great with IPL in full flow with atleast one match everyday and the tournament really was part of the evening plan. Anxiously waiting for next version of IPL in 2009.

Whats wrong with emails??

I have email accounts on gmail, hotmail and yahoo. And as its well known that each of these email provides are the heavy weights when it comes to providing email services. But recently I am find each of them not good when it comes to speed/performance. I feel there is something wrong with gmail as when I send an email from my work to my gmail account; the new email is not appearing in my gmail Inbox. And it is taking lot of time to reflect in the inbox and some times few hours. The same thing happens with yahoo some times. I personally feel hotmail is little better when compared with other providers. FYI I am using a reasonably good internet connection and also at my work I got a fast internet connection.

I don’t know reason for this kind of service; is it the no of email customers or email users traffic affecting the performance.

Yahoo! Missed Oppurtunity

Last weekend Microsoft rejected the Yahoo! merger deal and this news is very unexpected thought that atleast the two will sort out their differences on the table. Yahoo! was never really prepared to sell itself to the software company especially to Microsoft. On Monday May 5th; the Yahoo! shares are drubbing and falling sharply after the opening hours and now its trading ~24 dollars which is 4 dollars less to Fridays trading. If this situation continues for 1 more month the Yahoo! shares will surely go below $20 dollar mark which is definitely not a welcome news for Yahoo! board. Since the board tried to avoid the Microsoft takeover pill but not able to stop the downfall of the share value.

But the hostile take over price of $47.5 billion is a very good quotation for Yahoo! as the search and online advertising market is on a slight downfall after an unstable economics in America and also because of a possible economic recession in 2008/2009.

Well now Microsoft will certainly look at other potential advertising companies; may be it can give a try at Facebook, Digg, CNET, Infoseek etc. But I personally prefer the Microsoft merger with Apple and Facebook which basically clears the avenue for MS to social networking and IPODS or IPHONEs or MACs.

Know before you sip

Drinking Liquor is not considered as a holy thing. I m here just trying to differentiate different alcoholic beverages and this categorization might help in knowing the ingredients of each mixture and also the percentage of alcohol contained in each of them.

Much of the enjoyment of social drinking comes from a knowledge of the different types of alcoholic beverages available.
First here are a few common terms frequently misunderstood:

Alcohol (C2H5OH) the common ingredient of all liquor. There are many types of alcohol, but for beverages only ethyl alcohol is used. Of the several types of ethyl alcohol, those spirits distilled from grain, grapefruit and cane are the most common.

=> GRAIN NEUTRAL SPIRITS – tasteless., colorless alcohol distilled from grain
=> WINE – produced principally from the fermented juice of grapes. It can also be produced from other fruits. The alcoholic content of wine ranges from less than 14 per cent to 21 per cent.
=> BEER – Its categorized under beverages and there are basically 5 types of fermented malt beverages:
+ Lager Beer (about 3.6 % alcohol)
+ Light Beer/Dry Beer – alcohol content lighter than Lager Beer
+ Ale – Heavier & more bitter than Lager Beer (5% of alcohol)
+ Bock Beer – Constitute to about 6% of Alcohol; progressively heavier, darker, richer and sweeter than Lager beer or Ale.
=> Brandy – distilled from a fermented mash of grapes or other fruit.
=> GIN – distilled from grain, receives its flavor and aroma from juniper berries and other botanicals. Most gin are colorless.
=> RUM – distilled from the fermented juice of sugar cane, cane syrup and molasses.
=> VODKA – originally made in Russia, from potatoes; but in the United States, vodka is usually distilled from grain, primarily corn and wheat. Vodka is not aged; it is colorless and virtually tasteless and odorless.
=> Whiskey – distilled from a fermented mash of grain (usually corn, rye, barley or wheat), and then aged in oak barrels.

Warning: Drinking is injurious to your health whether its a beverage or alcohol.