Recent Notes
Displaying keyword search results 1 - 10
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 woolf on July 05, 2011 15:38:52
Last update: July 05, 2011 15:39:55
By default VirtualBox enables one network adapter ("Adapter 1") with NAT. Connection from the guest OS to the outside world works natually when the guest network adapter is assigned an IP address by the VirtualBox DHCP server. Use VBoxManage to see a list of DHCP servers:
$ VBoxManage list dhcpservers NetworkName: H... The guest IP address is not visible from the outside world. If you need to access a server on the guest OS, you need to set up port forwarding in VirtualBox settings: Settings -> Network -> Adapter 1 -> Advanced -> Port Forwarding . Beware that on Linux/Unix, port forwarding may not work if you bind to a privileged port (port number < 1024) but you are not root. Bridged networking can be...
Created by woolf on April 12, 2011 09:20:08
Last update: April 12, 2011 09:20:08
First try (this lists files by directory, including directories themselves):
ls -R -lrt
Second try:
find . -type f | xargs ls -lrt
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:15:18
Last update: September 29, 2008 23:15:18
# loop 5 times with for
for (( i = 1 ; i ...
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 29, 2008 02:50:50
Last update: September 29, 2008 02:51:04
Using the alias command without arguments, or with the -p option prints out the list of aliases:
[peaches@bashful ~]$ alias -p
alias l.='ls -d ....
Follow the examples above to define a new alias.
Created by Dr. Xi on September 26, 2008 16:08:21
Last update: September 26, 2008 16:08:21
To list files containing the word limit in the current directory:
grep -l limit *
However, the wild card * does not expand to include hidden files. To include hidden files, use:
ls -a | xargs grep -l limit
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 August 29, 2007 02:10:21
Last update: August 29, 2007 02:10:21
In vi mode ( set -o vi ), hit ESC-\ (escape-backslash) for file name
completion. In emacs mode, hit ESC-ESC .
For file list hit the ESC key followed by the = key.