LINUX INTERVIEW QUESTIONS

xxxxxxxxxxxxxxxxxxxxx  Linux Interview Questions xxxxxxxxxxxxxxxxxxxxxx

I know for a beginner how tough to find which types of question an interviewer will ask to ?? ...

Ohhh!!! I can't forget myne 1st interview with Directi for Linux profile ...I was aware of all the questions answers that they asked me, but because lack of confidence and theoretical knowledge about topics  have missed that opportunity...

==>> Below are some interview questions from my interview journey hope it will help you bit.....

00.00 >> Off course!!! "Tell me something about yourself"? an annoying question?  Any way any how you have to face this question ...

Don't loose your confidence here say frankly all about your technical background present and past except about your family..also give only that answer that related to your education knowledge and achievements ..... don't say to much aggressively which create negative impression towards like "apne hank rha hai.. isse to dekh lunga tech que me!!!  '(';')'   '(';')

1>  Diff between RHEL 4 & 5 ?
2>  About boot process in sort?
3>  Types of DNS?
4>  how dns works?
5>  what is squid?
6>  port number of data ftp, ftp, telnet, smtp, sql
7>  what is sendmail hows it's works
9>  How to block downloading in squid
10> How you handle Load on server?
11> Fields in crontab?
12> Any backup tools you know?
13> what is amanda why to use?
14> How to update your server?
15> rpm commands to update, erase, install etc...
16> Use squid to do authentication of users on browser?
17> Use of NFS and samba?
18> Diff NfS & Samba?
19> What is SeLinux?
20> Default cache size in Squid?
21> I want to assign NISdomainname via DHCP is it possible how?
22> How to setup networking IP doaminname etc...
23> What is & Difference between find and grep
24> About Raid tool used & level diff
25> I want to do remote login how?
26> Use of NIS?
27> Use of Log files?
28> I sent a mail but lost how to find it where is ..?
Some other
- How to find which user surfed which site? squid not log file
- which command you use for maintaining system info to submit to your manager?
- How you reduce load on your server
- tools used to check system load and performance
- Do you know anything about DHCP on windows server
- Application that you much like can confident about that
- In sort what you know in Linux
- Can you compile C program in linux how?
- about Linux shell scripting any other scripting language you know
-
Another that some asked to me?
1> why i hire you?
2> what is mean and responsibilities of a sys admin
3> why you chose Linux as career?
4> About your current job and responsibilities
5> After doing job in diff field near about 2 years why you want to move your path
6> Why Linux not Windows?  :)
7> What is your strength?
8> Do you have any question?
9> Anything that you want to ask?
10> What is your exception?
11> expected salary?
12> notice period how soon you can join?

Our HR department will inform you -- Why this?? :(

Some exact questions i don't remember so i just written in sort!!!

================== Some more1s>

1> Size of MBR, fields in MBR, PT size in MBR
2>  Dir /abcd have 744 perm to user but file /abcd/file1 has 777 permission can a normal
 user edit file1, if no why?
3>  What happen if a deleted /boot/lilo.conf and restarted the system and
       What if deleted /boot/grub.conf and restart the system ???
4>  what called #! /bin/bash
5>  There a parameter in vsftpd conf file without which vsftpd server will not work
6>  Diff GRUP & LILO techinical DIFF ...
7>  Can we authenticate only users login on vsftpd by LDAP how
8>  Port number SAMBA, DHCPD, SQUID, DNS, POP, POP, NTP on secure level, IMAP on secure level,  sendmail on secure level, Postfix..
9>  Diff TCP/UDP
10> What are 7 Layers TCP/IP eg of each
11> Fields in DNS
12> USe of ip_farwording
13> where is config file of sshd service.
14> what is tunnel
15> What is mutt
16> fields in top command meanings
    1>load average 2> %id     3> Mem: 4> SWAP
17> What is the use of swap partition
18> can we encrease swap partition size how
19> syntax of for loop in bash
20> awk stand for
21> can we change vsftpd default directory location
22> Can we change Default Directory in apache
23> Can we use index.php insted of index.html as default page in apache how .
24> visudo command will open file?
25> Diff RHEL & CentOS
26> Diff LILO GRUB
27> Advantages of GRUB
28> What is iptables, Firewall, netfilter ..?
29> write iptable to block use of sshd service via port 22 from outside of range 192.168.8.10-192.168.8.50
30> Tables in iptables
31> what is cluster & virtualizaton just basic, what you understand by term..
32> what is domain and hostname concept.
33> can a system have multiple hostname/domainname how?
34> How many virtual ips you can assign to a single interface.
35> What is netmask/ broadcast IP ?
36> What is inode in Linux
37> What is Raid5, advantage of Raid5 over Raid4 over Raid1 over Raid0
39> Can we safely delete /usr/shares  Impacts ?
40> Use of loge levels ?
41> What is suid, guid and sticky bit
42> Can you open multiple vi on same terminal at a time
43> What is sed command, any advantage
44> Use of KILL and KILL command
45> Use KILL command to reload a service eg: HTTPD
46> What s vlan
47> How to find number of users on your system
48> Find port use by a process
49> Find file's opened by a process
50> what is fork and prefork
51> What is sticky bit, suid, guid, when to use which
52> Ramdisk when and how to use?
53> Diff Samba and NFS
54> What is tcpdump, when and how to use.
55> print whole file other than cat
56> 2 adv. dis. of ext2 ext3 ext4
57> Can we mount ext-ext3, ext3-ext2, ext2-ext4 ,, ext4-ext3, ext3-ext4, ext4-ext2
58> What is hub, switch and router
59> What is datadump and coredump
60> What is segmentation fault
61> What is diff between Single user mode and Emergency mode
62> How to downgrade an rpm .
63> How to rebuild rpm db
64> List files in rpm
65> reinitialize file permission of an installed rpm
66> Active and Passive FTP
67> What is getopts how it's work
68> Diff Shell Login and Intractive Login
DNS,
1> What is SOA record
2> What is MX record
3> nslookup, check which entry first
4> use of nsswitch.conf





II. Sample Linux interview questions

1. How secured is Linux? Explain

2. How documentation of an application is stored?

3. How shadow passwords are given?

4. How do you create a new user account?

5. Which password package is installed for the security of central password?

6. What’s wrong with sendmail? What would you fix?

7. What command do you run to check file system consistency?

8. What’s wrong with running shutdown on a network?

9. What can be wrong with setuid scripts?

10. What value does spawn return?

11. 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?

12. What is the difference between UDP and TCP?

13. What is DNS?

14. What does nslookup do?

15. How do you create a swapfile?

16. How would you check the route table on a workstation/server?

17. How do you take a single line of input from the user in a shell script?

18. Write a script to convert all DOS style backslashes to UNIX style slashes in a list of files.

19. Write a script to list all the differences between two directories.

20. Write a program in any language you choose, to reverse a file.

21. What are the fields of the password file?

22. What does a plus at the beginning of a line in the password file signify?

23. Using the man pages, find the correct ioctl to send console output to an arbitrary pty.

24. What is an MX record?

25. What is the prom command on a Sun that shows the SCSI devices?

26. What is the factory default SCSI target for /dev/sd0?

27. Where is that value controlled?

28. What happens to a child process that dies and has no parent process to wait for it and what’s bad about this?

29. How do you find which ypmaster you are bound to?

30. How do you fix a problem where a printer will cutoff anything over 1MB?

31. What is the largest file system size in solaris? SunOS?

32. What are the different RAID levels?

33. What made you choose to apply to Linux?

34. What have you learned from your past jobs?

35. Why did you leave your last job?

36. Tell me about your last position and what you did?

37. What do you know about the position of Linux?

38. What are key tasks for Linux?

39. What are top 3 knowledge/top 3 skills for Linux?

40. What are KRAs/output of position: Linux?

41. How to measure/appraise your position: Linux?

42. What do you know about this company?

43. Describe two or three major trends in your field?

44. Did you choose this profession/field?

45. What tertiary qualifications have you attained that related to Linux?

46. What is the most recent skill you have learned that related to Linux?

47. What are your strengths and weaknesses?
If you liked this post, please share it to your friends:


- which command you use for maintaing system info to submit to your manager?
- How you reduce load on your server
- tools used to check system load and performance
- Do you know anything about DHCP on windows server
- Application that you much like can confident about that
- In sort what you know in Linux
- Can you compile C program in linux how?
- about Linux shell scripting any other scripting language you know

Another that some asked to me?
1> why i hire you?
2> what is mean and responsibilities of a sys admin
3> why you chose linux as career?
4> About your current job and responsibilities
5> After doing job in diff field near about 2 years why you want to move your path
6> Why Linux not Windows?  :)
7> What is your strenght?
8> Do you have any question?
9> Anything that you want to ask?
10> What is yor expection?
11> expected salary?
12> notice period how soon you can join?

Our HR department will inform you -- Why this?? :(

Some exact questions i don't remember so i just written in short!!!

1>  size of MBR, fields in MBR, PT size in MBR
2>  Dir /abcd have 744 perm to user but file /abcd/file1 has 777 permission can a normal
    user edit file1, if no why?
4>  what called #! /bin/bash
5>  There a parameter in vsftpd conf file without which vsftpd server will not work
6>  Diff GRUP & LILO techinical DIFF ...
7>  Can we authenticate only users login on vsftpd by LDAP how
8>  Port number SAMBA, DHCPD, SQUID, DNS, POP, POP, NTP on secure level, IMAP on secure level,
    sendmail on secure level, Postfix..
9>  Diff TCP/UDP
10> What are 7 Layers TCP/IP eg of each
11> Fields in DNS
12> USe of ip_farwording
13> where is config file of sshd service.
14> what is tunnel
15> What is mutt
16> fields in top command meanings
    1>load average 2> %id     3> Mem: 4> SWAP
17> What is the use of swap partition
18> can we encrease swap partition size how
19> syntax of for loop in bash
14> awk stand for
15> can we change vsftpd default directory location
16> Can we change Default Directory in apache
16> Can we use index.php insted of index.html as default page in apache how .
17> visudo command will open file?
18> Diff RHEL & Centos
19> Diff LILO GRUB
20> Advantages of GRUB
21> What is iptables, Firewall, netfilter ..?
22> write iptable to block use of sshd service via port 22 from outside of range 192.168.8.10-192.168.8.50
23> Tables in iptables
24> what is cluster & virtualizaton just basic, what you understand by term..
25> what is domain and hostname concept.
26> can a system have multiple hostname/domainname how?
27> how many virtual ips you can assign to a single interface.


Install spamassassin with sendmail

Install spamassassin with sendmail

1. Install spamassassin on the server
# yum install spamassassin -y

2. Install required perl CPAN modules
# perl -MCPAN -e shell
cpan> install Digest::SHA1
cpan> install HTML::Parser
cpan> Install option perl modules...

3. Edit spamassassin configuration in /etc/mail/spamassassin/local.cf .
# vim /etc/mail/spamassassin/local.cf
# Encapsulate spam in an attachment (0=no, 1=yes, 2=safe)
report_safe 0

# Enable the Bayes system
use_bayes 1

# Enable Bayes auto-learning
bayes_auto_learn 1

# Enable or disable network checks
skip_rbl_checks 0
use_razor2 1
use_dcc 1
use_pyzor 1

# Mail using languages used in these country codes will not be marked
# as being possibly spam in a foreign language.
ok_languages all

# Mail using locales used in these country codes will not be marked
# as being possibly spam in a foreign language.
ok_locales all

4. Tell procmail to run spamc on everyone's mail. Add these to /etc/procmailrc :

DROPPRIVS=yes

:0fw
| /usr/bin/spamc

5. Restart spamassassin
# service spamassassin restart 

how to Recover /etc/fstab file

Recover /etc/fstab file


If you have deleted the /etc/fstab file it is possible to recover it in the following way:
# cat /proc/mounts > /etc/fstab
# chmod 644 /etc/fstab


The "proc" filesystem, which is /proc/mounts, is used to handle sytem configuration parameters, it is a virtual filesystem.

Useful commands for Windows administrators


Useful commands

for Windows administrators

Managing a Windows 2000 Active Directory with about 100 servers, over 1500 computers and 35 sites, the following commands often helped me answer questions or solve problems.
Most commands are "one-liners", but for some I had to make an exception and go to the right directory first.

These commands could all be used in batch files, though some may need some "parsing" with FOR /F to retrieve only the required substrings from the displayed information.

Notes:
(1)
Commands that use external, or third party, or non-native utilities contain hyperlinks to these utilities' download sites.

(2)
Replace command arguments displayed in italics with your own values.

(3)
Commands or utilities that require Windows Server 2003 are marked bright blue.
Warning:

Most commands on this page are very powerful tools.
Like most powerful tools they could cause a lot of damage in the hands of insufficiently skilled users.
Treat these commands like you would (or should) treat a chainsaw: with utmost care. 
Do not use them if you do not fully understand what they do or how they do it.
Any damage caused using these commands is completely your own responsibility.



How many users are logged on/connected to a server?

Sometimes we may need to know how many users are logged on to a (file) server, like maybe when there is a performance degradation.
At the server's console itself, with native commands only:

    NET SESSION | FIND /C "\\"
Remotely, with the help of SysInternals' PSTools:
    PSEXEC \\servername NET SESSION | FIND /C "\\"
By replacing FIND /C "\\" by FIND "\\" (removing the /C switch) you'll get a list of logged on users instead of just the number of users.


Who is logged on to a computer?

We often need to know who is currently logged on to a remote computer.
With native Windows (up to and including XP) commands only:

    NBTSTAT -a remotecomputer | FIND "<03>" | FIND /I /V "remotecomputer"
The first name in the list usually is the logged on user (try playing with the NET NAME command to learn more about the names displayed by NBTSTAT).
This is the 
fastest way to find the logged on user name, and the results that you do get are correct, but NBTSTAT won't always return a user name, even when a user is logged on.
Note:
Unfortunately, NBTSTAT is no longer available in Windows 7 (not sure about Vista)
Using WMIC (Windows XP Professional and later):
    WMIC /Node:remotecomputer ComputerSystem Get UserName
This is arguably the most reliable (native) command to find out who is logged on.
With the help of SysInternals' PSTools:
    PSLOGGEDON -L \\remotecomputer
or:
    PSEXEC \\remotecomputer NET CONFIG WORKSTATION | FIND /I " name "
or:
    PSEXEC \\remotecomputer NET NAME
or for Windows XP only:
    PSEXEC \\remotecomputer NETSH DIAG SHOW COMPUTER /V | FIND /i "username"
Using REG.EXE (Windows 2000 and later):
    FOR /F %%A IN ('REG Query \\remotecomputer\HKU ˆ| FINDSTR /R /B /C:"HKEY_USERS\\S-1-5-[0-9][0-9]-[0-9-]*$"') DO (
               FOR /F "tokens=3 delims=\" %%B IN ('REG Query "\\remotecomputer\%%A\Volatile Environment"') DO (
                       SET LoggedinUser=%%B
               )
        )
or for Windows 7:
    FOR /F %%A IN ('REG Query \\remotecomputer\HKU /K /F "S-1-5-21-" ˆ| FINDSTR /R /B /C:"HKEY_USERS\\S-1-5-[0-9][0-9]-[0-9-]*$"') DO (') DO (
               FOR /F "tokens=2*" %%B IN ('REG Query "\\remotecomputer\%%~A\Volatile Environment" /V "UserName" ˆ| FIND /V ":"') DO (
                       SET LoggedinUser=%%C
               )
        )
NETSH and WMIC are for XP or later, and are the most reliable of all commands shown here.
WMIC requires WMI enabled remote computers and Windows XP on the administrator's computer; NETSH requires Windows XP on the local and remote computers.
PSLOGGEDON is a more accurate solution than NBTSTAT, but it will return the last logged on user if no one is currently logged on.
The NET and NBTSTAT commands show more or less identical results, but the NBTSTAT command is much faster.
The REG command is accurate, but may need to be modified depending on the version used.
As displayed here, the code is written for REG.EXE 2.0 (Windows 2000) and later.
More information on REG versions can be found on my REG Query page.

For Windows NT 4 and 2000: use NBTSTAT (fast, but it won't always return the user name!), and only switch to REG if NBTSTAT doesn't return a user name (modify the REG command for Windows NT 4).
For Windows XP: if you want to search lots of computers for logged on users, I recommend you try 
NBTSTAT first (fast, but it won't always return the user name!), and only switch to NETSH, REG or WMIC (accurate) if NBTSTAT doesn't return a user name.
For Windows Vista and later: use 
REG or WMIC (accurate).
Credits: Jiří Janyška (WMIC command) and Matthew W. Helton (NETSH command).


What is this collegue's login name?

My collegues often forget to mention their logon account name when calling the helpdesk, and the helpdesk doesn't always ask either. I suppose they expect me to know all 1500+ accounts by heart.
With (native) Windows Server 2003 commands only:

    DSQUERY USER -name *lastname* | DSGET USER -samid -display
Note:
Windows Server 2003's "DSTools" will work fine in Windows 2000 and XP too, when copied.
Keep in mind, however, that 
some Windows Server 2003 Active Directory functionality is not available in Windows 2000 Active Directories.


What is the full name for this login name?

With the native NET command:
    NET USER loginname /DOMAIN | FIND /I " name "
With (native) Windows Server 2003 commands:
    DSQUERY USER -samid *loginname* | DSGET USER -samid -display
Note:
The NET command may seem more universal, because it requires neither Active Directory nor Windows Server 2003 commands, but it is language dependent!
For non-English Windows you may need to modify FIND's search string.


What groups is this user a member of?

In Windows NT 4 and later, users usually are members of global groups. These global groups in turn are members of (domain) local groups. Access permissions are given to (domain) local groups.
To check if a user has access to a resource, we need to check group membership 
recursively.
With (native) Windows Server 2003 commands:

    DSQUERY USER -samid loginname | DSGET USER -memberof -expand


What permissions does a user have on this directory?

One could use the previous command to check what permissions a user has on a certain directory.
However, sometimes 
SHOWACLS from the Windows Server 2003 Resource Kit Tools is a better alternative:
    CD /D d:\directory2check
        SHOWACLS /U:domain\userid


When did someone last change his password?

With the native NET command:
    NET USER loginname /DOMAIN | FIND /I "Password last set"


How do I reset someone's password?

With the native NET command:
    NET USER loginname newpassword /DOMAIN
With (native) Windows Server 2003 commands:
    DSQUERY USER -samid loginname | DSMOD USER -pwd newpassword
Note:
To prevent the new password from being displayed on screen replace it with an asterisk (*); you will then be prompted (twice) to type the new password "blindly".


Is someone's account locked?

With the native NET command:
    NET USER loginname /DOMAIN | FIND /I "Account active"
The account is either locked ("Locked") or active ("Yes").


How to unlock a locked account

With the native NET command:
    NET USER loginname /DOMAIN /ACTIVE:YES
or, if the password needs to be reset as well:
    NET USER loginname newpassword /DOMAIN /ACTIVE:YES


Make sure a local user's password never expires

With WMIC (Windows XP Professional or later):
    WMIC.EXE /Node:remotecomputer Path Win32_UserAccount Where Name="user" Set PasswordExpires="FALSE"


Make sure a local user's password will expire

With WMIC (Windows XP Professional or later):
    WMIC.EXE /Node:remotecomputer Path Win32_UserAccount Where Name="user" Set PasswordExpires="TRUE"


List all domains and workgroups in the network

With the native NET command:
    NET VIEW /DOMAIN


List all computers in the network

With the native NET command:
    NET VIEW
or, to list the names only:
    FOR /F "skip=3 delims=\     " %%A IN ('NET VIEW') DO ECHO.%%A
delims is a backslash, followed by a tab and a space.


List all domain controllers

With native Windows 2000 commands:
    NETDOM QUERY /D:MyDomain DC
NETDOM is part of the support tools found in the \SUPPORT directory of the Windows 2000 installation CDROM.
With (native) Windows Server 2003 commands (Active Directory only):
    DSQUERY Server
or, if you prefer host names only (tip by Jim Christian Flatin):
    DSQUERY Server -o rdn


Find the primary domain controller

With native Windows 2000 commands:
    NETDOM QUERY /D:MyDomain PDC
or, to find the FSMO with (native) Windows Server 2003 commands (Active Directory only):
    NETDOM QUERY /D:mydomain.com FSMO
NETDOM is part of the support tools found in the \SUPPORT directory of the Windows 2000 installation CDROM.


List all member servers

With native Windows 2000 commands:
    NETDOM QUERY /D:MyDomain SERVER
NETDOM is part of the support tools found in the \SUPPORT directory of the Windows 2000 installation CDROM.


List all workstations

With native Windows 2000 commands:
    NETDOM QUERY /D:MyDomain WORKSTATION
NETDOM is part of the support tools found in the \SUPPORT directory of the Windows 2000 installation CDROM.


Delete a computer account

With native Windows 2000 commands:
    NETDOM /DOMAIN:MyDomain MEMBER \\computer2Bdeleted /DELETE
NETDOM is part of the support tools found in the \SUPPORT directory of the Windows 2000 installation CDROM.


"I need an up-to-date list of disk space usage for all servers, on my desk in 5 minutes"

Sounds familiar?
With (native) Windows XP Professional or Windows Server 2003 commands:
    FOR /F %%A IN (servers.txt) DO (
               WMIC /Node:%%A LogicalDisk Where DriveType="3" Get DeviceID,FileSystem,FreeSpace,Size /Format:csv | MORE /E +2 >> SRVSPACE.CSV
        )
The only prerequisites are:
  1. SRVSPACE.CSV should not exist or be empty,
  2. a list of server names in a file named SERVERS.TXT, one server name on each line,
  3. and WMIC.EXE, which is native in Windows XP Professional, Windows Server 2003 and Vista.
The CSV file format is ServerName,DeviceID,FileSystem,FreeSpace,Size (one line for each harddisk partition on each server).
If you have a strict server naming convention, SERVERS.TXT itself can be generated with the NET command:
    FOR /F "delims=\    " %%A IN ('NET VIEW ^| FINDSTR /R /B /C:"\\\\SRV\-"') DO (>>SERVERS.TXT ECHO.%%A)
Notes:
(1)
assuming server names start with "SRV-"; modify to match your own naming convention.

(2)
delims is a backslash, followed by a tab and a space.


List all drivers on any PC

With (native) Windows XP Professional or Windows Server 2003 commands:
    DRIVERQUERY /V /FO CSV > %ComputerName%.csv
Or, for remote computers:
    DRIVERQUERY /S remote_PC /V /FO CSV > remote_PC.csv


List all printers on any PC

With (native) Windows XP+ commands:
    WMIC /Node:remote_PC Path Win32_Printer Get DeviceID


List all local administrators

With (native) Windows NT 4+ commands:
    NET LOCALGROUP Administrators
Or, to remove header and footer lines:
        FOR /F "delims=[]" %%A IN ('NET LOCALGROUP Administrators ˆ| FIND /N "----"') DO SET HeaderLines=%%A
        FOR /F "tokens=*"  %%A IN ('NET LOCALGROUP Administrators') DO SET FooterLine=%%A
        NET LOCALGROUP Administrators | MORE /E +%HeaderLines% | FIND /V "%FooterLine%"


Locate rogue DHCP servers

Never had an "illegal" router wreaking havoc on your network yet...?
With a (native) Windows Server 2003 command:
    DHCPLOC -p local_IP_address [ valid_DHCP_server1 [ valid_DHCP_server2 [ .. ] ] ]
DHCPLOC.EXE is native in Windows Server 2003, and will run in Windows XP if copied/installed.
I didn't test this in Windows Server 2003 yet, but in Windows XP you need to press "d" to start the discovery, or "q" to quit.



Disable Windows Firewall for domain only

Disable the firewall only when the computer (e.g. a laptop) is connected to the domain:
    NETSH Firewall Set OpMode Mode = DISABLE Profile = DOMAIN


Completely disable Windows Firewall (not recommended)

Disable the firewall comletely (not recommended unless an alternative enterprise firewall is used that requires you to do so):
    SC [ \\Remote_computer ] Stop SharedAccess
        SC [ \\Remote_computer ] Config SharedAccess start= disabled


Is IP v4 supported on this computer?

Check if IP v4 is supported on the local computer:
    PING 127.0.0.1 | FIND "TTL=" >NUL 2>&1
        IF ERRORLEVEL 1 (ECHO IP v4 NOT supported) ELSE (IP v4 supported)
or:
    WMIC Path Win32_PingStatus WHERE "Address='127.0.0.1'" Get StatusCode /Format:Value | FINDSTR /X "StatusCode=0" >NUL 2>&1
        IF ERRORLEVEL 1 (ECHO IP v4 NOT supported) ELSE (IP v4 supported)
The WMIC command is faster, but requires Windows XP Professional or later.


Is IP v6 supported on this computer?

Check if IP v6 is supported on the local computer:
    PING ::1 | FINDSTR /R /C:"::1:[ˆ$]" >NUL 2>&1
        IF ERRORLEVEL 1 (ECHO IP v6 NOT supported) ELSE (IP v6 supported)
or:
    WMIC Path Win32_PingStatus WHERE "Address='::1'" Get StatusCode >NUL 2>&1
        IF ERRORLEVEL 1 (ECHO IP v6 NOT supported) ELSE (IP v6 supported)
The WMIC command is faster, but requires Windows XP Professional or later.