Recent Notes
Displaying keyword search results 1 - 10
Created by Dr. Xi on February 24, 2012 13:01:01
Last update: February 24, 2012 13:01:01
To zip all files under js and css , but exclude the svn files:
$ zip -r css-js.zip css js -x '*.svn*'
Created by voodoo on February 16, 2012 14:56:44
Last update: February 16, 2012 15:52:56
Shell functions are declared using this syntax:
[ function ] name () compound-command [ redirectio...
Example:
function ll {
ls -alF $*
}
Example 2:
ll() {
ls -alF $*
}
Shell functions can be exported to subshells with the -f switch:
$ export -f ll
However , I had problems logging in Ubuntu 11.10 after I added this to .profile :
export -f ll
Created by voodoo on January 03, 2012 08:41:21
Last update: February 16, 2012 15:50:06
This is the command to print all regular files in the src folder but excluding all files within the .svn folders:
$ find src -name .svn -prune -o -type f -print
where -o is the or operator.
Define a shortcut:
ff ()
{
find $1 -name .svn -prune -o -...
Created by voodoo on February 16, 2012 14:57:35
Last update: February 16, 2012 14:57:35
You can use either declare or typeset to list function definitions :
To list all function names:
declare -F
To display a function definition:
$ declare -f quote
quote ()
{
echo ...
If you see a lot of functions with names starting with the underscore ( _ ) and wonder where they come from, they are created by the scripts in /etc/bash_completion.d/ .
Created by voodoo on February 16, 2012 13:35:38
Last update: February 16, 2012 13:35:57
The C shell allows you to define aliases with arguments: \!^ passes the first argument, \!* passes all arguments. Examples from http://unixhelp.ed.ac.uk :
alias print 'lpr \!^ -Pps5'
alias print 'lp...
In ksh or bash you cannot define alias with arguments. Use function instead.
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 zhidao on January 18, 2012 12:03:32
Last update: January 18, 2012 12:03:32
I think this is simpler:
grep -l limit .*
Created by Dr. Xi on January 06, 2012 13:44:55
Last update: January 06, 2012 13:44:55
To exclude CVS directories:
grep -R -l --exclude-dir=CVS 'string_to_find‘ src
...
To exclude .svn directories:
grep -R -l --exclude-dir=.svn 'string_to_find‘ src...
Created by voodoo on November 22, 2011 12:27:12
Last update: November 22, 2011 12:31:50
Unix hidden files are named starting with a dot ".".
To find hidden files in the current directory:
$ find . -type f -name '.*'
or
$ find . -type f | grep \\/\\.
To find hidden files in the marketing directory:
$ find marketing -type f -name '.*'
or
$ find marketing -type f | grep \\/\\.
Created by magnum on October 09, 2011 19:53:26
Last update: October 09, 2011 19:53:50
#include <stdio.h> #include <stdlib.h> #incl... UNIXguide.net explains this option well: This socket option tells the kernel that even if this port is busy (in the TIME_WAIT state), go ahead and reuse it anyway. If it is busy, but with another state, you will still get an address already in use error. It is useful if your server has been shut down, and then restarted right away while sockets are still active on its port. You should be aware that if any unexpected data comes in, it may confuse your server, but while this is possible, it is not likely. It has been pointed out that "A socket is a 5 tuple (proto, local addr, local port, remote addr, remote port). SO_REUSEADDR just says that you...