Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Unix commands the first thing needed by a Unix sys admin, who are starting to work in
Unix operating system. Unix operating systems comes with online manual system,
which can be used to see the command details, syntax options and examples on 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 directories. 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 operating
system.
WILDCARD Characters
DIR
FILE
File operations
BROCESS
User admin
Add a new user login to the system
#useradd testlogin will create a user by the name testlogin with all default values.
Printer
System status
Environment variable
Connectivity
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 backup.
Backup and restore using cpio cpio is mostly used in conjunction with other
commands to generate a list of files to be
copied:
#ls cpio o > /dev/rmt/c0tod0 --- copy the
contents of a directory into a tape archieve :
#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 device file.
Find files, directories
Find files, directories Find command is used to find the files,
directories and to run commands on the list
of files thus generated by default, find does
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 parameters such as
create time, modified time, of certain size
etc. please refer to man find for more option.
14. What is the command to assign a IP address to QFE network interface write the
vommand 10 30 usr bin log info entry in cron Jab will execute the program every 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
What is rpc?
What is jass?
Answer :- The Solaris Security Toolkit, formerly known as the jumpstart Architecture and
Security Scripts (jass) toolkit, lprovides a flexible and extensible mechanism to harden
and audit Solaris operating systems (oss)
What is jumpstart?
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, namely the
Transmission Control Protocol Internet protocol (TCP/IP) drivers Most kernel parameters
accessible through ndd can be modified without rebooting the system. 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
Answer:- etc system is a kernel configuration file The etc system file is the control file for
modifying which modules and parameters are to be loaded by the kernel at boot time. By
default, all lines in this file are commented out.
Modifying the kernels behavior (or configuration) requires editing the etc system file.
Altering this file allows you to modify the kernels treatment of loadable modules as well
as to modify kernel parameters for some performance tuning
Answer:- prstat
Answer:- open boot Prom this is 0 run level in Solaris stop + A or in command mode init
0
Answer:- dmesg
Answer:- vmstat S
Answer:- As said above, vmstat S and you can check the shared memory with ipcs a
Answer:- NFS version 2 supports 8Kb transfer rate, client can access unauthorized file
they give errors
NFS Version3 supports 32 kb transfer rate, first check the permissions after that they give
connection permission
If you have forgotten the root password for a server, how do you get back in?
How would you truncate a log file that is growing too large if you dont have space to
compress it or to move it somewhere else? How would you do it?
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 hosts file if
you give ping hostname domain name then I will search through internet.
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 :- fsck is a useful command to bring back a corrupted file system back into
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?
If you can ping a server but cant telnet or ssh to it what wrong?
Answer :- if service not enable the server uncomment tcp ssh service in etc inetd 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 question route add
Suppose if u want to reconfigure the kernel then how you are going to do?
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 does that
too) but, rather, that a change of permissions on the file is applied to all the link access
points. The link will show permissions of irwxrwxwx but that is for the link itself and not
the access to the file to which the link points. Thus if you want to change the permissions
for a command, such as su , you only 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
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?
Which command shows kernel parameters and and driver module information?
Sysconfig prtconfig dfmesg prtconf
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 type of names are used for administering disk driven in Solaris environment?
What is the command to check the system configuration (ex Memory size Hard disk
capacity No of Processor?
Answer cfgadm a
A daemon is a software process that runs in the background (continuously) and provides
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
Who
How will you add a virtual IP address to a server. Given the interface hme0/eth0/qe0
and IP 10.76.176.1?
When this is set on a directory only the file in that directory can be removed or 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 USR2 CLD PWR WINCH URG POL STOP TSTP CONT TTIN
TTOU VTALRM PROF XCPU XFSZ WAIATING 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
Ans cd $Home
#psrinfo
#psrinfo-v to see which processor are online and offline
#psradm f4 offline
#isainfo
How to see the default boot device from the boot prom #setenv boot-device disk
Boot-device=disk?
How to see all the information of the hardware related from bootprom?
#banner or #prtconf
#probe-scsi
#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 /pcirarp to set scsi for
booting of client?
#devfsadm Or
#drvconfig
#metadb
#metadb a f c 2 c0t0d0s1
#metastat
Newfs /dev/md/rdsk/d0
Mount /dev/md/dsk/d0 /nav
when used metastat command stripping with show an interlace value 32kb this shows it is
striped.
#metaclear d0
#metaclear d1
#metainit d1 1 1 c0t0d0s1
Metainit d2 1 1 c0t0d0s2
Metainit d3 m d1
Metattach d3 d2
Metastat
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 pid
Lofs list open files is used for to check a problem encounter with a file or process
/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 ?
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
Ypwhich
Which command will display all the master and slave servers ?
Ypcat k ypservers
Ypeat passwd
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
Ypserv ypbind
Ypcat passwd
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
Cd vary p
User ccs bin make passwd
Or yppush
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
Adding A user
#niscat a name=john uid=123 gid=111 home=/home/john shell=/bin/sh passwd.org dir
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)
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
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
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