Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Untitled

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 20

Unix Commands Reference

Unix commands the first thing needed by a Unix sys admin, who are starting to wo
rk in Unix operating system. Unix operating systems comes with online manual sys
tem, which can be used to see the command details, syntax options and examples o
n while working on a Unix system. Unix manual can be accessed using man <command
name> and it requires the man package installed and MANPATH set to man director
ies. The manual page directories may differ in different Unix operating systems
and man package may no be installed in all systems.
Following are a few of the most popular and useful commands used in Unix operati
ng system.
WILDCARD Characters
* The * wildcard character substitutes for one or more characters in a fil
ename. For instance, to list all the files in your directory that end with .c en
ter the command ls *.c
? (question mark) serves as wildcard character for any one character in a
filename. For Instance, if you have files named porg1, prog2, prog3 in your dire
ctory, the Unix command: ls prog?
DIR
Change cd dir Change to directory d
Make mkdir dir Create new directory d
Move mv dir1 dir2 Rename directory d1 as d
2
Remove rmdir dir Remove dire
ctory d
FILE
list, no details only names ls filename, filename with wildc
ard characters.
list, details ls -l filename, filename with wi
ldcard characters.
move to directory mv filename dirname (wildcard characters supported)
copy file to other / current directory cp file directory / newfile or c
p directory / oldfile.
delete the file rm file , rm –rf directo
ry - Recursively remove files &
directly
without any warning.
file file filename, file command tries to determine the file type, text , exe
cutable etc after comparing the values in /etc/magic.
vi – vi full screen editor vi filename, Opens a existing fi
le or creates
ed – Line Text editor ed filename
count – Line, word , & char wc filename
Text content display – List contents cat filename
of file at once
Text content display by
screen : List contents of file screen by more filename
Concatenate – file1 & file2 into file3 cat file1 file2 >file3
File operations
Change read/write/execute mode of chmod mode file
file
chown chown [-R] [-h] owner [:group] f
ile
move(rename) file mv file1 file2 Rename file file1
as file2
remove rm file delete (remove) file f
Compare two files cmp file1 file2
copy file file1 into file2 cp file1 file2
sort Alphabetically sort file
sort Numerically sort -n file
split f into n-line pleces split [-n] f
match pattern grep pattern file Outputs lines
that
List file differences diff file1 file2
Head f output beginning of file head file
Output end of file tail file
BROCESS
Suspend current process CTRL/z*
Interrupt processes CTRL/c*
Stop screen scrolling CTRL/s*
Resume screen scrolling CTRL/q*
Sleep for n seconds sleep n
Print list of jobs jobs
Kill job n kill %
Remove process n kill -9 n
Status process status stats ps
Resume background jab n bg [%n]
Resume foreground job n fg [%n]
Exit front shell exit
User admin
Add a new user login to the system
#useradd –u 655 –g 20 –d /home/ttes testlogin loginname
-u is user id , if not specified system takes highest available.
-g group id should be existing in /etc/group, if not specified other or user is
assigned.
-d home directory, default is to use user as the directory name under the home d
irectory.
Login name –new login name to be created.
#useradd testlogin will create a user by the name testlogin with all default val
ues.
Password change passwd <user>
Alias (csh/tcsh) – create command alias name1 name2
Alias (ksn/bash) – create alias command alias name1=”name2”
Alias – remove alias unalias name1[na2…]
Printer
Output file f to line printer lp -d printer file
System status
Display disk quota quota
Print date & time date
List logged in users who
Display current user whoami
Output user information finger [username]
Display recent commands history
Environment variable
set set command alone display the environment variables, it is used to set o
ptions in ksh like set –o vi
export export variable, export makes variable in sub shells.
Set Environment variable (csh/tcsh) to sentenv name v
Value v
Set Environment variable (ksh/bash) to export name=v example : expor
t TERM=vt100 Value v
Connectivity
Connecting to a remote host $telnet hostname/IP addres
s or $telnet
Telnet brings up the login prompt of remote host and expects you to enter your
user name & password. With out argument it enters command mode (telnet>) and ac
cepts command listed by ? at telnet> prompt.
Communication is not encrypted between two hosts.
Securely connecting to a remote host Ssh username@hostname or ssh -l
username
hostname
Depending on ssh setting for your account you may or may not be asked a password
to login. Your login/passwd will be same login password as you would use with t
elnet connection.
Communication is encrypted between two hosts so if someone intercepts your commu
nication he will not be able to use it.
Copy files from/to remote host ftp hostname
ftp expects you to enter your username/passwd or if it is ftp only account it wi
ll require ftp account password.
Put, mput (multipleput) command is used to transfer files to remote host.
get, mget (multipleget) command is used to transfer files from remote host.
ftp allows some limited number of commands to be executed at ftp> prompt & summa
ry of ftp command can be found by using ? at ftp> prompt
Securely copy files from/to remote host sftp username@hostname:remotefile localf
ile
Communication is encrypted betwe
en two hosts.
Test the tcp/ip connectivity between Ping hostname
two hosts If you can ping a host the host is reachable from the machine th
at you are using. Router/firewall configuration may prevent ping to succeed.
Backup and Restore
Backup and restore using tar, Tar tvf filename.tar --- View the table
of content of a tar
Tapearchive archive
Tar xvf filename.tar --- Extract
content of a tar archive
Tar cvf filename.tar file1 file2 file3 --- Create a tar archive called filename.
tar using file1, file2, file3
tar cannot copy the special files, device files. Not suitable for taking root ba
ckup.
Backup and restore using cpio cpio is mostly used in conjunction with other co
mmands to generate a list of files to be copied:
#ls cpio –o > /dev/rmt/c0tod0 --- copy the contents of a directory into a tape a
rchieve :
#find . -depth -print | cpio -pd newdir --- copy entire directory to other place
:
#find . -cpio /dev/rmt/c0t0d0 ---copy files in current directory to a tape.
cpio can copy special files and hence useful in taking root backup containing de
vice file.
Find files, directories
Find files, directories Find command is used to find the files, director
ies and to run commands on the list of files thus generated by default, find doe
s not follow symbolic links.
find . -name *.log -print ---Simple find to list log files.
find . -name ‘*.log’ -exec rm {} \; ---Simple find to find log files and delete
them.
find accepts a long list of options to find the files based on different paramet
ers such as create time, modified time, of certain size etc. please refer to man
find for more option.
Technical questions asked of unix admins
1. What editor do you use (hint : a wrong answer here will heavily influenc
e the interview)
What is on ALL Unix systems?
Ans:- Vi full screen editor
ed line text editor
2. What shell do you use? (hint: a wrong insert here will affect your chanc
es)
Ans:- zsh bash ksh bourne shell
3. What is the best shell for root why is that the best shell for root?
Ans:- zsh bash
4. why is that the best shell for root?
Ans:-
5. List the operating systems you are familiar with and the versions?
Ans:- Sco Unix, HP, IBM, Linux, AIX, Solaries,
6. How do you backup your system?
Ans:- Full backup
7. What commercial tools have you used for backup and archive?
Ans:- TIVOLI
8. What UID does root have across an NFS mount by default?
Ans:-
9. What file contains the mounted file systems in Solaris?
Ans:- /etc/vfstab
10. What file contains the mounted file systems in HP Unix?
Ans:- /etc/fstab
11. What command identifies the NIS server you are bound to
Ans:-
12. What is the name of the administrative tool for SUN?
Ans:- SM (Solaries Management Tool)
13. What is the name of the administrative tool for HP?
Ans:- SAM (System Administration Manager)
14. What is the name of the administrative tool for IBM?
Ans:- SMIT (System Management Interface Tool)
15. If you are going to modify CDE files, which directory should you edit /u
sr/dt… or /etc/dt…?
Ans:- /usr/dt
16. What differs between the NIS entry in the /etc/passwd file between HP an
d SUN?
Ans:-
17. In Solaris 2.5 What is the name of the file with the NFS exported files
?
Ans:-
18. In Solaris 2.6 What is the name of the file with the NFS exported files?
Ans:-
19. Identify some differences between CDE in Solaris 2.6 and Solaris 2.7?
Ans:-
20. How can you tell what is attached to the SCSI chain on a SUN system?
Ans:-
21. How can you tell what is attached to the SCSI chain on an HP system?
Ans:-
22. What command will tell you have much memory a system has in Solaris?
23. What command will tell you have much memory a system has in HP Unix?
24. Where are system messages logged in Solaris?
25. Where are system messages logged in HP Unix?
26. How would you break an nfs mount on a system that has users on it?
27. Explain how you could stop and start a process without rebooting?
28. What command will tell you how long a system has been running?
29. What is lvm?
30. What is an hfs?
31. What is fsck?
32. What is jxfs or vxfs?
33. How do you get a Sun system to single user mode?
34. How do you get an HP system to single user mode?
35. What files control basic hostname and network information on a Sun?
36. Hint what files control basic hostname and network information on an HP?
37. Hint what command will provide status of your file systems on a Sun?
38. What command will provide status of your file systems on a HP?
39. What command will provide status of your file systems on a Linux system?
40. What file do you edit to permit non console login of root on a Solaris s
ystem?
41. What command with path launches open windows on a Sun os system?
42. What command provides information on the health and performance
of nfs?
43. What command provides information on your network connection?
44. What are some of the tags in html that do not require a closing tag?
45. What command can you use to find the path to an application?
46. What option can you use with ftp to automatically transfer using wildcar
ds?
47. What character show up in an asxii file created in masos or windows when
ftp’d in Binary mode
48. What does the Io scan command do?
49. What does the lan scan command do?
50. What command in Solaris shows disk partitions?
51. What are the tar commands to display the contents of an archive?
52. What directory are programs like perl and netscape installed in?
53. What is the recommended ration of swap to memory for X-windows?
54. What command tell s you who is logged into a file system?
55. What is the command to shutdown and halt a Sun system?
56. What is the command to shutdown and halt an HP system?
57. How do you mount a file system?
58. What command can you use to identify a hostname or IP address?
59. What character is used to launch an application and run it in the backgr
ound?
60. What command lists the current running bobs?
61. How do you kill a running job?
62. Where are startup scripts for an HP Unix 10.20 system?
63. Where are startup scripts for a Solaris 2.6 system?
64. What command is used to display NIS host information for an IP address s
hare f NFS o ro sun sunl sun data share f nfs o anon o data provides read and wr
ite permission share f nfs o ro sun share to see the permissions showmount -e to
see the permissions showmount -e to see the mounts df mounts which all client h
as mounted the nfs directories nistab to ser nfs servers dfshare to see the serv
er shared directories csfadm c mycache mount f cachefs o backfstype nfs cachedir
myache sun naveen naveen mount f tmpfs o size 50 swap naveen
65.
Choose all the correct answers in Solaris
1. How many disk slsices a disk can have?
8 7 6 1
2. Which file is used to set the default mask in Solaris?
etc profile profile etc etc inittab
3. What are the advantage for making disk partitions?
Easy to maintain Easy for backing up
Limits problems to one partition only Space can be monitored easily
4. What does a sign in etc hosts?
Indicates all hosts are allowed only known hosts are allowed
all users are allowed unknown hosts are also allowed
5. Which command is used to mount local file system ?
mount mountall mount mount -f
6. Which command line option gives a run level and output headings?
who -b who -r
who -rh who -rh
7. Which command is used to change the auto boot feature in Sun ultra eeprom amt
o boot true eeprom auto boot true eeprom autoboot true eepromn auto boot true if
patch id is 123456 10 sthen its revision number is 123 456 10 6-10
8. Which commands can be used to make a device alias?
devalias ok prompt dvalias at root prompt
nvram at ok prompt drvconfig at root prompt
9. Where in Solaris encrypted passwords are stored?
etc passwd etc shadow
etc default passwd etc inittab
10. What is required in a diskless workstation for Solaris workstation?
CPU, monitor, keyboard, hard disk CPU, monitor, keyboard, cdrom dr
ive
CPU, monitor, keyboard, Ethernet card CPU, and Ethernet card only
11. Which of the following points to virtual file system?
dev disk cotodos3 dev rdsk cotodos3
dev mnd dsk cotodos3 dev vx rdsk data voll
12. Which Solaris command is used to correct file system problems?
newfs fasck
mkfs Format
13. Which is the configuration file for the tip command?
etc tip conf etc remote
etc inittab d profile
14. When auto mount daemon needs to be restarted?
when direct map is changes when indirect map is changes
no need to restart when a new user is created
15. What is the default configuration cluster in Solaris installation developer
core end user entire distribution?
16. Which utility is used to administer the port monitor?
sacadm pmadm
ttyadm adjmmintool
14. What is the command to assign a IP address to QFE network interface write th
e vommand 10 30 usr bin log info entry in cron Jab will execute the program ever
y at 10.30 every Thursday at 10.30 every Saturday 10.30 every Wednesday at 10.30
what do you need for a fresh Solaris installation host name ip address net mask
domain name how can you see the prom version show version prom banner version
15.Which file enables you to disable root login on terminals?
etc default login etc system
16. Which directory contain run level control scripts?
etc rc2 d etc init
etc rc3 d
17. Which command show the patch installed in the system?
patchadd show rev show patch patch list
18. What are the advantage of having a virtual file system?
Large capacity volumes Increased file system size performance e
nhancement backup becomes easy
19. Which file is used to define default run level for init process at booting t
ime?
etc ttyyab etc btyadm
etc inittab etc profile
20. Which command shows kernel parameters and driver module information?
sysconfig prtconfig
dmesg prucobf a multiuser operating sy
stem is one in which many users can work simultaneously many process can work si
multaneously a large number of users can be created a number of user home direct
ories can be created
21. What is true about software packages it is group of files, directories they
are grouped to form clusters it is standard way of delivering software in Solari
s, they can be installed using pkgadd command.
22. What type of names are used for administering disk drives in Solaris environ
ment?
Physical logical virtual disk instance
23. How many run level in Solaris?
answer :- 8 run level
there are Solaris network daemon answer inetd
24. How to stop the process using process name?
answer:- pkill process name Solaris kernel name answer kernel sparcy9 Unix
25.How to recover root password?
answer:- boot form the cdrom mount the cotodoso timp open estc shadows file dele
te the encrypt entry boot the systems and you can login with no password.
26. What does fmthard do?
answer:- fmthard is tools or copy vroc one hard drive to other hard drive answer
fmthard is a very useful command during the time of systems recovery it helps i
n rebuilding the files system as it was before crash fmthard take the output of
prtvtoc and rebuilds the slices fmthard can be used to format many hard disks at
the same time are kernel parameters tunable during runtime answer in etc system
s file
What is the difference between nfs version 2 and nfs version 3?
answer :- nfs 2 default 8kb transfer rate, it did not check the authentication a
t the time connection client wants to access
Unauthorized file it shows error messages like write error read error nfs 3 32 k
b transfer rate. It check at the time connection acl support
What is rpc?
Answer:- remote procedure call Solaris used for transaction in nis
Answer:- remote procedure call The application will cause the code to be execut
ed in remote host and return the value back to the application. Until that time,
application will be suspended. The RPC is synchronous kind.
What is jass?
Answer :- The Solaris Security Toolkit, formerly known as the jumpstart Architec
ture and Security Scripts (jass) toolkit, lprovides a flexible and extensible me
chanism to harden and audit Solaris operating systems (oss)
How do you boot from a network with jumpstart?
Answer:- ok boot net-install (for install the OS in client system)
Ok boot net to boot client system from network
Answer:- jumpstart hand off installation, like windows ghost.
What is jumpstart?
Answer:- By using jumpstart we can install OS at a time on multiple systems, by
this we can save the time this id done by keeping OS dump in a system, from this
system we can install the OS
For this, the system architecture should be same.
How do you boot from CD-Rom
Answer:- boot cdrom booting from cdrom boot net booting from network card
Answer:- command boot crfrom s we can use this command
What does init 0 do?
Answer:- init 0 is ok boot prom level
What does init 5 do?
Answer:- init 5 system halt mode
Answer:- shutdown
What does ndd do?
Answer:- Several of the network settings discussed in this artic are configured
using the ndd command. It is used to examine and set kernel module parameters, n
amely the Transmission Control Protocol Internet protocol (TCP/IP) drivers Most
kernel parameters accessible through ndd can be modified without rebooting the s
ystem. To see which parameters are available, use the following ndd commands.
Ndd dev arp
Ndd dev icmp
Ndd dev ip
Ndd dev tcp
Ndd dev udp
What is etc system for?
Answer:- etc system is a kernel configuration file The etc system file is the co
ntrol file for modifying which modules and parameters are to be loaded by the ke
rnel at boot time. By default, all lines in this file are commented out.
Modifying the kernel’s behavior (or configuration) requires editing the etc syst
em file. Altering this file allows you to modify the kernel’s treatment of loada
ble modules as well as to modify kernel parameters for some performance tuning
What is an alternative to the top command on Solaris?
Answer:- prstat
What is OBP and how do you access it?
Answer:- open boot Prom this is 0 run level in Solaris stop + A or in command mo
de init 0
How do you get system diagnostics information?
Answer:- dmesg
How do you view shared memory statistics?
Answer:- vmstat –S
Answer:- As said above, vmstat –S and you can check the shared memory with ipcs
–a
How do you create a Solaris package?
Answer:- pkgadd –d dir host
What does the pkgadd command do?
Answer:- it used for Software installation like third party tools
What is rpc why do I need it?
Answer:- RPC is simply known as Remote Procedure call this is the fundamental in
NFS (Network File System)
Difference between NFS version 2 and Fns version 3?
Answer:- NFS version 2 supports 8Kb transfer rate, client can access unauthorize
d file they give
errors
NFS Version3 supports 32 kb transfer rate, first check the permissions after th
at they give connection permission
What is OBP and how u r going to access it?
Answer:- Open boot Prom stop + A or init 0
How can you set EEPROM settings from Solaris?
Answer:- using eeprom command
Tell me some of the differences between Solaris and sun OS
Answer sun OS is BSD based
Solaris is used system V kernel
Security point of view, what’s there in NIS+ than NIS?
Answer :- NIS =Centralized domain
NIS+=centralized and multiple domains as well as used as ADS in windows server
Answer :- NIS+ means to control centralized domain like ADS
Nis means it is a centralized domain used as single domain
If you have forgotten the root password for a server, how do you get back in?
Answer :- boot net –S
Mount/dev dsk cotdos0 a
Cd a etc
Term=vt100
Export TERM
Vi shadow
//remove passwd field after save the file
Cd/
Umount/a
Sync
Init 6
You can receive e-mail, but when u try to send e-mail u can’t send any what i
s wrong?
Answer :- problem may be in RELAY ONS lookup
Answer :- The problem can be with the outgoing port number used.
Answer :- The SMTP (Simple Mail Transfer Protocol) is may not be run.
If you have multiple Ethernet interfaces, how do you keep it from routing betwee
n them?
Answer :- touch etc notrouter
What is uadmin and what does it do?
Answer :- uadmin is command control for basic administrative functions
How would you truncate a log file that is growing too large if you don’t have sp
ace to compress it or to move it somewhere else? How would you do it?
Answer :- cp dev null File Name
When you ping server and ping server domain name you get different results why?
Answer :- If you give ping hostname the server will give the result from etc hos
ts file if you give ping hostname domain name then I will search through interne
t.
Answer :- if your are pointing to the DNS server why you need to add it in a etc
hosts
If you are not able to ping through hostname just type dns in etc nsswitch conf
file if you try to access through hostname it read the nsswitch. Conf file this
file will point to dns server
How do you give a user access to an application or program that needs to run as
root without giving them the root password?
Answer : Update the etc sudoers with a sudo rule.
Answer :- write RBAC (Role Based Access Control) rules for that specific program
or application
If fsck is running one thind u should not do what’s that?
Answer :- fsck is a useful command to bring back a corrupted file system back in
to working condition one important thing u should note while using this command
is that never never fsck on a mounted file system and while it is running never
try to restart the system
If you mistype a password how do you clear it out to retype the password again?
Answer :- clear password filed in etc system file
Answer :- if you are in the middle of typing a Solaris Unix password and you fat
finger it Ctrl U& will clear the incorrect text you have entered and you can im
mediately retype the entry while at the same prompt
If you can ping a server but can’t telnet or ssh to it what wrong?
Answer :- if service not enable the server uncomment tcp ssh service in etc inet
d conf
You can ping servers on the subnet your workstation is on, but not other subnets
why
Answer :- need to update the routing table with a route to the subnet in questio
n route add
Suppose if u want to reconfigure the kernel then how you are going to do?
Answer :- touch reconfigure
Boot –r
What are the files in /etc directory?
Answer :- The files in /etc directory are all configuration files
Answer :- The files in /etc are all binary executable files usually required for
system administration.
Answer :- etc directory contains configuration files of all the services.
What is the main advantage of creating links to a file instead of copies of the
file?
Answer :- The main advantage is not really that it saves disk space (though it d
oes that too) but, rather, that a change of permissions on the file is applied t
o all the link access points. The link will show permissions of irwxrwxwx but th
at is for the link itself and not the access to the file to which the link point
s. Thus if you want to change the permissions for a command, such as su , you on
ly have to do it on the original. With copies you have to find all of the copies
and change permission on each of the copies
Etc default login etc system
Which directory contain run level control scripts?
Etc rc2 d etc init d etc rc3 d usr bin
Which command show the patch installed in the system?
Patchadd –p showrev –p showpatch patchlist
What are the advantage of having a virtual file system?
Large capacity volumes increased file system size performance enhancement backup
becomes easy
Which file is used to define default run level for init process at booting time?
Etc ttyyab etc ttyadm
Etc inittab etc profile
Which command shows kernel parameters and and driver module information?
Sysconfig prtconfig dfmesg prtconf
A multiuser operating system is one in which?
Many users can work simultaneously many processes can work simultaneously
A large number of users can be created A number of user home directories can be
created
What is true about software packages?
It is group of files directories they are gouped to form clusters
It is standard way of delivering software in Solaris They can be installed using
pkgadd command.
What type of names are used for administering disk driven in Solaris environment
?
Physical logical Virtual disk instance
What is the command to check the system configuration (ex Memory size Hard disk
capacity No of Processor?
Answer cfgadm –a
What is difference between Process and Daemon?
A daemon is a software process that runs in the background (continuously) and pr
ovides the service to client upon request
Server process run runs one time when called by a daemon Once done it will stop
For example telnetd (in telnetd) or ftpd called from kinetd inetd daemon
How do you determine which Run Level the system is running?
Who
How will you add a virtual IP address to a server. Given the interface hme0/eth0
/qe0 and IP 10.76.176.1?
#ifconfig qe0:1 plumb
#ifconfig qe0:1 10.10.1150 up
What is sticky bit?
When this is set on a directory only the file in that directory can be removed o
r renamed if:
a user owns the directory
User owns the file
Super User
How many different kill signals are there?
Ans :- 47
EXIT HYUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM USR1 U
SR2 CLD PWR WINCH URG POL STOP TSTP CONT TTIN TTOU VTALRM PROF XCPU XFSZ WAIATIN
G LWP FREEZE THAW CANCEL LOST XRES RTMIN RTMIN+1 RTMIN+2 RTMIN+3 RTMAX-3 RTMAX-2
RTMAX-1 RTMAX
What setting determines the default permissions for files and directores?
Ans umask
How can you come to the home directory?
Ans cd $Home
How can we find RAM size in solaris server?
Ans Use this command
# psrinfo grep memconf
How to do see the processor information?
#psrinfo
#psrinfo-v to see which processor are online and offline
How to change processor operation status?
#psradm –a –n to set all processor online
#psradm –f 2 3 –make processor 2 and 3 offline
How to make processor 4 offline?
#psradm –f4 offline
How to make processor 3 online?
#psrinfo –V to see the status
#psrinfo –a 3 online
How to see the kernel version and supported by it?
#isainfo
How to see the default boot device from the boot prom #setenv boot-device disk B
oot-device=disk?
#reset-to make the changes
How to see all the information of the hardware related from bootprom?
#banner or #prtconf
How to see the physical disk connected to the system?
#probe-scsi
How to see all pci slots?
#probe-pci-slots
Or
#probe-pci-all
How do you check your loop back or network devices ok test net?
How to check the clock devices?
Ok netwatch-clock
How to set environment variable in NVRAM #invalias /pci—rarp –to set scsi for bo
oting of client?
#nvalias net dhcp – to boot from dhcp
#nvunalias net – remove the alias
How to configure newly attached hardware?
#devfsadm Or
#drvconfig
What are raid0, raid1 and raid5?
How to create state database replica?
#metadb
How to see the state bases?
#metadb
How to change the default level from 8kb to 4kb?
#metadb -a -f –l 4096 c0t0d0s1
How to create 2 database replicas?
#metadb –a –f –c 2 c0t0d0s1
How to create raid 0 concatination?
#metainit d0 2 1 c0t0d0s1 1 c0t1d0s1
How to see the meta device information?
#metastat
Newfs /dev/md/rdsk/d0
Mount /dev/md/dsk/d0 /nav
How to differentiate concatenation and strippong?
when used metastat command stripping with show an interlace value 32kb this show
s it is striped.
How to create raid 0 stripping?
#matainit d1 1 2 c0t0d0s1 c0t0d0s2
#metastat
#newfs /dev/md/rdsk/d1
#mount /dev/md/dsk/c1 /naveen
How to clear metadevices?
#metaclear d0
#metaclear d1
How to create mirroring raid –l?
#metainit d1 1 1 c0t0d0s1
Metainit d2 1 1 c0t0d0s2
Metainit d3 –m d1
Metattach d3 d2
Metastat
How to create stripe with parity?
#metainit d1 – raid5 c2t0d0s0 c0t0d0s0 c0t2d0s0
Metastat
Newfs /dev/md/rdsk/d1
Mount /dev/md/rdsk/d1 /naveen
How to grow the size of the volume?
#growfs –M /naveen c0t0d0s1
How to create raids using volume manager?
#vxassit –g rootdg make vo101 20g
#newfs /dev/vx/rdsk/rootdg/vo101
#mount /dev/vx/dsk/rootdg/vol101 /naveen
b) vxassit –g rootdg make vo102 20g layout=stripe st_width=32
#newfs /dev/vx/rdsk/rootdg/vo102
#mount /dev/vx/dsk/rootdg/vo102 /naveen
c) vxassit –g rootdg make vo103 20g layout=mirror
newfs /dev/vx/rdsk/rootdg/vo103
mount /dev/vx/dsk/rootdg/vo103 /naveen
d) vxassit –g rootdg make vol4 20g layout=raid5.nologs
newfs /dev/vx/rdsk/rootdg/vol4
mount /dev/vx/rdsk/rootdg/vol4
How to print plexes , subdisk , volumes?
Vxprint –pt – for plexes
Vxprint –st subdisk
Vxprint –vt volumes
How to increase the size of the volume?
Vxassit –r rootdg growby vol01 20g
/usr/lib/fs/fsck –F ufs –M /naveen /dev/vx/rdsk/rootdg/vol01 40980 (offset volue
by typing the vxprint –vt command)
What is the top command used for its lists all the processes with the process id
Cpu utilization and idle cpu Memory utilization and idle memory?
Swap utilization and ideal swap application using maximum cpu utilization with p
id
What is lofs used for?
Lofs list open files is used for to check a problem encounter with a file or pro
cess
What is the use of truss command?
Trace system call for every running file
Whats are the fields in vfstab ?
Mount device-raw device for fsk-mountpoint-filesystem-fsckcheck-mount at boot an
d it contain all the mounted filesystem
How to break root password ?
#ok boot cdrom –s
TERM=ansi
Export TERM
Mkdir /naveen
Mount /dev/dsk/c0t0d0s0 /naveen
Vi /naveen/etc/passwd
Root:KHGHGHGGFG:-remove this junk passwd
Wq!
Reboot it logins with out asking for password
Password – enter new password
How to create a user ?
useradd –u uid –g gid –d /export/home/naveen –m –s /bin/sh naveen
Whats are the files which maintain user information?
/etc/passwd
/etc/group
/etc/shadow
Fields in /etc/passwd ?
user-passwd-uid-gid-homedirectory-shell
Fields in /etc/group ?
groupname-gid
Fields in /etc/shadow ?
username:encrypted passwd min-max-lastchange-warn-expire
How to create a quotas?
cd /export/home
Touch quotas
Chmod u+rw quotas
Edquota naveen
Soft=5000 hard=6000 inodes=5000 inode=5500
Quotan –v /export/home
Repqupota –v /export/home or quota –v naveen to see quota
How to create a nis master?
Domain name sun.com
Echo sun.com etc default domain
Vi etc hosts
Sun1 192.168.0.1
Sun2 192.168.0.2 add all the host connected to the network
Wq
Cp etc nsswitch. Nis etc nsswithc.sonf
Vi etc nsswitch.conf
File nis-add this entry
Wq
Cd vary p
Ypinit-m master server
Enter host 192.168.0.1
Stop at errors say no here
Yes-yes-yes
Cd vary p
User/lib/netsvc/yp/ypstop
/usr/lib/netsvc/yp/ypstart
Here you can see all the deamon get restarted
Which command display the default nis server ?
Ypwhich
Which command will display all the master and slave servers ?
Ypcat –k ypservers
How to see the nis users ?
Ypeat passwd
What are the deamons for nis master ?
Ypserv ypbind ypxfrd rpc.ypassword rpc.ypupdates
How to create nis slave server (192.168.0.2) ?
Vi/etc/host
Sun 192.19\68.0.1 master server ip
Wq
Cp etc nsswitch.nis etc switch.conf
Vi nsswitch.con
Files nis
Wq
Domainname sun.com
Echo sun.com etc defaultdomain or to maintain more security vary p ypservers
Cd vary p
Ypinit –s sun1 (master server)
Yes give master server ip or hostname
Error say no
Yes-yes
Cd var up if u u in that directory then its okay
Usr lib netsvc yp ypstop
Usr lib netsvc yp ypstart
Ypserv ypbind
Ypwhich-will display master and slave servers
Ypcat-k ypservers-list master and slave server
What are the daemon for nis slave server ?
Ypserv ypbind
Who to see nis user from the slave ?
Ypcat passwd
How to configure nis client ?
Vi etc hosts
Sun1 192.168.0.1 – master
Sun2 192.168.0.2 –slave
Wq
Cp etc nsswithc nis etc nsswitch.conf
Domainname sun.com
Echo sun.com etc defaultdomain or vary p ypservers
Cd vary p
Ypinit –c
Add the slave if available or master
Yes
No at errors
Cd vary yp
User lib netsvc yp ypstop
Usr lib netsvc yp ypstart
Daemons for nis clients are ypbind
To see nis server and master from the client
Ypcat –k ypservers
How do you update slave servers from th master ?
Cd vary p
User ccs bin make passwd
Or yppush
How to create nis+ server and client ?
Cp etc passwd export home nisfiles
Cp etc group export home nisfiles
Cp etc hosts export home nisfiles
Vi auto_master
Remove all entries and keep only user name home directories ?
Host1 192.168.0.1:/export/home
Host2 192.168.0.1:/export/home
Wq
#domainname sun.com
#echo suns.com etc defaultdomain
#nisserver –r –Y
Reboot
#cd/export/home
#nspopulate –v –F
How to create nis+ client ?
#cp/etc/nsswitch.nis etc nsswitch. Conf
Files nisplus
Wq
#domainname sun.com
#echo sun.com etc defaultdomain
#nisclient -1 –h 192.168.0.1 –d sun.com
Listing table & objects in NIS+
#nisis ;Gives the total objects in NIS+
#nisis org dir ;Listts the tables listed in the directory
Listing a contents of tables
#niscat passwd.org dir
Listing table structure
#niscat –o passwd.org dir lists structure of password table.
Adding A user
#niscat -0 passwd.org dir ;lists structure of password table.
Adding A user
#niscat –a name=john uid=123 gid=111 home=/home/john shell=/bin/sh passwd.org di
r
Changing the user information in passwd table (Super user only)
Fill in the corresponding values in
#nistbladm –a name= passwd= uid= gid= home= shell= passwd.org_d
Example
#nistbaldm –a name=john uid=123 gid=234 home=/home/john shell=/bin/sh passwd.org
_di
To change only shell
#nistbaldm –m shell=/usr/local/bin/bash [name=john], passwd.org_dir
Changing user passwd
As root
#nispasswd user name user has to update his key through chkey –p
As user $ nispasswd ;update encrypted key
$chkey –p (user NIS+ passwd and login passwd are the same
$chkey –p ;(user NIS+ passwd and login passwd are the same)
Adding user credentials
#nisaddcred –p 123 –p john local
#nisaddered –p unix 123@planet.com –P john.planet.comd des
123 is userid and john is the user name.
Adding/removing a user dir entry in auto home table :
#nistbladm –a key=john value=10.20.40:/home/john auto_home.org_dir
#nistbladm –r key=john auto_home.org dir :if key is not unique then more fields
needs to be defined
Removing a user
#nistbladm –r name=john passwd.org_dir
Modifying the tables for multiple entries.
#nisaddent –d passwd tmp passwd Dump the table to a file
#vi /tmp passws ;Edit the dumped file
#nisaddent –r –f etc passwd passwd put back the dumped file nisaddent command is
available only for some of the standard tables, for others either nispopulate s
tbladm has to be used
How to create backup by usf dump ?
Ufsdump-0(zero) cvf/dev/rmt/0/naveen
How to list the files ?
Ufsrestore –tvf/dev/rmt/0
Ufsdump –uvf/dev/rmt/0/naveen –to updates
Ufsrestore –ivf/dev/rmt/0/naveen
How to back up using tar ?
Tar –cvf/dev/rmt/0naveen
Tart –tvf/dev/rmt/0
Tar –dvf/dev/rmt/0/naveen
Tar –xvf/dev/rmt/0/naveen
What are the deamon for nfs server and what are each used for
Nfsd- it enables file system exporting and file access request from the client
Mount-it handle mount request from the client
Lockd-provides locking facility for server and client
Mohntd-it checks lockd to provide crash and recovery finctions
How do you share and access a file from using nfs ?
Vi/etc/dfs/dfstab
Share-F nfs/naveen
Wq
#Exportfs-va
#cd/etc/inet.d
Sh nfs.server stop
Sh nfs. Server start
Sh rpc stop
Sh rpc start
Or we can use
Svcadm restart svc:/network/nfs/server deafault
CLIEN
Nfstab-to see nfserver and shared directory
Mount –f nfs sun1:/naveen/naveen
Vi /etc/fstab
Sun1:/naveen -/naveen nfs-yes-
Wq
#sharp-F nfs –o ro=sun1 /data

You might also like