Mr. Peabody Explains fork() Introduction How Windows Does It How Unix Does It So Why Do People Want the Unix Way? How does it work in Perl? Introduction UNIX – Fork Explained Say, Mr Peabody. I was just reading through the Perl 5.6 release notes and noticed that a new function called fork() is now […]
UNIX Perl – Get local IP with ifconfig Replace ETH0 with the interface you need.. my $IP = `ifconfig eth0| awk ‘/dr:/{gsub(/.*:/,””,\$2);print\$2}’`; $IP =~ s/\s+$//;
UNIX Boot Mode – Run Levels Runlevel “3” will boot to text or console mode and “5” will boot to the graphical login mode ( “4” for slackware) Runlevel Scripts Directory (Red Hat/Fedora Core) State 0 /etc/rc.d/rc0.d/ shutdown/halt system 1 /etc/rc.d/rc1.d/ Single user mode 2 /etc/rc.d/rc2.d/ Multiuser with no network services exported 3 /etc/rc.d/rc3.d/ Default […]
Unix find and replace text within all files within a directory Trying to do a search on an entire directory, finding all the instances of the text “applicationX” and replacing all instances with the text “applicationY”. find /path/to/start/from/ -type f | xargs perl -pi -e ‘s/applicationX/applicationY/g’
SCCS – script header While sccs checked out a file, add these lines to the top of your script to preserve versions and file information. [bash] # Master: %P% # SCCS id: %Z% %M% %I% %E% [/bash]
VNC server on Unix Starting the VNC server on Unix for the First time VNC Server installs in /usr/local/bin, you need to make sure you have both /usr/local/bin and /usr/openwin/bin in your path, also the first time you run vnc you need to setup a vnc password, this is done with the /usr/local/bin/vncpassword command. After […]
Change passwd – permission denied (NIS) I setup a new NIS server and put the NIS source files in /var/yp/src/ The command line “passwd” gave me a permission denied when changing an NIS user’s password. A restart of yp fixed the problem for me.. Eventually I restarted NIS with: [bash] /usr/lib/netsvc/yp/ypstop /usr/lib/netsvc/yp/ypstart [/bash]
Checking Memory on UNIX [bash]ps -A –sort -rss -o comm,pmem | head -n 11[/bash] [bash]ps -auxf | sort -nr -k 4 | head -10[/bash] [bash]free[/bash] [bash]free -m[/bash] [bash]ps aux | awk ‚Äò{sum +=$4}; END {print sum}‚Äô[/bash]
Search String in Directory – UNIX How to search for a string in a selection of files (-exec grep …). [bash] find . -exec grep “searchstring” ‘{}’ \; -print [/bash] [bash] find . -exec grep “searchstring” ‘{}’ \; -ls [/bash] This command will search in the current directory and all sub directories. All files that […]
Copying a filesystem with Veritas This procedure is to create an exact copy of a Veritas filesystem. You will need enough spare disks in your volume group, and ideally anything using the filesystem should be killed. create a mirror # vxassist -g tier3dg mirror tier3fs # vxprint tier3fs Disk group: tier3dg TY NAME ASSOC KSTATE […]
- 1
- 2