Recent Notes
Displaying keyword search results 1 - 10
Created by timo on January 25, 2012 20:13:13
Last update: January 25, 2012 20:13:13
The MIPS CPU is able to run both big-endian and little-endian. So a system built on MIPS can be either big-endian (mips) or little-endian (mipsel).
The file command shows the architecture:
$ file ls
ls: ELF 32-bit LSB executable, MIPS, ...
but readelf will tell the endianness:
$ readelf -h ls
ELF Header:
Magic: 7f 45...
Created by Dr. Xi on March 28, 2011 11:11:33
Last update: March 28, 2011 11:13:21
grep is a versatile command with many variations (grep, egrep, fgrep, then various implementations). It uses a regula expression (regex) pattern to filter input. But then there are basic and extended flavors of regex - leading to even more confusion. And, beware that there are lots of bad examples of regex in the wild... There are two critical questions to ask when you use grep: which grep implementation are you using? what is the flavor of the regex? Here are some examples for gnu grep v2.7:
# Find all numbers (no decimal point), basic regex... Use the -o flag to show only the matching part instead of the whole matching line: grep -o -E '\b[0-9]{2}\b' The good thing about the gnu grep is that it...
Created by voodoo on June 17, 2010 16:02:07
Last update: June 17, 2010 16:03:05
Use the uname command to display the SunOS version:
$ uname -a
SunOS STAWOW1 5.10 Generic_142900-01...
I can't find a command to display Solaris version. But the /etc/release file gives version information:
$ cat /etc/release
Solar...
This is a mapping of SunOS versions to Solaris versions:
SunOS Version Solaris Version
SunOS 5.4 Solaris 2.4
SunOS 5.5 Solaris 2.5
SunOS 5.5.1 Solaris 2.5.1
SunOS 5.6 Solaris 2.6
SunOS 5.7 Solaris 7
SunOS 5.8 Solaris 8
SunOS 5.9 Solaris 9
SunOS 5.10 Solaris 10
Reference:
SUN Solaris Unix Commands and Scripts
Created by Dr. Xi on December 04, 2009 04:33:05
Last update: December 04, 2009 04:33:05
Variable Meaning $_ The default or implicit variable. @_ Within a subroutine the array @_ contains the parameters passed to that subroutine. $a, $b Special package variables when using sort() $<digit> Contains the subpattern from the corresponding set of capturing parentheses from the last pattern match, not counting patterns matched in nested blocks that have been exited already. $. Current line number for the last filehandle accessed. $/ The input record separator, newline by default. $| If set to nonzero, forces a flush right away and after every write or print on the currently selected output channel. Default is 0 (regardless of whether the channel is really buffered by the system or not; $| tells you only whether you've asked Perl explicitly to flush after...
Created by Dr. Xi on September 29, 2008 23:05:12
Last update: September 29, 2008 23:06:16
These variables are set or used by the Unix shell to modify its behavior. Variable Description ENV=file Name of script that gets executed at startup; Usually, ENV=$HOME/.kshrc FCEDIT=file Editor used by fc (fix command) command. If $FCEDIT is not defined, use $EDITOR, otherwise use the default (vi or ed). FPATH=dirs Directories to search for function definitions; undefined functions are set via typeset -fu . FPATH is searched when these functions are first referenced. HISTFILE=file File in which to store command history. Default is $HOME/.sh_history for Korn shell, $HOME/.bash_history for Bash. If not set, history is lost after logout. HISTSIZE=n Max number of commands to keep in history. HOME=dir Home directory; set by login from passwd file. IFS='chars' Internal field separators. Default is space, tab, and...
Created by Dr. Xi on September 26, 2008 21:49:35
Last update: September 26, 2008 21:51:53
The ulimit command (builtin for bash ) controls resource limits available to the shell and subprocesses. ulimit -a displays all current limits.
peaches@peachesv:~$ ulimit -a core file siz... ulimit accepts options -H and -S , which specifies hard or soft limit. The resource options are listed below: Option Description -a All current limits are reported -c The maximum size of core files created -d The maximum size of a process’s data segment -e The maximum scheduling priority ("nice") -f The maximum size of files written by the shell and its children -i The maximum number of pending signals -l The maximum size that may be locked into memory -m The maximum resident set size -n The maximum number of open file descriptors (most systems...
Created by Dr. Xi on December 12, 2007 20:30:01
Last update: December 12, 2007 20:32:23
This is a script to tail a log file through the web browser. It uses AJAX, apache web server, mod_python, UNIX utilities tail (requires the --lines switch) and wc . The log file may reside on the web server or any other host accessible from the web server through SSH.
Although it's written in python, it should be easy to port to other languages such as Perl.
Apache httpd.conf :
LoadModule python_module modules/mod_python.so
...
Python script:
import time, os
from os.path import basename
...
Created by Dr. Xi on August 29, 2007 03:50:17
Last update: August 29, 2007 03:53:02
The command lsof lists all open files. Here are some simple uses:
1. List what files are in use by process with id 2512:
/usr/sbin/lsof -p 2512
2. To find the process that has /u/abe/foo open, use:
lsof /u/abe/foo
3. To find who's accessing the CDROM:
$ /usr/sbin/lsof /media/cdrom
COMMAND PID ...
4. To list all files using any protocol on port 80:
lsof -i :80
This is a link to the man page: http://www.netadmintools.com/html/lsof.man.html
Created by Dr. Xi on June 12, 2007 01:33:55
Last update: June 12, 2007 01:34:18
Use the umask command to print or set the file creation mask:
umask # print the current value of ...
Created by Dr. Xi on June 12, 2007 01:08:40
Last update: June 12, 2007 01:08:40
Use the touch command to update the timestamp of a file:
touch file1 # update the access time and t...