Listed here are a bunch of unix commands.

----------------------------------------------------> change file date stamp touch t 199906042020 filename --> move partitions ufsdump 0f - /dev/rdsk/c0t0s0s0 (cd /home; ufsrestore xv -)

--> lay down file system with 1% minfree and inode density newfs m1 i81920 /dev/rdsk/c0t0d0s0 --> check file system fsck /dev/rdsk/c0t0d0s0 Q: starting sybase login as sybase, run: ./install/RUN_SYBASE Q: logging in as sybase sa isql -U sa <password> --> dump a partition and pipe to gzip. Watch > 2GB limit ufsdump 0f - /home gzip - >/tmp/home.dump.gz --> rewind offline a tape mt f /dev/rmt/0 rewoffl --> only allow 300MB for user /tmp access swap - /tmp tmpfs yes SIZE=300M --> verbose interactive restore ufsrestore ivf /dev/rmt/1 --> remove a printer from a class lpadmin p level5-line1 r level5-line --> truss a command truss -f - o /tmp/log.txt --> [DB] feed a script into sybase isql Urfe_xfer -Uuser -Ppassword -isqlscript >>blah.txt --> make a printer class lpadmin p level5-line1 c level5-line --> remove level2-line2 printer from printer class level2-line lpadmin -p level2-line2 -r level2-line --> add level2-line3 to printer class lpadmin -c level2-line -p level2-line3 --> [DB] how to change your password in isql sp_password password, password-new --> move a directory tar cf - ./games (cd /tmp; tar xvBpf - ) --> [DB] run a sybase script, and dump to file $ISQL -i$SCRIPTFILE -U$USER -D$DATABASE -P$PASS_ENC >> $SCRIPTLOGFILE --> move a directory to another server

server stop --> test the loading of a module PERL_DL_DEBUG=255 perl -e 'use CGI.gz --> shutdown mysql databse /usr/local/bin/mysqladmin shutdown -ppassword /etc/rc. tar xvBpf - --> check for SUID SGID files ncheck -F ufs -s /dev/dsk/c3t0d0s -./filesystem /opt/local/gzip . -o fstype nfs prune --> rebuild man pages catman w M man-page-directory or /usr/lib/makewhatis --> vi command to show special characters : set list --> adding an account useradd -u 120 g dls -d /apps/dls s /bin/ksh -c "comment" -m dls --> create a mysql database mysqladmin -uroot -ppassword create ebs --> starting mysql database /etc/rc.conf add in: edwardd stream tcp nowait root /bin/sh /bin/sh /home/sextone/bin/SERVER. kill HUP inetd.d/mysql.' --> shows open files fuser cu / --> Writing a Daemon: 1. edit /etc/services add service and port. mine 3.server start /usr/local/bin/safe_mysqld --> Invoke CPAN module install perl MCPAN eshell --> dump to zip ufsdump 0f .d/init./games rsh brucey cd /tmp\.remove core files find / -name core exec rm f {} \.d/mysql.> /tmp/dump..d/init.tar cf .conf --> how to mount a file system mount /dev/dsk/c3t0d0s4 /apps/data/easysoft/DEVT --> look at sar log sar f /var/adm/sa/sa24 --> write file checksums and size cksum filename --> show storage array info ssaadm display /dev/rdsk/c1t5d2s0 --> show all disks on device d . 2. edit /etc/inetd.

log -v -O www. nmap sS -F -o foo.2.luxadm display d --> examine for a specific OS finerprint nmap sS -p 80 -O -v <host> = examine OS --> show print jobs /usr/ucb/lpq Plevel6 --> Scan for known ports.h --> scp a whole directory.9 --> as above lsof -i @10.19. lsof u username --> show processes that has the file in use.140:/home/httpd/cgi-bin --> take processor 2 and 3 offline. log it.2.com//24 = --> show status of printer /usr/ucb/lpc status --> make a swap file: dd if=/dev/zero of=swapfile bs=1024 count=65535 mkswap . psradm -f 2 3 --> show processor stats verbose.h for errors /usr/include /usr/include/sys /usr/include/sys/errno.123.20./swapfile --> show open files for process lsof p PID --> show open files for all TCP connections lsof iTCP --> show open files for internet address lsof -iTCP@10./swapfile chmod 600 ./swapfile swapon .20. lsof /apps/cms/ECMS-Server --> show open files and retry every 5 seconds lsof p process-id r 5 --> mount a floppy mount -t vfat /dev/fd0 /mnt/floppy --> check here for debugging processes and errno.122 --> examine tcp ports lsof -iTCP@sarah:1-50000 --> show open files for user. psrinfo v .foo. do OS scan. preserve mods sudo scp -prv devel webadmin@203.

txt --> unzip and pipe to tar gzip -dc <kmysql-1_1_6_tar. comment out /export/home --> configuration file for sudoers /opt/local/etc/sudoers --> building ssh-1. -type f -exec rm {} \. snoop sarah brucey --> enable ip masquerading /sbin/ipchains -P forward DENY /sbin/ipchains -A forward -s 10.100/8 -j MASQ -> view su log file cat /var/adm/sulog --> establish a default router or gateway.6 needed a few things: /usr/openwin/bin in path /usr/xpg4/bin in path declare AR="/usr/xpg4/bin/ar" declare NM_PATH="/usr/xpg4/bin/nm" --> snoop network packets and get size and time stamp entries. snoop -S -ta empa1 --> access perl CPAN perl -MCPAN -e shell install DBI --> search for no password entries and lock all accounts.txt cp --> backup one liner tar cvf .98 --> turn off automounter on /export/home. for i in `passwd sa grep NP awk {print $1 ` .com" > /etc/defaultrouter echo "10. --> dump packets to a capture file sudo snoop o /tmp/tcp.2.> ebs.100.gz tar xvf - --> watch packets from two servers.conf so that hosts has files. vi /etc/auto_master.100.com sagacity" >> /etc/hosts change /etc/nsswitch. nameserver 203. echo "sagacity./home/ebs gzip . dns edit resolv.gz --> Look at selected packets in capture file sudo snoop -i /tmp/tcp.tar.132.27 on x86Solaris2.7.100.--> how to skip grant tables in mysql (over ride security) /usr/local/libexec/mysqld -Sg --> how to feed in an SQL program mysql <create_table.100 sagacity.sql --> rm all files in directories find .100.conf put in search .

tar cvf .. for file in `ls` do echo "sending $file to tape. in this case on crawl. rm 1 --> decrypt filename 1. you have to cd to dir before tar or else you will include path in tar ssh maggie "cd $DIRNAME.crypt . else you wi ll over-write the files.do echo locking $i passwd l $i done --> delete from a tar tar --delete -f fs_backup_Sunday. update /etc/fstab --> rebuild the windex file catman w M /usr/share/man --> execute tar on remote host sarah and send tarball to standard output. mkfs -t ext2 -c /dev/hda11 3. since it will not touch the disklabel. 2.crypt file crypt < 1 > 1. If you lay down a raw device. mount -t ext2 /dev/hda11 /opt2 4. for a database.$BASENAME" (cd $TPATH.$fs dd obs=63k of=$TAPE --> encrypt filename 1 and output to 1. ssh . over Cylinder 0. Must specify non rewinding. . use fdisk to make a parition..crypt and stdout to screen crypt < 1. tar xvf .tar home/ebs/tmp --> Example on backing up files to tape. ldd binary --> shell script stuff: # repeat a command 100 times x=100 while [ $x -gt 0 ] do command x=$(($x-1)) done --> Something very important to remember about partitions It is important to note that Cylinder 0 contains the disklabel.) --> dump a remote filesystem and send it to local tape drive. which becomes standard input for tar xvf and the file gets dumped locally.x $fw /usr/sbin/ufsdump 0cf . 1." echo `date` tar cvpf /dev/rmt/0n $file done --> making/adding a partition. A normal filesystem can be placed starting at Cylinder 0. which contains the partition table.crypt --> send a file to tape tar cvpf /dev/rmt/0 filename --> quicker way to search and replace in vi : %s/existing/new/g --> shows where and which shared library files an application uses.

stime.arg --> full details on ps /usr/bin/ps A -o user. cpio -pdm /apps --> cron structure min hour day-of-month month weekday command --> PatchDiag Tool. --> The nsradmin command is a command-line based administrative program for the NetWorker system.pid.pl patchdiag.then you will completely lose all your partitions.rss. --> move a partition find .xref > patchdiag.tty. /usr/sbin/nsr/nsradmin --> Spray a server -c number of packets -d delay in microseconds -l pakcet size in bytes /usr/sbin/spray -c 1 d 20 -l 4096 maggie --> Turn on bold.time. Get patches from: http://sunsolve. -print -exec chown -R sextone:staff {} \.pmem.pid. rpcinfo -b 390109 2 --> rewind a tape fast < /dev/rmt/0 --> show loaded modules /usr/sbin/modinfo sort -u .sun. ps -edf -o pcpu.com/private-cgi/patchpage.xref is available at: http://sunsolve.s. Normally nsradmin monitors and modifies NetWorker resources over the network.sun.user.pcpu.Ultra-4/sbin/prtdiag -v --> good ps formatting showing percent cpu first.2.com/sunsolve/patchdiag/ /opt/local/bin/patchdiag -x /opt/local/lib/patchdiag.vsz. You will then have to restore the disklabel.args --> chown the hidden files as well. find . bold=`tput smso` offbold=`tput rmso` echo "${bold}You must be the \"root\" user to run this script. and backup from tape if you happen to do this.`uname -n` --> command showing system parameters /usr/sbin/sysdef --> Get Ambient Temperature of Server /usr/platform/SUNW.25.${offbold}" --> good way to send a dir to tape tar cf /dev/rmt/0n directory --> example of bringing up an interface ifconfig hme0:1 inet 10.52 up --> show all connections netstat f inet --> rpcinfo makes an RPC call to an RPC server and reports what it finds.

log sarah --> set default run level.`find .gz ( cd /tmp.tar. chmod g+s.--> find world readable files and dirs find / -type d perm -2 print find .</tmp/dumpfile.gz tar xvf --> selectively extract from a tar archive tar xvf /tmp/iona.+l file --> print duplex landscape 4 qudrant printing mpage t l 4 --> install a patch installpatch . snoop osnoop.snoop --> write a snoop log (this will count the number of connections.sh_history --> send a bunch of files to tape . --> the +l is mandatory file and record locking while a program --> is accessing that file. untar in a /tmp directory zcat 104708-16.tar tar xvf .tar --> tee to a file echo "Start Date/Time: `date`" tee -a $LOG_FILE --> read a snoop file snoop -i anz-telnet. eg: boot sarahroot1 s nvalias sarahroot1 /sbus@1f. print` >/tmp/dumpfile./iona/.0:a --> clever way to archive tar cvf .8800000/sd@9. -type f perm -2 -print --> adding in a boot alias.fas@e. --> check to see if a patch has been installed showrev p grep package name --> unzip. which is prett y neat). sudo tar xvf . only the owner can change the mode.0/sunw. sudo ndd -get /dev/tcp . 5 for gui.? eg: sudo ndd -get /dev/tcp tcp_conn_req_max_q 128 ndd /dev/arp \? ndd /dev/ip \? ndd /dev/tcp \? ndd /dev/udp \? ndd /dev/icmp \? --> set sticky bit on group files. /etc/inittab --> show all exported filesystems showmount -e crawl --> shows all configurable variables for tcp interface.tar .tar.) --> check out revision level on ssa controller /usr/sbin/ssaadm display controller --> unzip and untar a file without having to create an intermediate tar file sudo gzip -dc /tmp/270599/post-EOD.

and let ifconfig setup the routing.Z cpio idm usr/lib/fs/ufs/ufsrestore --> running su as a user then ssh su .log --> good way to restore from cdrom a binary file zcat < /cdrom/cdrom0/Solaris_2. /usr/ucb/touch $nofiles .to extract cd /ssa/emphasys/sybase/dump dd ibs=18k if=<TAPE DEVICE> gunzip -c cpio idc --> boot block located here.tar cf /tmp/rules.20.h --> send an attachment via email from command prompt uuencode file./lost+found.cfg --> sed search example sed '/Sep\ 25/!d.0.cpio. cd . /castill/!d' /var/log/syslo -->should only be used at the EEPROM boot r --> should be used at single user mode reboot -.0 up route add default 10. must be 8192 bytes in size. if you specify an ip address and a netmask it will manage the routing and the broadcasting.h --> location of the limits file on solaris /usr/include/limits. dns lesson here is to unplumb interface.tar ruleb* objects.192. while [ "$nofiles" -le 650 ] ./lost+found nofiles=0 .6/Product/SUNWcsu/install/reloc.conf change hosts to files.20. eg sigaction /usr/include/sys/signal.tar.au nameserver 192. /lost+found .C *.192.tar.27 netmask 255.0.conf entry: domain rabobank. .dls-PROD -c "/opt/local/bin/ssh drp-stagger \"cd /tmp.chmod 700 .com./lost+found. do .0. done --> execute lynx lynx -cfg /usr/lib/lynx.chown root .1 1 verify the routing table: netstat rn add resolv./lost+found . nofile s=`expr $nofiles + 1` .gz mailx s backup root@crawl --> zero a file cat /dev/null > isam. mkdir . /usr/platform/`uname i`/lib/fs/ufs --> getting a server on the network add hosts entry for IP address clear configs: ifconfig pe0 unplumb ifconfig pe0 10.-r --> should be used in multiuser mode touch /reconfigure --> performing a remote dump find MFASYS cpio -oc gzip -c ssh brucey -l chaup dd obs=18k of=/dev/rmt/0n .252 edit /etc/nsswitch. chgrp root .2. /bin/ls\" " --> verify a newfs format sudo newfs Nv /dev/md/dsk/d96 --> making lost_found.gz file.W --> examine section 5 of man man -s 5 signal --> shows signals and definitions of structures.

binary files. awk '/#/ {print "Got a comment"}' /etc/hosts --> delete every 2nd field in file awk '{$2= "". This is definitely a power ful tool.new --> awk average/standard deviation program x1 += $1 x2 += $1*$1 END { x1 = x1/NR x2 = x2/NR sigma = sqrt(x2 .out </etc/termcap (sleep 10. etc. This is useful for synchronizing database dump files./a. rsync -avz -e ssh --rsync-path="/usr/local/bin/rsync" `pwd` myhost. cat) >trash --> synchronize files from one server to another. print}' datafile > datafile.1) print "Number of points = " NR print "Mean = " x1 print "Standard Deviation = " sigma print "Standard Error = " std_err .awk /etc/group BEGIN { FS = ":" } { print $1 "sort" } { nlines++ } END { print nlines } --> awk example.x1*x1) if (NR > 1) std_err = sigma/sqrt(NR .--> find all.com:/home/ebs /public_html --> Example Awk Script # run with awk -f/tmp/1. files associated with PID 22240 /usr/proc/bin/pfiles 22240 find file based on inode find i number ncheck i number --> good redirection example .

Sign up to vote on this title
UsefulNot useful