Solaris basics


Published on

1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Solaris basics

  1. 1. Prepared by –
  2. 2. What is Solaris?"Solaris" is Sun Microsystems version of Unix Operating System, based on AT&Ts System V Unix,with a lot more features and improvements. Over the years, it has been one of the most popularUNIX environments being used at the enterprise level.Learning Solaris, as of learning any other flavour of UNIX, seems a daunting task for a beginner,because of its unfriendly and cryptic commands and not knowing where to look in case some help isneeded. The best way to start learning Solaris (or any UNIX or Linux for that matter) is to understandthe principles or philosophy behind its design. Once that is understood, you can see its elegance,power and versatility. Then understand the basic concepts, commands and tools that give you theconfidence in using Solaris. With this foundation, you can move on to learn intermediate andadvanced level commands and concepts.Simple commands:1. Check the process:# ps -ef | grep processnameex-http, httpd etc.2. check the disk space:# df -h3. check the OS version:# uname -r , uname -a4. Detec hardware problems:# fmadm faulty5. Add user:# useradd name6. Set password:# passwd name
  3. 3. 7. Using swathttp://localhost:9018. make directory:# mkdir /share (share is the name of the directory)9.Change the owner of file to user# chown user file10. Change files owner to user and group to group#chown fileNote: chown can only be used by root.11. chomod commands:chmod g+r file Allow group to readchmod u+w file Allow user to writechmod a+x file Allow everyone (user, group, and other) to executechmod o-r file Disallow others to readchmod ug+r file Disallow others to readchmod g+w,o-r file Allow group write, disallow other readchmod u=rw file Set user permissions to read and write.Add up the values for the rights required.r 4w 2x 1
  4. 4. For example: converting rwxr-x--- to octal:7 = 4+2+1 = r + w + x5 = 4+1 = r + x (not write)0 = no rightsSo rwxr-x--- is 750 in octal12. What is the sticky bits purpose?The sticky bit has a different meaning, depending on the type of file it is set on:# sticky bit on regular files:If an executable file is prepared for sharing, mode bit (-t) prevents the system from abandoning the swap-space image ofthe program-text portion of the file when its last user terminates. Then, when the next user of the file executes it, the textneed not be read from the file system but can simply be swapped in, thus saving time.# Sticky bit for network files:Local paging. When applications are located remotely, set the "sticky bit “on the applications binaries, using the chmod +tcommand. This tells the system to page the text to the local disk. Otherwise, it is "retrieved" across the network.#The most common use of the sticky bit today:The most common use of the sticky bit today is on directories, where, when set, items inside the directory can be renamedor deleted only by the items owner, the directorys owner, or the superuser. (Without the sticky bit set, a user with writeand execute permissions for the directory can rename or delete any file inside, regardless of the files owner.)Frequently this is set on the /tmp directory to prevent ordinary users from deleting or moving other users files.#chmod +t directory Set the sticky bit on a directory#chmod -t directory Remove the sticky bit from a directory13.Delete a file.# rm /directory/file-to-be-deleted14. To change the modification time of a file (the time displayed in a long listing of the file) of a filecalled testfile to November 18, 2000, 2:30 PM, use the following command:# touch -t 200011181430
  5. 5. 15.find out ethernet interface name.# inconfig -a16. In most UNIX systems, startup scripts in /etc/rc3.d, etc, are used to start and stop services.Solaris 10 uses a different approach.There are two advantages to the Solaris 10 method:The system can come up faster, because startup of various systems can be done in parallel. The system knows more aboutwhat is going on. It can monitor processes and restart them. Services are managed by svcadm. The most commoncommands are :With Solaris 10, general purpose SMF CLI tools (such as svcadm and svcs):# svcadm enable SERVICE# svcadm disable SERVICE# svcadm restart SERVICE# svcadm refresh SERVICETo look at services, two common commands aresvcs {lists summary of all}svcs -l SERVICE {details on one service}17.Enable Firewall (Ipfilter)#svcadm enable network/ipfilter18. SHELL COMMANDS:Shell CommandsMost commands default to using the current directory.pwd show the current directory, eg "pwd" may print "/home/kim"cd change current directory, with no arguments will change to your home directoryls shows files in current directoryls foo shows files in directory "foo" or the file "foo"ls *.html shows files in the current directory ending in .htmlls -l shows details of files
  6. 6. ls -a show all files, including files beginning with "."tree -d show directory structureless display a file on screenman where to find help on any commandmount show all file systems currently mounted, or add a file system to the tree, eg "mount -t vfat /dev/fd0 /floppyumount un mount a file system, eg "umount /dev/fd0" or "umount /floppy"id show which groups you belong tochmod change permissions on files19.umount un mount a file system,#umount /dev/fd0 or umount /floppy20. Show Free space:# df -h show the free space on all file systems# du -h show how much disk space each directory uses21. Devices:/dev/hda = First IDE disk (master device on first IDE channel) typically this is your hard disk/dev/hdb = the slave device on the first IDE controller/dev/hdc = the master device on the second IDE controller (typically your CDROM)22. Change the owner of file to user# chown user file23. Groups in UNIX:Name: eg usersNumber (gid): eg 100, used internally by the kernelDefined in /etc/groupaudio:x:29:kim,jason
  7. 7. The columns in /etc/group are:a.Group name, eg audiob.Encrypted group password, or x if the password hash is stored in /etc/gshadowc.Group number (gid), eg 29d.List of user name for people who are members of this group24. Change files group to group.# chgrp group file25. Add existing user pranab to group called km.# usermod -G km pranab26.Delete the group:# groupdel groupname27. Rename group:#groupmod -n newgroup oldgroupThese were some of very basic commands to get started, but it takes a lot of dedication and practiceto master the art of managing UNIX like operating systems.