GIT – A very brief description of the basic commands is presented here, for detailed information about these commands type man [-name] at the system prompt. 

Find all files with extension .js and make a tar of it
find /xyz -name “*.js” -print -exec tar -rvf /tmp/try1.tar ‘{}’ \; -print

Delete all the files with .tar as extension in xyz dir
find /xyz -mtime 2 -name “*.tar” -exec rm -rf ‘{}’ \; -print

Open all the files in dir under /xyz and search for word “Plasticcs”
find /xyz/* -exec grep -il “Plastics” ‘{}’ \; -print

Logical or in find.
find . -type f \( -name “*.htm” -o -name “*.cgi” \) -exec /usr/local/bin/tar -rvf /ge/backup/did.tar ‘{}’ \; -print

Find files between certain size limit
find /ge/www -type f \( -size +1048576c -a -size -52428800c \) -in solaris

In solars there is no case in-senstive search at time of writing
find /path -name “[Aa][Bb][Cc][Dd].txt” -print

Tell fine to exclude certain directories while searching:
what ever is written before prune will be excluded.
find ./ -type f -name projects -prune -o -exec grep -il “10.33.15.64″ ‘{}’ \;

To first list the packages installed on paritcualr date an then remove.
rpm -qa –last | grep “13 June 2008″ | cut -f 1 -d ” ” | xargs rpm -e

Will tell the process id of the runnign ppa

pidof app name

Obtain pattern from file a and search in filel b

grep -f flea fileb

To list hardware related details on box:

dmidecode
lshw
lspci
smartctl

/var/svc/manifest where all xml files are stored per service for SMF ( Solaris only )
– To list the status of the service dependency information : svcs -l sendmail
– Show the status of all hte service : svcs -a
– Sow dependecy of a servie :  svcs -d FMRI
– Stop service : svcadm disable FMRI
– Start service : svcadm enable FMRI

The following command lists services that are controlled by inetd.
Each service’s FMRI is listed, along with the run state and whether the service is enabled or disabled. : inetadm

Here is one good article about smf :

http://www.sun.com/bigadmin/content/selfheal/smf-quickstart.jsp

To chk the system configuration like h/w processors ( Solaris):

prtconf -b
psrinfo -pv
sysdef

To chk things under /proc file system:( Solaris only )

pcred: Display process credentials (eg EUID/EGID, RUID/RGID, saved UIDs/GIDs)
pfiles: Reports fstat() and fcntl() information for all open files. This includes information on the inode number, file system, ownership and size.
pflags: Prints the tracing flags, pending and held signals and other /proc status information for each LWP.
pgrep: Finds processes matching certain criteria.
pkill: Kills specified processes.
pldd: Lists dynamic libraries linked to the process.
pmap: Prints process address space map.
prun: Starts stopped processes.
prstat: Display process performance-related statistics.
ps: List process information.
psig: Lists signal actions.
pstack: Prints a stack trace for each LWP in the process.
pstop: Stops the process.
ptime: Times the command; does not time children.
ptree: Prints process genealogy.
pwait: Wait for specified processes to complete.
pwdx: Prints process working directory.

To check hardware issues :( Solaris only )

prtdiag -v
dmesg
fmadm – only sol 10

Network related (Solaris):

netstat -s  — Check protocol status
netstat -i  — Check interface status

Network interfaces can have these names :
ce, hme, bge, e1000g , qfe ( Quad Fast Ethernet )

dladm show-link – show all network interfaces which are not even configured on servers (s10)
show-aggr – to show teaming of NIC
ndd and kstat (s8) – to determine speed and setting speed
ifconfig interface plumb up to bring up interface
ifconfig qfe0 192.168.84.3 netmask + 255.255.255.0 – assign ip address
Edit the /etc/hostname.interface file similar to other files

If you want to see qfe2 is there or no or settings about it first set /dev/qfe device to tha instance :

/usr/sbin/ndd -set /dev/qfe instance 2

Then :

ndd -get /dev/qfe link_status (0=down 1=up)
ndd -get /dev/qfe link_mode (0=half duplex 1=full duplex)
ndd -get /dev/qfe link_speed (0=10Mbps 1=100Mbps)

Solaris:
Structure used by Volume manger : ( Solaris only )

dg- disk group
dm – disk
v – voulume
pl- plex

disk group > volume > plesk > disk

1. VM disks are made up of physical partitions.
2. Disk Group is a group of VM Disks
3. Sub Disks : kind of partitions of VM disks
4. These partitioin can be under raid 5 , raid 0 or some thing like that and that object is called Plex.

Disk Volume manger commands:

1.  vxdisk list : will list all the virtual Disks and actual partitions
2.  vxprint -ht  : will show the actual objects
3.  vxdg -g diskgroup free : will show free space of VM disks in a disk group.
4.   vxdg list : List Disk groups
5. vxdctl enable
Request that vxconfigd enter enabled mode, import all disk groups, and rebuild the volume and plex device node directories. This operation can be used even if vxconfigd is already in enabled mode. The primary purpose for using this operation when in enabled mode is to rebuild the volume and plex device nodes. This operation will also cause vxconfigd to scan for any disks that were newly added since vxconfigd was last started. In this manner, disks can be dynamically configured to the system and then recognized by the Volume Manager.

6.vxvol – start / stop volumes

apropos [keyword] locate commands in online reference manual by keyword
as -P [filename] Assembly language compiler
cat [filename] concatenate and display (similar to ‘type in MS-DOS) files
cc [filename] SUN C compiler
CC [filename] SUN C++ compiler
cd [pathname] change working directory (as in MS-DOS)
chgrp [group] [file] change the group ownership of a file
chmod [mode] [file] change permission mode of a file or directory
clear clears the screen
cp [source] [destination] copy files (use * as wildcard) from source to destination
date display the system date
du -k display your disk usage per directory or file
emacs [filename] GNU’s emacs editor
find [filename] find files or directories by name or partial matches
finger [username] display information about a user
ftp send files to/receive files from remote sites
g++ [filename] GNU’s C++ compiler
gcc [filename] GNU’s C compiler
grep [string] [file] searches file for matching string
h display recently entered commands
kill [process #] send a terminate signal to process
logout logout from the system
lpq display the queue of printer jobs
lpr [filename] send a job to the printer
lprm [job #] cancel a print job on the printer queue
ls list the contents of a directory (similar to dir in MS-DOS)
lynx text based web browser
man [command name] access to help on commands
mkdir [dir name] create a directory (similar to mkdir in MS-DOS)
more [filename] displays a file one screen length at a time
mv [source] [destination] move or rename files from source to destination
passwd [username] change your password
pc [filename] Pascal compiler
pico text editor
pine menu driven mail program
ps display the status of current processes
quota -v [username] display allocated disk quota to user
rlogin [machine name] remote login from one system to another
rm [file] remove files (similar to delete in MS-DOS)
rmdir remove directories (similar to rmdir in MS-DOS)
script make typescript of a file name
talk [username] talk to another user
telnet interface to a remote system using telnet protocol
uncompress uncompress compressed file (usually with .Z extension)
unzip uncompress compressed file (usually with .zip extension)
users display a list of users currently logged in
vi [filename] visual display editor
w display information about logged on users
whoami display effective current user name

Thảo luận bài viết tại forum : http://forum.gocit.vn/threads/basic-solaris-commands.663/

Print Friendly

Comments

comments

Bài viết liên quan