Exclusive Java Video Coming Soon !!! Info : All The Topics Include Core Java, Colletions, Jsp, Servlet, EJB, Struts, Etc . . UPDATE WILL HAPPEN EVERY DAY !!!
நமீதா வா இது . . . அடேங்கப்பா , தபு க்கு எண்ணா. . . ஆச்சு . . . , அழகு சென்னையின் அரிய புகைப்படங்கள் , SBI இணைய தளம் தாக்கப்பட்டது! , செக்ஸ் உறவுக்காக ரோபோட். . , நிர்வாண உடல்கள்! (Exclusive Photos)

Monday, December 29, 2008

Solaris Index


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 carefully.

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 | col –b > 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 execution.

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 $@

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 Example: ptree 1267

26. Show the working directory of a process ? - pwdx Example: pwdx 1267

27. Display the processes current open files ? - pfiles 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

Posted in: General, Networking, Unix/Linux |
15 Responses to “Solaris interview questions”

1. Alex Says:
May 6th, 2005 at 1:53 pm

I am looking to determine the total file size of my users, email the data daily, and have it reported in megs. I am using terminal and crontab sucessfully, but I can’t get the crontab entry to report the findings at the user account level. It seems to scan all the way to the end of a uses folder and then report that. Any suggestions?

Alex
2. Wing Says:
May 31st, 2005 at 4:23 am

I can’t install top in SunOS5.6 because of some administration issue.
Furthermore, prstat -a didn’t run in my SunOS5.6. I would like to know whether are there any alternatives for top command in SunOS5.6?

3. kumareasan Says:
June 27th, 2005 at 5:40 pm

pagesize, prtree, pfiles,pwdx,prstat this commends r not run in my system.
THE CORRECT COMMAND IS :
prtree : pstree(present user login tree)
pwdx : pwd(present working path)
prstate : pstat(present status)
Thank U
Regards,
Kumareasan
Linux Administrator in Tetra software India pvt ltd

4. Jeff Says:
July 22nd, 2005 at 9:18 am

This is pretty pathetic. Do folks actually expect candidates who can answer these questsions to be considered systems administrators in a Solaris environment?

Where’s the questions about OBP?
Where’s the questions about LOM?
Where’s the hardware questions?
Where’s the disksuite questions?
What about packages? Jumpstart? JASS? SunVTS? obdiag, prtdiag, fmthard?
What about slices versus disks?
Shared memory? What’s /etc/system for?
How about the ndd command? NFS? RPC?

5. Robert Says:
July 22nd, 2005 at 10:20 pm

I can’t install top in SunOS5.6 because of some administration issue.
Furthermore, prstat -a didn’t run in my SunOS5.6. I would like to know whether are there any alternatives for top command in SunOS5.6?

Tech Interviews comment by Wing

Can you tell me what the administration issue is? Have you tried going to sun freeware and get the top package for SunOS 5.6 you will need Gzip to uncompress the file. Then you just run pkgadd -d {path}package-name and it will install without any issues.

6. Robert Says:
July 22nd, 2005 at 10:22 pm

How do you vi a file that is too big for the buffer. E.G. When I try to vi a file it says that it is too big and will not work. I know I can use wordpad or someother editor but I am wondering if it can be done with vi. Thanks in advance.

7. Chris Says:
January 23rd, 2006 at 9:57 pm

Comment to comment no. 4, I used to think it was pathetic too, until I got those kind of questions in an interview here in Singapore.

8. Neil Hunt Says:
April 10th, 2006 at 11:15 pm

To sort by size in solaris use:
ls -l | sort -nk5

9. Rock Says:
April 25th, 2006 at 4:51 am

Just like we have “bdf” in HP-UX, is there any command in Solaris and Linux?

10. Rav Says:
October 28th, 2006 at 3:41 am

with respect to kumareasan comment :

Those commands are in Solaris and Solaris is not Linux. If command not working in your system means commands not exists :)

-Ravi

11. Suresh Says:
May 13th, 2007 at 11:06 pm

Rock said,

Just like we have “bdf” in HP-UX, is there any command in Solaris and Linux?

In Linux u can use “df -h”
I don’t know abt solaris i think u can use bdf in solaries

12. Sivakumar - ACCENTURE Says:
September 5th, 2007 at 2:35 pm

For Solaris you can use df -k as an alternate for bdf of hp unix

13. NamDesh Says:
May 12th, 2008 at 2:43 am

10. Display the processes, which are running under yourusername ?

ps -u

14. NamDesh Says:
May 12th, 2008 at 2:49 am

Display the processes, which are running under yourusername ?

the command can be used as : ps -u username, or ps -fu username which will give the complete details of the processes running under a user.

15. Sonu Says:
December 16th, 2008 at 3:30 pm

Answer for #1

You can use this script under solaris(using “quot” as fundamental of script:-

#!/usr/bin/bash

cp /etc/passwd /tmp/passwd
cut -f1 -d: /tmp/passwd>/tmp/userids
quot -h / /usr /var > /tmp/quotaall
for name in `cat /tmp/userids` ;
do
grep $name /tmp/quotaall | awk ‘{print $1}’ > /tmp/userusagelist
sum=0;
for i in `cat /tmp/userusagelist`;
do
sum=`expr $sum + $i`;
done
summbs=`expr $sum / 1024`;
echo “$name is using $summbs MB”
done

how we can configure remote desktop(i mean how we can see windows system present working desktop*as well as another os like linux )


What are the main differences between solaris 10 and 9?


According the SA-238 course book, the Boot PROM chip is permanently soldered to the main logic board (motherboard).


What is the command to do an interactive boot from the ok prompt?


Consider the following crontab entry: ?59 23 13 * 5 /wipe.disk? What time will this cronjob run?


How can i disable STOP+A utility on SUN machines, which brings system into OK> prompt???.

How do we know how many LAN cards we have in server?


What is "Piping"?


Where are the templates stored that are copied into the user's home directories for their personal customizations?


Which NFS daemons are found on the NFS server?

What SPARC emergency keyboard sequence will take the system to the ok prompt (forth monitor) but will send output to TTYA?


What file controls system wide password aging?


Which of the following can be an appropriate name for a cluster?


What flag used with patchadd will prevent a later back out by preventing patchadd from backing up files? If this flag is used, the patch cannot be removed.


What file do you put the umask setting in?


When using the admintool, the membership list for groups is separated by what?


Among the applications below, which one is not a client/server application?


What command will display the VTOC for disk c0t0d0s0?


In order to save a template in /etc/format.dat, what two steps must occur?


What command enables a printer?




What is lsof ?
lsof which stands for LiSt Open Files is Unix utility to list all open files and processes that opened them on Unix.

-
How to use LSOF ?

lsof | grep ( on Solaris,lsof is usually installed under /usr/local/bin where as on Linux its usually under /usr/sbin )

Beware if you are on Solaris 10 and using ZONES(more on zones in solaris 10 coming soon) :
1. lsof doesn’t work from non-global zone in solaris 10
2. Use -z option with lsof to list open files & processes with in non-global zone like “lsof -z”
3. Solaris 10 with zones list doesn’t display port , hence I used script mentioned at end of this post.

Once you know PID using specific port, you can either stop it or terminate using
kill -9

Key points for lsof on solaris

1) Installation procedure of lsof on solaris is same for Solaris Sparc or X86 & on version 9 or 10 only difference is file name

2) lsof doesn’t work from zone (More on zones in solaris 10 coming soon), You have to install lsof on global zone. If you run lsof and get error message like “lsof: can’t stat(/devices): No such file or directory” probably you are running lsof with in solaris 10 Zone.

3) lsof on solaris is installed under /usr/local/bin (default location)

4) On Solaris 10, using “lsof -i” to show mapping of processes to TCP ports incorrectly shows all processes that have socket open as using port 65535. (Use script mentioned at end of file in such cases)

How to install lsof on Solaris 10
lsof is part of Red Hat Linux (By default its installed under /usr/sbin), for Solaris lsof is available as freeware here for Solaris Sparc 10 download it from here

1. Download lsof executable for Solaris 10 on sparc from here or from here if you are on different processor or version.

2. Upload zip file like lsof_0606-4.77-sol10-sparc-local.gz to server

3. Unzip as gunzip lsof_0606-4.77-sol10-sparc-local.gz (This will create file like lsof_0606-4.77-sol10-sparc-local)

4. pkgadd -d lsof_0606-4.77-sol10-sparc-local (Run this command from root user from global zone)

If you are on Solaris 10 use below script to list port

create file like get_pid_from_port.sh (Or download script from here)

#!/bin/bash
# is the port we are looking for

if [ $# -lt 1 ]
then
echo “Please provide a port number parameter for this script”
echo “e.g. %content 1521?
exit
fi

echo “Greping for your port, please be patient (CTRL+C breaks) … “

for i in `ls /proc`
do
pfiles $i | grep AF_INET | grep
if [ $? -eq 0 ]
then
echo Is owned by pid $i
echo ——
fi
done

and execute this script like
sh get_pid_from_port.sh
sh get_pid_from_port.sh 8000




What file contains the location of the namespace configuration textfiles such as hosts.rev, named.local, etc..?


Which of the following commands can tell you whether packets are being delayed or dropped on your network?


What file controls global variables for system wide values for the Bourne Shell?


Partition sizes can be set manually or from what configuration?


The hardware-level user interface that you see before the operating system has been started is called:


Give the command that will display your default boot device.


How many different kill signals are there?


What software install group do you need to select in order to load the compilers?


The NVRAM is also soldered to the main logic board or motherboard.


What command will install the patches: 123456-01 and 123457-01 if both are located in the /just.patches directory?


Consider the following crontab entry: ?59 23 13 * 5 /wipe.disk? What time will this cronjob run?


What command can you use to display all of your groups?

What field will cause the message Your password has expired to be displayed to the user?

What is the command for seeing a long listing of all the processes running on your unix box?


What is sticky bit?


How do you check the cron jobs of other users, (as a super user)


What does this file /etc/path_to_inst contain and what is the importance of this file


What is the command can reconfigure devices with out reboot?


How to restore a corrupted file system or trouble shoot bad super blocks for a FS c0t2d0s5


How will you add a virtual IP address to a server. Given the interface qe0 and IP 10.10.1.150

0 comments:

Post a Comment

SEO
SEO