Showing posts with label unix. Show all posts
Showing posts with label unix. Show all posts

Sunday, October 28, 2007

Ubuntu - core dump

From https://answers.launchpad.net/ubuntu/+question/10616
It appears that resource limits (which include the maximum size of a core dump file) are set by PAM on login. The settings for these limits are in /etc/security/limits.conf, which on my system (which is unmodified) is comments only. A quick look at the source code suggests that the default core dump limit is 0 (zero), which means no dump at all is created (even though the message suggests otherwise).

In summary: edit /etc/security/limits.conf, set the core limit to be non-zero (measured in kilobytes), and log in again.

I hope that works!

Wednesday, September 5, 2007

UNIX/LINUX - Customized bash prompt

If you want your bash prompt to look like this:

[10:27:57 AM] hostname:~/some_dir
$

Put this in your .bashrc:
function proml
{
local BLACK="\[\033[0;30m\]"
local RED="\[\033[1;31m\]"
local GREEN="\[\033[0;32m\]"
local YELLOW="\[\033[1;33m\]"
local BLUE="\[\033[0;34m\]"
local PURPLE="\[\033[0;35m\]"
local CYAN="\[\033[1;36m\]"
local WHITE="\[\033[1;37m\]"

case $TERM in
xterm*)
local TITLEBAR='\[\033]0;\h:\w\007\]'
;;
ansi*)
local TITLEBAR='\[\033]0;\h:\w\007\]'
;;
*)
local TITLEBAR=''
;;
esac

PS1="${TITLEBAR}
${GREEN}[\$(date +%r)] ${RED}\h:${YELLOW}\w\
${WHITE}\n$ "
PS2='> '
PS4='+ '
}
proml

You can change the colors and other properties as well.

Wednesday, June 13, 2007

LINUX/UNIX - inputrc options

Add this to your ~/.inputrc to
# get default system bindings
$include /etc/inputrc

# ignore case on tab complete
set completion-ignore-case On

# prefer visual bell
set prefer-visible-bell

Wednesday, May 9, 2007

KDE - Enable mouse gestures

Run kcontrol
Regional & Accessibility → Input Actions
Gestures tab
Unclick Disable mouse gestues global
Change Mouse button to secondary button (right mouse button)

Open up Konqueror
Hold on to right-mouse button, move left, release
It should have navigated back a page

Wednesday, May 2, 2007

UNIX/Linux - Recursive, forceful remove

For you n00bs, to recursively delete a directory with prompts for each file:
rm -rf dir_name

Monday, April 30, 2007

UNIX/Linux - Build essentials

In order to build stuff in Ubuntu, I needed to install the build-essentials:
sudo apt-get install build-essential

Who knew?

Tuesday, April 17, 2007

UNIX/Linux - Find command

To look for files in the current directory tree then run a command on them:
find . -name <file-pattern> -exec <command> {} \;

Examples

To grep for "hello" inside all .txt files:
find . -name *.txt -exec grep -Hn hello {} \;

Put this in a shell script to recursively grep .cpp and .hpp files for the first argument:
#!/bin/bash
find . -name *.[ch]pp -exec grep -Hn "$1" {} \;

Thursday, March 1, 2007

UNIX/Linux - Command Line Tips

CommandDescription
du -hs dirDisplays disk usage of dir. -h gives human readable format (e.g. 12M) and -s suppresses every recursive directory's output
echo $?Displays the return code of the previously exited program
pgrep -lf process_nameDisplays pid of all running processes named process_name. -l lists the process name and -f matches in the full command line

Thursday, February 15, 2007

Linux - Reinstalled Kubuntu

A few days ago, I wanted to install the new subversion client for Kubuntu because the old one didn't have the 'svn diff -c' option. I guess I shouldn't have because it depends on a newer cpp package, which the system depends on it. So after installing the new cpp package, my thesis wouldn't compile. I tried installing the old cpp but it kept using the new one. So last night I reinstalled Kubuntu. I updated all the packages and everything looks good. Hopefully, I will be able to work on my thesis tonight.