View previous topic :: View next topic |
Author |
Message |
lisa Retired Dev
Joined: 01 Jun 2003 Posts: 273 Location: York, UK again! Horray!
|
Posted: Tue Jul 29, 2003 12:57 am Post subject: |
|
|
Here's mine...
Code: |
alias nano='nano -w'
alias rm='rm -i'
alias mv='mv -iv'
alias cp='cp -iv'
alias ls='ls --color=auto'
alias rndc='rndc -k /chroot/dns/etc/bind/rndc.key'
export PS1='\[\033[01;32m\]\u@\h \[\033[01;34m\]\W \$ \[\033[00m\]'
case $TERM in
xterm*|rxvt|eterm)
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"'
;;
screen)
PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\"'
;;
esac
|
This along with bash-completion makes my life easier. _________________ Distcc guide
Visit my website
I maintain Distcc, Ccache, Memcached, and some others (i think) |
|
Back to top |
|
|
Ivion n00b
Joined: 23 Jan 2003 Posts: 45 Location: Amsterdam
|
Posted: Tue Jul 29, 2003 2:21 am Post subject: |
|
|
thadk wrote: | No, I'm pretty sure that a backgrounded(&) process dies when it's parent (the xterm/ssh session) does. I'm trying to figure out how to make it so the parent is pid 1 (at least thats the definition of a daemon I found)
With kde I can sort of do what I want with `kdeinit` |
Well, 1 option is screen, with which you can 'detach' processes and they will keep running even if you log out. And you also have the ability to 'retach' processes.
Another option is:
This 'disowns' a process, this actually starts the program in a subshell, and puts the program inside that subshell into the background. ^_^
I'm not sure if this will work with what you want to accomplish, but I'm sure screen will. |
|
Back to top |
|
|
isomer n00b
Joined: 27 May 2003 Posts: 19 Location: Canada, eh?
|
Posted: Tue Jul 29, 2003 3:01 am Post subject: |
|
|
thadk wrote: | No, I'm pretty sure that a backgrounded(&) process dies when it's parent (the xterm/ssh session) does. I'm trying to figure out how to make it so the parent is pid 1 (at least thats the definition of a daemon I found) |
Try this:
Code: | $ nohup /path/to/program |
The program you start won't be killed by the HUP signal that way, and will live on even if its xterm is closed.
-isomer |
|
Back to top |
|
|
thadk Tux's lil' helper
Joined: 21 Jun 2002 Posts: 123
|
Posted: Tue Jul 29, 2003 4:02 am Post subject: Thanks!! |
|
|
I think I recall reading bout that somewhere now but it got lost. |
|
Back to top |
|
|
viperlin Veteran
Joined: 15 Apr 2003 Posts: 1319 Location: UK
|
Posted: Tue Jul 29, 2003 10:42 am Post subject: |
|
|
in an aterm/xterm/eterm and others backgrounding something will stay after you close it if you close it by pressing CTRL-D instead of using the window manager exit button, or at least it does for me. |
|
Back to top |
|
|
Bellrang QT Tux's lil' helper
Joined: 16 May 2003 Posts: 81
|
Posted: Wed Jul 30, 2003 2:20 am Post subject: |
|
|
nico-- wrote: | If you leave the xterm open you still get output from the program... you have to redirect the output to /dev/null but i can't remember how to do that, heh. |
Code: | mpg123 mylegallyrippedmp3file.mp3 > /dev/null & |
I wrote: | Probably another dumb question...
Is there a way to control what shows up in the titlebar of Putty? When I emerge (using an ssh session with Putty), the titlebar is changed. When emerge is done, the titlebar just displayed "xterm".
When I ssh into my RedHat box, it shows user@machine... that's kinda nice.
Any ideas? |
Any ideas about this yet? _________________ I <3 forums.gentoo.org |
|
Back to top |
|
|
Kalin Tux's lil' helper
Joined: 22 Dec 2002 Posts: 130 Location: Germany
|
Posted: Sun Aug 03, 2003 11:51 am Post subject: |
|
|
Just saw this thread, so here are my aliases:
Code: |
alias ll='ls -l --color=always'
alias emerge='emerge -v'
alias merge='ACCEPT_KEYWORDS=~x86 emerge'
alias unmerge='emerge unmerge'
alias nano='nano -w'
# Commands I cannot remember are stored here
alias h='less /usr/local/doc/commands'
# No more alsa drivers to fill the display :-)
alias llmod='lsmod |grep -v snd'
# Don't forget export GREP_COLOR="1;32" for green :-)
alias grep='grep --color=auto'
|
All this goes to /etc/profile.d/alias!
I have Code: | [ -f /etc/profile.d/alias ] && source /etc/profile.d/alias | in /etc/profile to load it for every user.
[/code] |
|
Back to top |
|
|
Guezz-Who Tux's lil' helper
Joined: 15 Mar 2003 Posts: 90 Location: Norway::Bergen
|
Posted: Sun Aug 03, 2003 5:37 pm Post subject: My humble little alias/options/completion collection.. :) |
|
|
I got a little inspired from ebrostig's tab completions so I made some more..
Notice the 'service' function.. you can type 'service pcm[tab]' and it will autocomplete it to pcmcia.. 'service pcmcia z[tab]' will autocomplete to 'service pcmcia zap'
My list of aliases/options/completions:
Code: | #!/bin/bash
#some vars:
GENTOO="1" #set to 1 on gentoo (i have multiple computers with different distros)
#alias:
alias ls="ls --color=auto"
alias lsd="ls --color -d */" #only dirs
alias rm="rm -i"
alias mv="mv -iv"
alias cp="cp -iv"
alias grep="grep --color=auto"
export GREP_COLOR="1;32" #green color grep..
alias lftp="lftp -d" #show some usefull debug info in lftp
alias recal="history | grep"
alias h="history"
alias cman="PAGER=\"cat\" man" #cat a man page..
alias psg="ps -ef | grep -v grep | grep" # ps grep
alias gsu="gnomesu -c"
alias vi="vim -o"
alias vim="vim -o"
alias vimdiff="vimdiff -X"
alias xdiff="gvimdiff"
alias le="less"
alias mo="more"
alias mp="mplayer"
#shows what ip you have on the internet (if there's no proxys that is..
alias whatip="wget -O - http://www.whatismyip.com 2> /dev/null | grep \"<h1>\" | cut -d \" \" -f 4"
#gentoo stuff (emerge aliases and service function):
if [ $GENTOO -eq 1 ] ; then
alias emerge="emerge -v"
alias nemerge="nice -n 5 emerge"
alias unmerge="emerge unmerge"
alias aemerge="ACCEPT_KEYWORDS=\"~x86\" emerge"
function service { # run services from /etc/init.d/
if [ -z $1 ] ; then
ls /etc/init.d
else
/etc/init.d/$1 $2
fi
}
function _listservices { # get tab completion for services and options
local cur
local opt
COMPREPLY=()
opt=${COMP_WORDS[2]}
cur=${COMP_WORDS[COMP_CWORD]}
if [ -z $opt ] ; then
COMPREPLY=( $( ls -1 /etc/init.d/ | grep ^$cur ) )
else
COMPREPLY=( $( compgen -W 'start stop restart pause zap status' | grep ^$cur) )
fi
}
complete -F _listservices service
fi
#Shell options:
shopt -s cdspell #error correction
shopt -s cdable_vars
shopt -s sourcepath
shopt -s no_empty_cmd_completion
shopt -s histappend histreedit
shopt -s extglob
shopt -s extglob
#tab completion stuff:
complete -A hostname rsh rcp telnet rlogin lftp ftp ping disk ssh
complete -A command nohup exec eval trace strace gdb
complete -A command command type which
complete -A export printenv
complete -A variable export local readonly unset
complete -A enabled builtin
complete -A alias alias unalias
complete -A function function
complete -A user su mail finger
complete -A helptopic help # currently same as builtins
complete -A shopt shopt
complete -A stopped -P '%' bg
complete -A job -P '%' fg jobs disown
complete -A directory mkdir rmdir
complete -f -X '!*.gz' gunzip zcat zmore
complete -f -X '!*.bz2' bunzip2
complete -f -X '!*.zip' unzip
complete -f -X '!*.ps' gs ghostview gv
complete -f -X '!*.pdf' xpdf
complete -f -X '!*.+(gif|jpg|jpeg|GIF|JPG|bmp)' xv gimp gqview
complete -A signal kill -P '%'
#other completions:
function _umount () {
local cur
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
COMPREPLY=( $( mount | cut -d' ' -f 3 | grep ^$cur) )
return 0
}
function _rmmod () {
local cur
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
COMPREPLY=( $( lsmod | cut -d' ' -f 1 | grep ^$cur) )
}
function _killall () { # ps -A cut program-names if they are too long.. :(
local cur
cur=${COMP_WORDS[COMP_CWORD]}
COMPREPLY=( $( ps -A | awk '{ print $4 }' | sort | uniq | grep ^$cur) )
}
complete -F _umount umount
complete -F _rmmod rmmod
complete -F _killall killall |
_________________ If you do something right once, someone will ask you to do it again. |
|
Back to top |
|
|
Sledgy n00b
Joined: 03 Apr 2003 Posts: 38
|
Posted: Thu Aug 07, 2003 8:48 am Post subject: |
|
|
written and/or collected over the years
Code: | Add to the path variable named by $1 the component $2. $3 must be
# "append" or "prepend" to indicate where the component is added.
addpath () {
eval value=\"\$$1\"
case "$value" in
*:$2:*|*:$2|$2:*|$2)
result="$value"
;;
"")
export $1
result="$2"
;;
*)
case "$3" in
p*)
result="$2:${value}"
;;
*)
result="${value}:$2"
;;
esac
esac
eval $1=$result
unset result value
}
# convenience routine which appends a string to a path.
append () {
addpath "$1" "$2" append
}
# convenience routine which prepends a string to a path.
prepend () {
addpath "$1" "$2" prepend
}
|
allows clean scripts like:
Code: |
...
#################################
#
# java
#
#################################
setenv JAVA_HOME /java/j2sdk
append PATH ${JAVA_HOME}/bin
setenv CLASSPATH .
append CLASSPATH $JAVA_HOME
append CLASSPATH /java/jdom/lib/xerces.jar
append CLASSPATH /java/jdom/build/jdom.jar
...
|
Code: | setenv () {
eval $1=$2
export $1
}
|
(guess where i came from )
Code: | # tar-copy
tcp () {
if [ $# != 2 ]
then
echo "usage: tcp [sourcefile|sourcedirectory] targetdirectory"
else
if [ ! -e $1 ]
then
echo "where's ${1}?"
else
if [ ! -d $2 ]
then
echo "$2 doesn't exist"
else
echo "/bin/tar -cvf - $1 | (cd $2; /bin/tar -xpf -)"
/bin/tar -cvf - $1 | (cd $2; /bin/tar -xpf -)
fi
fi
fi
}
|
Code: | # mkdir + cd
mkcd () {
if [ $# != 1 ]
then
echo "usage: mcd directory"
else
if [ ! -d $1 ]
then
if [ -e $1 ]
then
echo "$1 exists but isn't a directory"
else
mkdir -p $1
cd $1
fi
else
cd $1
fi
fi
}
|
|
|
Back to top |
|
|
deurk Apprentice
Joined: 11 Mar 2003 Posts: 190 Location: Earth 1.3
|
Posted: Fri Aug 08, 2003 8:59 am Post subject: |
|
|
Woaw... The Guezz-Who one is a bit complicated for me...
Not sure I understand how everything works... Not even the half actually!
|
|
Back to top |
|
|
ArsDangor Guru
Joined: 20 May 2003 Posts: 477
|
Posted: Wed Aug 13, 2003 9:33 pm Post subject: |
|
|
I've learned a lot from this thread
This is my particular version of Sledgy's mkcd. It's called xmd for a DOS utility that made the same.
It also supports a task I find very repetitive: moving some file to a directory that might not exist yet.
Code: | xmd () {
if (($# > 2)) || (($# < 1))
then
echo "Uso: xmd directorio_nuevo [fichero de destino]"
else
if [ ! -d $1 ]
then
mkdir $1
if (($# == 2)) && [ -e $2 ]
then
mv $2 $1
fi
cd $1
else
echo "El nuevo directorio ya existe o es un fichero regular."
fi
fi
} |
All the ifs avoid annoying error messages from mv, cd or mkdir. The messages are in Spanish. I hope the function is simple enough not no need them translated. |
|
Back to top |
|
|
semiSfear Guru
Joined: 08 Jul 2003 Posts: 302 Location: Adelaide, SA
|
|
Back to top |
|
|
dylix Apprentice
Joined: 20 Sep 2002 Posts: 261 Location: Atlanta
|
Posted: Mon Aug 18, 2003 9:16 am Post subject: |
|
|
this might of been posted, but its so great i will post it again if it has
easy way to logout some people may not know about..
control-d _________________
https://dylix.org/
|
|
Back to top |
|
|
viperlin Veteran
Joined: 15 Apr 2003 Posts: 1319 Location: UK
|
Posted: Mon Aug 18, 2003 10:26 am Post subject: |
|
|
control-s to lock up an xterm so you cannot use it........ not usefull but i keep accidnetally doing it on my new keyboard instead of control-d, just lettin u know..... |
|
Back to top |
|
|
kitano Apprentice
Joined: 19 Dec 2002 Posts: 228 Location: Munich, Germany, Europe, Earth
|
Posted: Mon Aug 18, 2003 10:41 am Post subject: |
|
|
not completely true about the control-s thingie.
yes: it locks up your xterm/eterm
no: its not a cheap screenlocker
problem: control-s is something like sleep. pressing control-w rewakens the console executing _all_ command typed in inbetween (i.d. while sleeping)
can be fatal...
don't know what its good for, anyway _________________ ->searched for a gentoo penguin ->alienated it with "find edges", "saturation", "photocopy" ->encoded quicktime from still ->played with aaxine ->screenshotted ->made it my avatar
only in case you were going to ask what it is... |
|
Back to top |
|
|
kitano Apprentice
Joined: 19 Dec 2002 Posts: 228 Location: Munich, Germany, Europe, Earth
|
Posted: Mon Aug 18, 2003 10:43 am Post subject: |
|
|
nobody ever using the control-r combination?
read alot about the history command and i thought ctrl-r goes hand in hand with it...
but now that i didn't really see it here, i thought maybe i should post it.
after pressing ctrl-r, try typing the first few letters of the command which should be in your history. voila, here we go. _________________ ->searched for a gentoo penguin ->alienated it with "find edges", "saturation", "photocopy" ->encoded quicktime from still ->played with aaxine ->screenshotted ->made it my avatar
only in case you were going to ask what it is... |
|
Back to top |
|
|
neenee Veteran
Joined: 20 Jul 2003 Posts: 1786
|
Posted: Sun Aug 24, 2003 12:18 am Post subject: |
|
|
actually this was posted thrice already in this thread:
once one page two by sa
another time on page two by nephros
and yet another time, but this time on page 3 by jleidigh
lol.
but i won't blame anyone, since i love using it myself. |
|
Back to top |
|
|
magrathea n00b
Joined: 26 Jul 2003 Posts: 26 Location: amsterdam
|
Posted: Mon Aug 25, 2003 3:24 am Post subject: just wanted to say... |
|
|
gentoo forums keeps me up all nights with all the info everywhere... this thread is REALLY filled with good tips and tricks.
Thank you guys for making it easy to learn more about gentoo. _________________ magrathea home
mmm...... specs;
mama; AMD XP 2200+,384mb DDR,SCSI IBMx2,Geforce MX440, PCTV, MX700
4ngel;laptop 333mhz, dvd, 256mb RAM, 10gb HD 5400 rpm, ati rage lt pro 4mb
-------------------- |
|
Back to top |
|
|
Ari Rahikkala Guru
Joined: 02 Oct 2002 Posts: 370 Location: Finland
|
Posted: Mon Aug 25, 2003 4:27 am Post subject: |
|
|
kitano wrote: |
problem: control-s is something like sleep. pressing control-w rewakens the console executing _all_ command typed in inbetween (i.d. while sleeping) |
At least on my system, it's ctrl-q, not ctrl-w... and I usually use scroll lock to cause what at least seems to be the same effect anyway. _________________ <laurentius> gentoo linux?
<ari> Yesh.
<laurentius> they look horny |
|
Back to top |
|
|
Curious Bodhisattva
Joined: 13 May 2002 Posts: 395 Location: Sydney, Australia
|
Posted: Mon Aug 25, 2003 4:32 am Post subject: |
|
|
Ari Rahikkala wrote: | ctrl-q |
I owe you a coke. I keep forgetting what the turn-off-scroll-lock command is.
-- Curious _________________ Are you down with the Hawk? |
|
Back to top |
|
|
byns n00b
Joined: 01 May 2003 Posts: 29
|
Posted: Wed Aug 27, 2003 10:00 pm Post subject: Color, Pathes and problems |
|
|
I changes ls to ls --color myself, but could anyone explain to me, why it somtimes works, and sometimes doesn't work (for example it's different when I "su") and sometimes the path variable is correct, buth sometimes it is not especially "/usr/local/sbin/" is oftentimes not found. Is there a list, which programs execute which files?
And the last thing that is annoying is that the keyboard rate is set to slow even if I append kbdrate to the startup programs, I have to run it manually everytime so I thought about putting it in .bashrc where it doesn't belong _________________ -----------------------------------------
It's easier to get forgiveness for being wrong than forgiveness for being
right. |
|
Back to top |
|
|
carambola5 Apprentice
Joined: 10 Jul 2002 Posts: 214
|
Posted: Wed Aug 27, 2003 10:50 pm Post subject: Re: Color, Pathes and problems |
|
|
byns wrote: | I changes ls to ls --color myself, but could anyone explain to me, why it somtimes works, and sometimes doesn't work (for example it's different when I "su") and sometimes the path variable is correct, buth sometimes it is not especially "/usr/local/sbin/" is oftentimes not found. Is there a list, which programs execute which files?
And the last thing that is annoying is that the keyboard rate is set to slow even if I append kbdrate to the startup programs, I have to run it manually everytime so I thought about putting it in .bashrc where it doesn't belong |
You could append: Code: | source /etc/profile | to your ~/.bashrc file |
|
Back to top |
|
|
meowsqueak Veteran
Joined: 26 Aug 2003 Posts: 1549 Location: New Zealand
|
Posted: Thu Aug 28, 2003 4:55 am Post subject: |
|
|
balk wrote: | How often I press '/' in any other program when trying to search for a word! Should be implemented in every browser too. |
Yes, I find this very handy in Mozilla. I forget when it was introduced, but it makes searching for keywords very easy. |
|
Back to top |
|
|
meowsqueak Veteran
Joined: 26 Aug 2003 Posts: 1549 Location: New Zealand
|
Posted: Thu Aug 28, 2003 4:58 am Post subject: |
|
|
Brandy wrote: | hmm... bad spelling. No problem:
Code: | ^sr^ser
useradd -m -c "Brandy Westcott" brandy -g users -G wheel,portage -s /bin/bash |
^string1^string2 is really just the same as !!:s/string1/string2 |
THAT is a mighty useful trick. Thanks! Got any more of those slightly obscure but very handy techniques? |
|
Back to top |
|
|
meowsqueak Veteran
Joined: 26 Aug 2003 Posts: 1549 Location: New Zealand
|
Posted: Thu Aug 28, 2003 5:22 am Post subject: |
|
|
kitano wrote: | not completely true about the control-s thingie.
yes: it locks up your xterm/eterm
no: its not a cheap screenlocker
problem: control-s is something like sleep. pressing control-w rewakens the console executing _all_ command typed in inbetween (i.d. while sleeping)
can be fatal...
don't know what its good for, anyway |
Ctrl-S is the XOFF command. It disables flow control to the TTY which effectively means the controlling terminal will stop accepting output from the child process(es). It will still accept input however, you just won't see it echoed on the terminal. Any child process (or thread) that tries to write normally to the terminal will block.
Ctrl-Q is the XON command - it reverses XOFF and resumes normal behaviour.
Ctrl-S is extremely useful once you realise what it does. For example, you're downloading a file with wget and you want to pause it. Hit ctrl-s to pause, ctrl-q to resume. As long as wget (or any other process) is constantly writing to the terminal, it will block.
Note that XOFF is not actually pausing the process, it is merely blocking stdout (the internals are a bit more complicated, but I think that's enough to get across the gist of this feature). |
|
Back to top |
|
|
|