sun solaris command tips

15
Sun Solaris Command Tips All commands are specific to Sun Solaris operating system UNIX backups/Restore Commands to take backup of /usr /var /lib directories to tape and disk using "tar" ANS: a) tar -cvf /dev/rmt/0 /usr /var /lib [Taking into tape ] b) tar -cvf backup_file.tar /usr /var /lib [ Taking disk image] Taking backup to a tape device attached to a remote system ANS: a) tar -cv /var /usr /lib | rsh remote_hostname dd of=/dev/rm/0 obs=128 b) ufsdump 0ucf remote_hostname:/dev/rmt/0 /file_system Extracting / Restore the contents of a tape /tar file ANS: a) tar -xvf /dev/rmt/0 [ restore contents of a tar tape ] b) tar -xvf filename.tar [ Restore contents of a tar file ] c) ufsrestore f /dev/rmt/0 filename [Restore from ufsdump tape backup] d) ufsrestore rf remote_hostname:/dev/rmt/0 filename [ Restore from remote host tape device ] List contents of backup ANS: a) tar -tvf /dev/rmt/0 [ List contents of a tar tape ] b) tar -tvf filename.tar [ List contents of a tar file ] c) ufsrestore tf /dev/rmt/0 [ list contents of a tape of ufsdump] Processes and Processor What are the types of priority classes supported by Solaris ? ANS: timesharing, system and reat-time How will you place a running process in real time class? ANS: priocntl -s –c RT –I uid process_id_number How will you start a process in real time class? ANS : priocntl –c RT –e process_name

Upload: babji-shaik

Post on 27-Oct-2014

40 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Sun Solaris Command Tips

Sun Solaris Command Tips

All commands are specific to Sun Solaris operating system

UNIX backups/Restore

Commands to take backup of /usr /var /lib directories to tape and disk using "tar"

ANS: a) tar -cvf /dev/rmt/0 /usr /var /lib [Taking into tape ]

b) tar -cvf backup_file.tar /usr /var /lib [ Taking disk image]Taking backup to a tape device attached to a remote system

ANS: a) tar -cv /var /usr /lib | rsh remote_hostname dd of=/dev/rm/0 obs=128

b) ufsdump 0ucf remote_hostname:/dev/rmt/0 /file_systemExtracting / Restore the contents of a tape /tar file

ANS: a) tar -xvf /dev/rmt/0 [ restore contents of a tar tape ]

b) tar -xvf filename.tar [ Restore contents of a tar file ]

c) ufsrestore f /dev/rmt/0 filename [Restore from ufsdump tape backup]

d) ufsrestore rf remote_hostname:/dev/rmt/0 filename [ Restore from remote host tape device ]

List contents of backup

ANS: a) tar -tvf /dev/rmt/0 [ List contents of a tar tape ]

b) tar -tvf filename.tar [ List contents of a tar file ]

c) ufsrestore tf /dev/rmt/0 [ list contents of a tape of ufsdump]

Processes and Processor

What are the types of priority classes supported by Solaris ?

ANS: timesharing, system and reat-time

How will you place a running process in real time class?

ANS: priocntl -s –c RT –I uid process_id_number

How will you start a process in real time class?

ANS : priocntl –c RT –e process_name

How will you bind a process to processor ?

Ans: pbind –b processor_no process_id

Network

Page 2: Sun Solaris Command Tips

What is the pocket size used by SQL*NET Version 2 on Solaris

Ans : Default is 2K

What is the procket size used by network layer TCP/IP in SQL*NET v2?

Ans : Default 1K

Inter process communication (IPC) tuning

What is post wait driver ?

The post wait driver reduces the overhead incurred by the more expensive use of semaphore operation for interprocess communication.

Memory

What is the kernel parameter which controls the UNIX buffer cache on solaris ?

Ans : bufhwm ( bufhwm is the maximum amount of physical memory, in kilobytes that can be used by

I/O buffers)While starting an oracle process , the unix system displays an erro message like "Cannot allocate more shared memory segment for the processes" If oracle person approaches you, how will you fix this problem?

ANS: increase the value for kernel memory parameter "set semsys:seminfo_semmns" in /etc/system file. [ this is a blind way]

System configurations

How do you find out total RAM installed on your machine

Ans: $prtconf |grep size

How do you find no. of processors installed on your sun box and processing speed?

Ans: $psrinfo –v

How do you find out how many disks are available on your system?

Ans: $ format (for sysadmins)

$ iostat –E (for users – count only the disks which has disk size correctly)

System Boot Options

How do you boot sun box in single user mode?

ANS: At ok prompt type "boot -s" [ ok boot -s OR ok boot -1 OR ok boot -S ]

What are the commands to shutdown the system?

ANS: shutdown, init , halt, reboot

Page 3: Sun Solaris Command Tips

Devices

What is the meaning of logical name of a disk drive format like c0t0d0s0?

ANS: c0 - Controller number

t0 - SCSI bus target number

d0 - Disk number

s0 - Partition or slice number

List some of the main device types?

ANS: /dev/dsk - Disk devices

/dev/rdsk - Raw or character devices

/dev/rmt - Tape devices

/dev/term - Serial line devices

/dev/pts - Pseudo terminals

List commands to display physical devices ?

ANS: prtconf

Sysdef

Dmesg

sysinfo

Thoughtful SolutionsCreatively Implemented and Communicatedhttp://www.thoughtful-solutions.info/Basic Solaris CommandsQuick Reference CardConventions<CR> RETURN key<ESC> ESCAPE key<DEL> DELETE key<Ctrl-X> press <Control> key and type xitalics items to be replaced by your ownrequirementsShell Commandspasswd Change passwordlogout End terminal sessionFile Hierarchycd dir1 Change to directory dir1ls List files in directoryls -l List files in detailmkdir dir1 Create new directory dir1

Page 4: Sun Solaris Command Tips

rmdir dir1 Remove directory dir1cp f1 f2 Copy file f1 to f2mv f1 [f2…] dir1 Move files f1 to fn to directorydir1mv dir1 dir2 Rename directory dir1 as dir2rm filename Delete (remove) file filenameln file1 name Create a hard link to file1 callednameln -s file1 name Create a soft link to file1 callednamepwd Show path to current directoryGetting Helpman name Show man page for commandnameman -k subject Show man pages relating tosubjectman -s# subject Show man page relating tosubject in section number #man -s# Intro Show introductory man page forsection #File types and Listingfile filename Classify the filestrings filename Show any ASCII strings in a filecat filename Display contents of file to STDOUTmore filename Display contents of file onescreenful at a timehead filename Display first 10 lines of filehead -n filename Display first n lines of filetail filename Display last 10 lines of filetail -n filename Display last n lines of filetail -f filename Recursively display last 10 lines offilecut Extract character or fields fromtextwc filename Count lines, words and charactersin filediff f1 f2 Find differences between two filesdiff3 f1 f2 f3 Find differences between 3 filessort filename Sort file alphabetically by firstletteruniq Report or filter out repeated linesRedirectionSTDIN Standard Input, typically thekeyboardSTDOUT Standard Output, typically thescreenSTDERR Standard Error, where errors aresent. Typically the screencomm > file Output of comm creates filecomm < file Contents of file used as input tocommcomm 2> filename Error messages from comm sent tofilecomm >> filename Output from comm appended tofilecat file <<EOF Create a document called filedata… containing dataEOFcomm1 | comm2 Output from comm1 used as inputto comm2mkfifo name Create a named pipe called name

Page 5: Sun Solaris Command Tips

mknod name p Create a named pipe called nameFile Securitychmod mode filenameChange security settings on filechown user [:group] filenameChange owner [and owning group] offilechgrp group filenameChange owning group of fileumask mode Set default creation permissionsSymbolic modesMode Meaning Mode Meaningu user r readg group w writeo other x executea all u+s setuid= assign g+s setgid+ add +t sticky bit- removeOctal modesBase directory mode is 777. Base file mode is 666user group otherr w x r w x r w x4 2 1 4 2 1 4 2 17 7 7Shell WildcardsMetacharacterMeaning* Any character? Any single character[ ] A range of charactersThis work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, visithttp://creativecommons.org/licenses/by-sa/2.0

Interview Question & Ans:

Sort By :   Latest First  |  Oldest First  |  By Rating

Question Rating View Answer

View Answer

What is the big difference between /dev/dsk and /dev/rdsk View Answer

Page 6: Sun Solaris Command Tips

What are the main differences between solaris 10 and 9? View Answer

What would a XIR signal do to a server and why would it be used? View Answer

What is sticky bit in Solaris? View Answer

What is the big difference between /dev/dsk and /dev/rdsk View Answer

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

View Answer

Back to Sun Solaris OS Interview Questions and Answers page Question : What file controls global variables for system wide values for the Bourne Shell?

View Answer

Is it legal to have static initializer blocks in EJB? View Answer

How can we find RAM size in solaris server ? View Answer

Which NFS daemons are found on the NFS server? View Answer

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

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

View Answer

Which obp command has a premenent allais? View Answer

How would you find out what kernel parameter SHMMAX is set to by one command?

View Answer

I have a couple of questions. 1) If in solaris 8 one server has more than one network interface cards, how do you determine which is primary? 2)In solaris 8 how do you determine how many Ram cards exist in a server and in which slots are they inserted?

View Answer

What is diffrence between Process and Daemon? View Answer

How to find 32 or 64 bit system instances of OS? View Answer

How do you determin which Run Level the sytem is running View Answer

What is "Piping"? View Answer

Page 7: Sun Solaris Command Tips

Posted by: Vincent    

Contact Vincent

Single User mode: Single user mode is for trouble shooting purpose, in this mode only root user can login to the system.Multi User Mode: In this mode apart from root user other user can also login to the system and they can access resources and applications of the system.

Posted by: Basha    

Contact Basha

Single userSolaris OS single-user mode with critical file systems mounted and accessible, Maintenance Only root user can access.Multi userThe system is supporting multiuser operations. Multiple users can access the system. All system daemons are running except for the Network File System (NFS) server and some other network resource server related daemons.

Posted by: C. ANTHONY FRANCIS    

Contact C. ANTHONY FRANCIS

In multiuser mode NFS server & client services are available whereas in single user mode, no NFS service is available and only root filesystem is available.

Posted by: parag pisolkar    

Contact parag pisolkar

Single user mode is the maintenance mode where only systems critical files are mounted. Multiuser mode is running the server with full network services including NFS.

Page 8: Sun Solaris Command Tips

Posted by: Rahul Agarwal    

Contact Rahul Agarwal

Single User Mod or Run Level s or S, Solaris OS single-user mode with critical file systems mounted and accessible.

Multi User Mode or Run Level 3,The system is supporting multiuser operations and has NFSresource sharing and other network resource serversavailable.

Main difference between these two level is as follows.

1). Network Services will not work in Single user mode.2). Network Services will work in Multi user mode.

Posted by: Farhan A Azam    

Contact Farhan A Azam

1. Single usermode ; Is used for Administrative activities.2, Mukti user mode ; is used for normal operations means running any applications, database etc.

Posted by: G.Umakanth    

Contact G.Umakanth

In single user mode , all the system services will not be available such as NFS and other services,moreover only a single user can login at a time, where as in multiuser mode all the services will be available including NFS and multiple users can log in at a time. In single user mode the run level is S where as in multiuser mode the runlevel is 3

Posted by: nawazhussain    

Contact nawazhussain

Page 9: Sun Solaris Command Tips

In single user mode it is possible to maintin the system or trouble shooting the system.

Posted by: sv suresh    

Contact sv suresh

single user mode is an administrative mode . the root user only can login. it is also known as maintenance mode. multiuser mode is default mode in solaris bcoz all services available in this mode. from singleusermode we cannot communicate network machines.but from multiusermode we communicate over the network.

Posted by: premnivas    

Contact premnivas

In single user, critical file system will be mounted and where as multi user mode we can access nfs and it is default run level.

Posted by: Raja Rajan    

Contact Raja Rajan

In single user mode we can perform administrative tasks and it is maintenance mode. Multi user mode runs the server with full network and services including nfs

Posted by: fazal    

Contact fazal

Single usermode ; Is used for Administrative activities.2, Mukti user mode ; is used for normal operations means running any applications, database etc.

Posted by: wadood    

Contact wadood

Page 10: Sun Solaris Command Tips

Single user mode use to perform the administrative task,we can only access the local file system,

Multi usermod is the defult login mode so we can access all local as well as network file file system,

Main difference is thatNetwork Services will not work in Single user mode.Network Serviceses will work in Multi user mode.

Posted by: Sameer Patil    

Contact Sameer Patil

single user mode: In this only root user can login to the system and critical file systems are mounted. This can be used for trouble shooting purpose.IN this NFS not working.

Multi user mode: This is run level 3. In apart from root user other users also login and access the file systems including NFS.

#who -r ----> this command shows we are in which run level

Solaris interview questions

By admin | April 24, 20051. 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.

Page 11: Sun Solaris Command Tips

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

6 Coll Interview:

Partition sizes can be set manually or from what configuration?

View Answer

Page 12: Sun Solaris Command Tips

what command do you run after modifying the aliases file make the chages active ? how do enable logging on a UFS filesystem?

View Answer

What is the difference between a probe-scsi and a probe-scsi-all?

View Answer

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

View Answer

How many cpus we can connect to a spark machine in Solaris?View

Answer

Search for a sample string in particular files?View

Answer

Explain about kadmin command?View

Answer

What command enables a printer?View

Answer

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

View Answer

What would a XIR signal do to a server and why would it be used?

View Answer

Display the last newly appending lines of a file during appendingdata to the same file by some processes ?

View Answer

Explain about the command ls?View

Answer

What is sticky bit? View

Answer

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

View Answer

What is after the VTOC on the root filesystem?View

Answer

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

View Answer

Page 13: Sun Solaris Command Tips

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.

View Answer

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

View Answer

How would you find out what version of Solaris is currently running?

View Answer

What is difference between Process and Daemon in Solaris?