Friday, June 19, 2009

Configuring Printer and commands Solaris interview questions and Answers

Configuring Printer Services

/etc/lp -- Directory contains a hierarchy of LP server configuration directories and files
/var/spool/lp -- Directory contains a list of current requests that are in the print queue.
/var/lp.logs -- On going history of print requests
/var/lp/logs/requests -- Completed print request job
$HOME/.printers file to set default printer (_default printername)
/etc/printers.conf -- Contains entry for printers

# lpadmin –p printerB –c -- Creating and adding printer class
# lpadmin –p printerD –c bldg2 -- Adding printerD to bldg2 class
# accept -- To queuing print request
# lpstat –t -- To check the status of the new printer class
# lp –d myfile -- To print myfile to printer class

# lpadmin –d printername (or) printer_classname -- To set it as default
# lpstat –d -- To check the system’s default printer
# lpadmin –d bldg2 -- To change the default printer
# lpadmin –x printername -- To remove a client’s printer configuration

# /usr/sadm/admin/bin/printmgr & -- Print Manager

Removing a Server’s Printer Configuration

# reject printerD -- Stop queuing print requests
# disable printerD -- Stop the printer
# lpadmin –x printerD -- Delete the printer config from the /etc/lp/printers and

# /usr/lib/lpsched -- Print services started
# /etc/init.d/lp start -- Starting by script
# /usr/lib/lpshut -- Stop print services
# /etc/init.d/lp stop -- Stopping by script

Using Print Commands

# /usr/bin/lp filename -- Print to default printer
# /usr/bin/lp –d printername filename
# /usr/ucb/lpr filename
# /usr/ucb/lpr –p printername filename

LP Print Service Administration Command

# /usr/sbin/accept printerD -- Permits print requests to be queued
# /usr/sbin/reject –r “Replacing cartridge” printerD -- Stop queuing print requests
# /usr/bin/enable printerD -- Activates the specified printers
# /usr/bin/disable -- Deactivates the specified printers
# lpmove printerC printerA -- Moves print requests from one printerC to printerA
# lpstat –o -- Viewing print queue
# lpstat –a printerA -- To check whether it accepting print jobs
# lpmove printerC –32 printerC –33 printerA -- Moving individual print requests

Monitoring and User permissions Solaris interview questions and Answers.

Monitoring su Attempts

/etc/default/su -- File monitoring su login info

# CONSOLE=/dev/console -- Remove the comment (#) symbol. So that root can login
remotely by su command.
SULOG=/var/adm/sulog -- Specifies the file location of the log file

Controlling System Access

# /etc/default/login file

CONSOLE=/dev/console -- This line should be commented to login as root from remote system

PASSREQ=YES -- Enforces that each user should have password to login

/etc/ftpd/ftpusers -- Lists names of users prohibited from connecting to system through FTP
/etc/ftpusers -- Solaris 8

/etc/hosts.equiv & $HOME/.rhosts -- Files to determine if a remote user is allowed to access the local host, with the identity of a local user. This procedure first check /etc/hosts.equiv and then $HOME/.rhosts
hostname username

If a uses local host’s /etc/hosts.equiv file contains the host name ofa a remote host, then all regular users of that remote host are trusted and do not need to supply a password to login to the local host. Wherease the /rhosts file applies to a specific user

/etc/inetd.conf -- File used to control all services

# svcadm disable (or) enable ftp (or) telnet -- in solaris 10

# rsh
# rcp . -- To copy remote system file to local
# rcp $HOME:/file1 -- To copy local files to remote system

# chown user2 file7 -- To change owner of a file
# chown –R user2 dir4 -- To change ownership for folder and all its subfolders
# chown user3:class file7 -- Changing both the individual and group ownership in one shot

# chgrp class file4 -- To change the group ownership of a file or directory

Setuid Permission on Executable Files

When the setuid permission is set on an executable file, a user or process that runs this executable file is granted access based on the owner of the file.
# ls –l /usr/bin/su
_ rs r_xr_x 1 root sys ………….
The setuid permission displays as an “s” in the owners executable field. You should disallow the use of setuid programs or at least restrict their use

# chmod 4555 -- To set setuid permission on a executable.
# find / -perm –4000 -- To search for setuid files

Setgid Permission on Executable Files

When the process runs, it runs as if it were a member of the same group in which the file is a member. Also access is granted based on the permission assigned to that group
# ls –l /usr/bin/write
_ r _ r_sr_x 1 root …………. -- Displays as “s” in the group’s execute field

# chmod 2555
# chmod g+s -- To set setgid for a directory
# find / -perm –2000 -- To search for setgid files

Sticky Bit Permission on Public Directories

If the directory permission have the sticky bit set, a file can be deleted only by the owner of the file/directory or the root user.

# ls –ld /tmp
drwxrwxrwt 6 root sys …… -- Displays as “t” in the execute field for other.

# chmod 1777
# find / -type d –perm –1000 -- To search for sticky bit directory

Wednesday, June 17, 2009

Recording Failed Login Attempts Solaris interview questions and answers

Recording Failed Login Attempts

# touch /var/adm/loginlog -- File to log incorrect login. If a user tries to login 5 times
(default) with wrong password a entry is created here.
# chown root:sys /var/adm/loginlog
# chmod 600 /var/adm/loginlog

# /usr/ucb/whoami -- Current login name
# who am i -- Login name of the original user

Performing System Security solaris interview questions and answers

Performing System Security

# who -- List of users currently logged in to the local system. The command refers
/var/adm/utmpx to obtain information
# who –m -- Info about only the current terminal window

# rusers -l -- Displays a list of the users logged in on local and remote hosts.

# finger –m usera -- Displays info about the user and host name of user login session

# last -- Displays a record of all logins and logouts (/var/adm/wtmpx)
# last –n 5 reboot -- To view the last five system reboot times only

Performing User Administration Solaris Interview Questions and Answers

Performing User Administration

/etc/passwd -- 7 fields loginID:x:UID:GID:comment:home_dir:login_shell

0 - 99 UID -- Reserved system user accounts
100 – 60000 -- UID for users range
0 -- Root
60001 -- Reserved for the nobody account
60002 -- Reserved for noaccess account -- To generate error message
65534 -- nobody4 The anoynomous user account

/etc/shadow -- 9 fields loginID:password:lastchg:min:max:warn:inactive:expire:reserved
/etc/group -- groupname:group-pwd:GID:user-list

/etc/default/passwd -- Set values for the following parameters MAXWEEKS MINWEEKS
PASSLENGTH (valid entries are 6,7 & 8) WARNWEEKS

1970 –-> V4
1986 -- Sun released first OS (sunos1.0)

# useradd –u –g –G GID,GID,.. d /export/home/user300 –m –s /bin/ksh –c “Regular User” user300
# passwd user300
# useradd –d /export/home/user305 –m user305
# useradd user306

# usermod [-u uid [-o]] [-g gid] [-G gid] [-d dir] [-m] [-s shell] [-c comment] [-l newloginname] loginname
# usermod –l –d /export/home/ –m
# usermod –u user301 -- Change uid to 905
# usermod –s /bin/csh user301

# userdel user301 -- Delete the user account not the home dir
# userdel –r user301 -- Delete user id & home dir

# groupadd [-g gid [-o]] groupname
# groupadd –g
# groupmod [-g gid [-o]] [-n name] groupname
# groupmod –n
# groupmod –g 400 class -- Change GID to 400 for the group class

# groupdel group1

/etc/profile -- The Bourne, Korn and BASH shells execute this initialization file
/etc/.login -- The C shell looks for and executes this initialization file during logon.
There are no default global initialization files for the Z or TC shells

Bourne /etc/profile $HOME/.profile /bin/sh /etc/skel/local.profile
Korn /etc/profile $HOME/.profile /bin/ksh /etc/skel/local.profile
C /etc/.login $HOME/.cshrc /bin/csh /etc/skel/local.cshrc
$HOME/.login /etc/skell/local.login

Setting Environment Variables

Bourne or Korn shell VARIABLE=value; export VARIABLE
For example: PS1=”$HOSTNAME”; export PS1

C setenv variable value
For example: setenv LPDEST laserprinter

# id user301 -- Shows UID of the user & primary group
# id –a user301 -- Shows secondary group details also

# groups user300 -- Shows the users groups

# chown –R :grpname

# pwconv -- To sync passwd and shadow files.

/etc/skel -- Template files get copied once user id is created.

-- By default /etc/skel/.profile file don’t have any content.

Profile Order

/etc/motd file -- Message of the day

Creating New Run Control Scripts Solaris Interview Questions and Answers

Creating New Run Control Scripts

Create the script in the /etc/init.d directory and create links in the appropriate /etc/rc#.d directory for the run level in which the service is to be started and stop.

# vi /etc/init.d/filename
# chmod 744 /etc/init.d/filename
# chgrp sys /etc/init.d/filename
# cd /etc/init.d
# ln filename /etc/rc#.d/S##filename
# ln filename /etc/rc#.d/K##filename
# /etc/init.d/filename start -- To test the filename

# init 2 -- Switch the run level to 2

# shutdown -- Will moves to maintenance mode
# shutdown –y –g300 –i6 “The system is being rebooted” -- Reboots after 300 seconds.
Default is 60 sec

# shutdown –i0 (or) i5 (or) –i6

# halt -- Shutdown the system immediately to ok prompt
# poweroff -- Equivalent to init5
# reboot -- Equivalent to init6 -- These 3

Performing Boot and Shutdown Procedures

Solaris Interview Questions and Answers

Performing Boot and Shutdown Procedures

Run Levels

0 -- ok mode
s or S Solaris OE single user mode with critical FS mounted
1 -- Single user administrative state with access to all FS available
2 -- Multiuser can access the System . All sys daemons are running except NFS
3 -- Multiuser operations with NFS & N/W resource available
4 -- Reserved
5 -- Poweroff
6 -- Reboot

# who –r -- Shows current run level..

Boot Sequence

1. Boot PROM phase
2. Boot program phase
3. Kernel initialization phase
4. init phase

/etc/inittab -- id(S3) rstat(3) action(wait) Contains details about init levels

/etc/vfstab /etc/inittab /etc/system -- Important Files

/etc/system -- moddir root device and root FS config exclude forceload set

-- Always make a copy of /etc/system file before you edit the same. In case of problem , issue the interactive boot command : boot –a. When prompting for system file. Enter the path of backup file for /dev/null for a null configuration file.

/etc/init.d -- Directory contains many process or services like volume management

/sbin -- Each run level has an associated rc scripts located in this directory (eg /sbin/rc0)
The RC scripts rc0, rc5 & rc6 are hard linked to each other. Run control scripts are located in /etc/init.d directory and these files are hard-linked to corresponding run control sctipts in the .etc.rc#.d directories.

Monday, June 15, 2009

Boot PROM Commands Solaris Interview Questions and Answers

Executing Boot PROM Commands

# /usr/platform/’uname –m’/sbin/prtdiag –v -- To know the OpenBoot version

Stop+D -- Press this keys when system power is turned ON to switch to diagnostic mode
This key sequence is not available on a serial port terminal
Stop+N -- Press while the system is turned ON to set the NVRAM parameters to default
Stop+A -- To get into boot PROM

-- /etc/default/kbd - Remove the comment for the line KEYBOARD_ABORT=disable to
turn off Stop+A function inside OS. Then issue the command kbd –I

ok go -- To comeout of PROM prompt

ok banner -- Shows system configuration

ok printenv -- Shows all variables

ok reset-all -- Will save the changes and clear the buffer & reboot the system

ok .registers -- Displays the contents of the registers

ok show-devs -- Shows all device with physical path
ok devalias -- Shows currently available devices

-- In sparc if we change values. There is no option to come out without saving.

ok probe-ide -- Shows ide details and device connected
ok probe-scsi -- Shows scsi details and device connected
ok probe-scsi-all -- Identifies devices on all all SCSI buses
ok probe-fcal-all -- Identifies devices on all fibre channel loops

ok nvalias /pci@if,......................
ok nvunalias -- To delete alias name

ok show-disks -- Desplays and allows a selection of device paths
ok show-ttys
ok show-displays
ok show-nets
ok show-tapes

ok help -- Shows list of help
ok help floppy eject
ok test -- Runs self-test on specified systems

ok sync -- Manually attempts to flush memory and synchronize FS

ok boot -- Boot the system
ok boot –r -- Detect new devices (Reconfiguration boot)
ok boot –s -- Single user mode
ok boot –v -- Verbose mode – boot the system and shows the background details
ok boot –a -- Interactive mode. Prompt user for user input for all the process at boot time
ok boot –rv (or) –sv

ok printenv auto-boot?
ok printenv boot-device -- To know the variable details
ok setenv auto-boot? True -- To change value to true for “auto-boot?” variable
ok printenv diag-switch?
ok setenv diag-switch? True

ok set-defaults -- Reset all settings to factory default
ok setenv boot-device disk cdrom net
ok set-default boot-device -- Will reset the default value of boot-device variable

ok power-off -- Will switch off the system immediately

Inside OS

# eeprom -- Equivalent to printenv
# eeprom auto-boot
# eeprom auto-boot?=false
# eeprom diag-switch?=true

Managing Software Patches

Solaris Interview Questions and Answers

Managing Software Patches

Solaris9/PatchReport A summary of all patches for the solaris 9 OE release
9_Recommended.README Instruction for how to intall the recommended patch.

# showrev –p (or) # patchadd –p -- Will show installed patches

-- /var/sadm/patch - Info about all patches that are currently installed.

Patch Name 6 digit number-revision number (117753-01)

# /usr/bin/zcat 105050-01.tar.z | tar xvf -

# cd /var/tmp
# patchadd 105050-01 -- Will add patch

-- When you remove a patch, the patchrm command restores all files that were modified or replaced by that patch, unless
-- The patch was installed with the patchadd –d option (Which instructs the patchadd command not to save copies of files being updated or replaced)
-- The patch is required by the another patch
-- The patch has been obsoleted by a later patch

# patchrm 105050-01 -- Will remove patch

Installing Patch Cluster
# cd 9_Recommended
# ./install_cluster

-- /var/sadm/install_data/Solaris_9_Recommended_log

Package Administration Solaris Interview Questions and Answers

Package Administration

/var/sadm/install/contents file has all the details about installed packages.

# grep showrev /var/sadm/install/contents -- Will show whether showrev package is installed or not

/var/sadm/pkg directory maintains a record of all installed packages

# pkginfo | more -- Will show all installed packages
# pkginfo –l SUNWman -- Shows information about SUNWman package
# pkginfo –d /cdrom/cdrom0/s0/Solaris_9/Product | more -- To view info about pkg in CD

# pkgadd –d /cdrom/cdrom0/Solaris_9/Product SUNWxip --

# pkgchk SUNWman -- If the pkgchk command doesn’t display a message, it indicates the package was installed successfully
# pkgchk –v SUNWzip -- To list the files contained in a software package
# pkgchk –p /etc/shadow -- To determine if the contents and attributes of a file have changed since it was installed with its software package
# pkgchk –l SUNWman -- Lists info about selected diles that make up a package

# pkgrm SUNWzip -- Will remove the SUNWzip package

# pkgadd –d /cdrom/cdrom0/Solaris_9/Product –s spool SUNWzip
It will dump the SUNWzip package to /var/spool/pkg folder. Alternate path can be given instead of spool like /pkg etc.,

# pkgrm –s spool SUNWman -- Will delete the dumped SUNWman package from spool directory

# admintool & -- Tool (GUI) used to add users, printers, groups, softwares etc.,
# prodreg & -- Tool (GUI) to view installed packages as well as to install & uninstall packages.

Solaris 9 OE Installation and Upgrade options

Solaris Interview Questions and Answers


Solaris 9 OE Installation and Upgrade options

Solaris suninstall program
Solaris Web Start Installation software
Custom Jumpstart procedure
Solaris Web Start Flash Installation
Standard upgrade
Solaris Live Upgrade method

# grep METACLUSTER /var/sadm/system/admin/.clustertoc - To know cluster config

# cat /var/sadm/system/admin/CLUSTER - To know the installed cluster config

Mounts & Unmounts

Solaris Interview Questions and Answers

Mounts & Unmounts

# mount - Lists all of the mounted FS in the /etc/mnttab file

VFSTAB -Virtual File System Tab /etc/vfstab
device to mount device to fsck mount point FS type fsck pass mount at boot mount options
- /etc/mnttab file is an mntfs file that provides read-only info about mounted FS on the local host

- The /etc/vfstab file lists all the FS to be automatically mounted at system boot time, with the exception of the /etc/mnttab and /var/run FS

# mount /dev/dsk/c0t0d0s7 /export/home
Mount Options : read/write, setuid, intr, nologging and largefiles, xattr and onerror.

# mount –o option,option,… device_name mount_point
# mount -o ro /dev/dsk/c0d0s7 /p3 - Mount the partition read only.
# mount –o ro,nosuid /dev/dsk/c0t0d0s7 /export/home - Prohibit execution of setuid pgm.

In solaris 2GB is the large file limit. Use of nolargefiles option fails if the FS to be mounted contains large files.
# mount -o nolargefiles,noatime /dev/dsk/c0d0s7 /p3
nolargefiles - Won’t allow large files in this partition
noatime - Modification time stamp won’t get updated.

# mountall - Mounted local FS listed in the /etc/vfstab file

# mountall –l - If any FS has entry in the fsck pass field as – or 0 then it will get mounted without fsck checking. Otherwise fsck carried out before mounting

# fstype /dev/rdsk/c0t0d0s7 - To know the FS type

# mount –F hsfs –o ro /dev/dsk/c0t6d0s0 /cdrom - To mount CD-Drive

# mount –F pcfs /dev/diskette /pcfs

# umount /export/home or umount /dev/dsk/c0t0d0s7

# umountall - Will unmount local FS listed in /etc/mnttab except /, /usr, /proc, /dev/fd, /var, /var/run & /tmp

# umountall –l - To verify the FS listed in the /etc/mnttab

# fuser –c /p3 - Will show the process running on the partition
# fuser –ck /p3  Will kill the user processes

# umount –f /p3  Force the partition to unmount

# TERM=sun

# export TERM - Executes this 2 command to enable the VI editor to work properly

# ps –ef
grep vold
Vold is the daemon taking care of auto mounting CD-Rom.

# volcheck - Will check any media present in CD-Rom or Floppy drive

# /floppy/floppy0 - Floppy get mounted here automatically

# /cdrom/cdrom0 - CD-Rom get mounted here automatically

# /etc/init.d/volmgt stop (or) start

# eject cdrom - Will eject the CD-Rom if the vold is running

# fdformat –t dos /dev/rdiskette - To format a floppy with DOS mode

# fdformat - To format the floppy in Solaris Format.

Friday, June 12, 2009

Managing the Solaris OE File System

Solaris Interview Questions and Answers

Managing the Solaris OE File System

ufs – Unix FS hsfs – High Sierra FS pcfs – PC FS for DOS FAT32 FS
udfs – Universal Disk Format FS nfs - Network FS
Pseudo FS – Memory based FS tmpfs swapfs procfs mntfs

VTOC present in the first sector in the raw disk area.
VTOC - 512 sector

Boot Block - 1-15 sector
Super Block - 16-31
First Cylinder Group - 32

Creating File Systems

# newfs /dev/rdsk/c1d0s0 - Creating FS
# newfs –i 16384 /dev/rdsk/c1d0s0 - Creating FS with data block size 16KB

# mount /dev/dsk/c1d0s0 /p1 - Mounting partition in /p1 directory

# fstyp –v /dev/rdsk/c1d0s0
grep minfree
minfree 6% - To know the reserved disk space

# tunefs –m 2 /dev/rdsk/c1d0s0 - This will reduce the reserved space to 2%

# umount /p1 - To umount a partition.

Never run the fsck command on a mounted FS. The /, /usr and /var FS should have the fsck command run on them on single user mode

# fsck /dev/rdsk/c0td0s7 - To check the FS in interactive mode
# fsck –o f,p /dev/rdsk/c0t0d0s7 - f – forces p – preen or Non interactive mode
# fsck –y /dev/rdsk/c0t0d0s7 - It answers that to all questions we said yes with –y option

# newfs –N /dev/rdsk/c0t0d0s7 - To view the locations of alternative backup superblocks

# fsck –o b=32 /dev/rdsk/c0t0d0s7 -Will retrieve the corrupted partition.
# dd if=/dev/zero of=/dev/rdsk/c0d0s7 bs=512 count=32 - It will corrupt the partition
# df - Shows disk detail in blocks
# df –k (in KB)
# df –h - Displays disk allocation in MB & GB

# df –e - Points only the number of files free

# du –k - Displays disk use in KB

# du –s - Displays only the summary in 512 bytes blocks. Using the s and k options together shows summary in KB

# du –h /opt - Shows the disk usage by the directory

# quot –a - Reports on all mounted file systems

# quot –f - Include the number of files

# quot –h /export/home - Shows disk usage userwise in the particular directory

Tuesday, June 9, 2009

Disk Slices

Disk Slices

0 / 1 swap 2 Entire Disk 5 /opt 6 /usr 7 /export/home

/dev – Logical Device Names /devices – Physical Device Names

/etc/path_to_inst - For each device, the system records its physical and instance name

# prtconf - Shows system information including memory size

# devfsadm  Will search and configure new devices added.

# devfsadm –c disk

# devfsadm –i

# devfsadm –v - To print changes made to the /dev and /devices directory

# devfsadm –c - To invoke cleanup routines that remove unreferenced symbolic links for devices

# format

Format> label -To store partition details.

Format> fdisk -To create partitions

Format> verify - Display partition details

Format> partition -To get into partition menu

Format> save - Saving new disk and partition :/etc/format.dat

Partition> 0 - Change 0 partition

select - Select a predefined table

modify - Modify a predefined partition table

name - Name the current table

print - Displays the current table

label - Write partition map and label to the disk

# prtvtoc /dev/rdsk/c1t0d0s2 - To view disk table

# prtvtoc /dev/rdsk/c1d0s2 > /in - To save disk partition details to /in file

# fmthard –s /in /dev/rdsk/c1d0s2  To load partition detail from file to disk

Solaris OE Directory Hirerarchy

Solaris interview Questions and Answers

Introducing the Solaris OE Directory Hirerarchy

/bin Symbolic link to /usr/bin contains binary files of standard system commands
/kernel Platform independent lodable kernel modules
/platform Platform dependable lodable kernel modules
/sbin Single user bin directory contains essential executables
/usr Contains programs, scripts and libraries that are used by all system users

UNIX System Resources

/var Directory of varying files, includes temporary, logging, or status files

/dev/cua Dial out device files for UUCP & PPP

/dev/dsk Block disk devices /dev/rdsk Raw disk devices

/dev/pts Psuedo terminal devices /dev/md Metadisk devices

/dev/term Serial devices /dev/sound Audio device files

/dev/rmt Raw magnetic tape devices

/etc/cron.d Config info for cron utility /etc/default Default info for various prog.

/etc/inet Config files - network services /etc/init.d Scripts to stop & start services

/etc/lp Config info for printer /etc/nfs Config info for NFS server logging

/etc/rc#.d Scripts for various run levels /etc/skel Default shell initialization files

/usr/bin Standard system command /usr/sbin System administration commands

/usr/kernel Platform independent lodable kernel module

devfsadm – Solaris 8 & 9

drvconfig – Solaris 2.x through 2.7

Friday, June 5, 2009

Backup commands

File Archives

# tar –cvf bkp.tar file1 file2 - Will archive file1 & file2
# tar –tvf bkp.tar - Shows the table of content
# tar –xvf bkp.tar - It extracts file from the tar archive

# jar –cvf bkp.tar
# jar –tvf bkp.jar
# jar –xvf bkp.jar

# compress bkp.tar - To compress tar archive
# ls
# uncompress bkp.tar.z - To uncompress tar archive
# gzip bkp.tar - To create gzip file
# gunzip bkp.tar.gz - To extract the tar archive by gunzip

# zip bkp.tar - To create zip archive
# unzip - To extract the zip archive

VI Editor

Solaris interview questions and answers

VI Editor

Inserting and Appending Text

a - Append text after the cursor
A - Appends text at the end of the line
i - Inserts text before the cursor
I - Inserts text at the beginning of the line
o - Opens a new line below the cursor
O - Opens a new line above the cursor
:r Inserts text from another file into the current file

Key Sequence for the VI Editor

n, left arrow or backspace Left one characters
j or down arrow Down one line
k or up arrow Up one line
l, right arrow or spacebar Right one character
w Forward one word
b Back one word
e To the end of the current word
$ To the end of the line
0 (zero) To the beginning of the line
^ To the first non whitespace character on the line
Return Down to the beginning of the next line
G Goes to the last line of the file
1G Goes to the first line of the file
:n Goes to the line n
nG Goes to the line n
Ctrl F Pages forward one screen
Ctrl D Scroll down one half screen
Ctrl B Pages back one screen
Ctrl U Scrolls up one half screen
Ctrl L Refreshes the screen

Editing files using the VI editing commands

R Overwrites or replace characters to the right of the cursor
C Changes or overwrites characters to the end of the line
s Substitute a string for a character at the cursor
x Deletes a character at the cursor
dw Deletes a word or part of the word to the right of the cursor
dd Dletes the line containing the cursor
D Deletes the line from the cursor to the right end of the line
:n,nd Deletes the line n through n

Using the Text Changing Commands

u Undoes the previous command
U Undoes all changes to the current line
. Repeats the previous command

Search and Replace Command
/string Searches forward for the string
?string Searches backward for the string
n Searches the next occurrence of the string
N Searches for the previous occurrence of the string
:%s/old/new/g Searches for the old string and replace it with the new string globally

Using the text copying and Text Pasting Commands

yy Yanks a copy of a line
p Puts yanked or deleted text under the line containing the cursor
P Puts yanked or deleted text before the line containing the cursor
:n,n co n Copies lines n through n and puts them after line n
:n,n m n Moves lines n through n to line n

Unix File Permission

Unix File Permission

r – 4, w – 2, x – 1
_rw_ r_ _ r_ _ (644)  Default file permission
drwx r_x r_x (755)  Default directory permission

O G O - Permission categories

# ls –n /var/adm
drwxrwxr_x 5 4 4 512 nov 15 14:55 file1

5 - No of hard link to the file or directory
4 – The UID of the owner
4 – The GID of the group

512 – Size
# Chmod –R 755  - For inherit permission

Thursday, June 4, 2009

ln commands solaris interview questions and answers

$ PATH=$PATH:/usr/ccs/bin:/usr/ucb: - It will get appended to the existing path

# ln –s  - Creating symbolic link

# ln  - Creating hard link

Find command solaris interview questions and answers

# find /kris –name file1 - Searches for file file1 in /kris directory

# find /ris –name file1 –exec ls –l {} \; - Search and display

# find /kris –type f –size 0 –exec ls –l {} \; - Search for the file with size 0

# find /kris –user user1 - Shows file used by user ‘user1’

Grep Command Options solaris interview questions and answers

Grep Command Options

-i - Searches for both upper & lower case characters

-l - Lists the names of files with matching lines

-n - Proceeds each line with the relative line number in the file

-v - Inverts the search to display lines that do not match the pattern

-w - Searches for the expression as a complete word

mkdir rmdir cp echo commands solaris interview questions and answers

# mkdir –p /data/dir   Creates directory and sub directory in one shot
# rmdir –r /data         Deletes the directory and all its subdirectory and files
# cp –r /data /data1   It copies the directory
# echo $MANPATH
: /usr/local/samba/man:
# echo $PATH        Shows environmental path

Uname commands solaris interview questions and answers

# uname –a  Gives all details about the system
# uname –m  Displays H/W platform (sun4u)
# uname –p  Machine processor architecture (sparc or i386)
# uname –i  Machine model architecture (SUNW, Ultra 5_10)
# uname –X  Detailed description
Custom Search

Feeds from my other blog

Samsung S2 Brand new for 25900 White piece sealed box

For Sale, Mobile Phones - Accessories in India, Andhra Pradesh, Hyderabad. Date September 17

For Sale in Hyderabad