Recent Notes

Displaying keyword search results 1 - 9
Created by voodoo on September 17, 2012 15:02:15    Last update: September 17, 2012 15:02:15
Start gdb with the executable and coredump: $ gdb <path to executable> core While in the debugger, use the following commands: (gdb) where ("shows a summary of the stack") ... Example debug session from Debugging Under Unix: gdb Tutorial : Use backtrace (or bt ) to see the callstack: (gdb) backtrace #0 Node<int>::next (this=0x0) ... Inspect the value of item_to_remove at address 0xffbef014 (the value is 1): (gdb) x 0xffbef014 0xffbef014: 0x00000001 (g... Note: The program must be compiled with the debug switch -g in order to see the source code. More resources: Linux software debugging with GDB Debugging with gdb
Created by woolf on September 08, 2011 11:19:52    Last update: September 08, 2011 11:19:52
To check a command exists on PATH: Use the return code of which : which some_command &>/dev/null [ $? -eq 0 ] || ... For bash, use type -P : type -P some_command &>/dev/null && echo "ome_comm... or check_path() { if ! type -P $1 &> /dev/...
Created by Dr. Xi on February 17, 2011 14:06:22    Last update: February 17, 2011 14:06:22
This is the crontab to run a cron job every 15 minutes: */15 * * * * /path/to/executable >/redirect/output... or, 0,15,30,45 * * * * /path/to/executable >/redirect/... In general, the format is: minute hour day_of_month month day_of_week command Valid values are: Field Value minute 0-59 hour 0-23 day of month 1-31 month 1-12 day of week 0-6 (Sunday = 0) Reference: crontab(5) - Linux man page
Created by voodoo on June 17, 2010 15:23:02    Last update: June 17, 2010 15:35:40
Use useradd to add a user (the switches are not required, but it's a good idea to give them. For example, without -m you'd create a user without a home directory): # -d switch specifies user home directory # -m ... You also need to use the passwd command to set a new password before the user can log in. To delete a user, use the userdel command: userdel demo
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 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 June 02, 2007 02:11:54    Last update: August 20, 2007 03:26:54
Use the ldd command to display shared library (dynamic) dependencies of an executable or shared library object. This is a typical output: [patrick@dellpc ~]$ ldd /bin/ls linux-g... If ldd complains that some library can't be found, you can set the environment variable LD_LIBRARY_PATH to alter the search path for shared libraries.
Created by Dr. Xi on June 02, 2007 02:17:28    Last update: June 02, 2007 02:17:28
Use the ln command to create a symbolic link: ln -s /path/to/destination symlink
Created by Dr. Xi on May 01, 2007 02:43:31    Last update: May 01, 2007 02:43:31
On UNIX, you can user the which command to find out the full path of an executable. For example, which perl will display the full path to the Perl executable on your machine.