Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Discussion & Documentation Documentation, Tips & Tricks
  • Search

Console / shell tips & tricks

Unofficial documentation for various parts of Gentoo Linux. Note: This is not a support forum.
Post Reply
Advanced search
376 posts
  • Page 3 of 16
    • Jump to page:
  • Previous
  • 1
  • 2
  • 3
  • 4
  • 5
  • …
  • 16
  • Next
Author
Message
Caffeine
Guru
Guru
User avatar
Posts: 401
Joined: Wed Jul 17, 2002 7:21 pm
Location: Melbourne, Australia

  • Quote

Post by Caffeine » Wed Apr 09, 2003 1:18 pm

NiklasH wrote:
wbsoft wrote:

Code: Select all

nd() { test -d "$1" || mkdir "$1" && cd "$1" ; }
alias o="less -iMS"
nX()
{
  for i in `seq 0 9`
  do
    if [ ! -e "/tmp/.X${i}-lock" ] ; then
      XFree86 ":$i" -query localhost &
      break
    fi
  done
}
the last one, nX, starts a new X login on a new display. (You should add localhost to /etc/X11/xdm/Xaccess)
I can't get this to work...
The nX function starts a new X window, but I get no login prompt (gdm, in my case).
Am I doing something wrong? I tried to add just 'localhost' in Xaccess. Should I add something more? I also tried to add CHOOSER localhost, but that didn't work either.
Maybe I'm just stupid... :? But I would really like this to work, so any help is very appreciated!
I'm having the same problem. What's the correct entry in Xaccess?
Top
Jarjar
Apprentice
Apprentice
Posts: 265
Joined: Sun Jul 21, 2002 11:33 am
Location: Sweden

  • Quote

Post by Jarjar » Wed Apr 09, 2003 1:36 pm

For killing wine(x) when it ... fucks up.

Code: Select all

/usr/bin/killall-that-contains: (can't think of a name; help me!)
#!/bin/sh
if [ $1 == "-9" ]
then
        for i in $(ps aux|grep $2|grep -v grep|cut -c10-15)
        do
                kill -9 $i
        done
else
        for i in $(ps aux|grep $1|grep -v grep|cut -c10-15)
        do
                kill $i
        done
fi
Warning: Bash scripting newbie. :D
The only alias I use, except for ll/ls (--color=yes --show-control-chars) is
alias startx='startx -- -dpi 100'

Edit: Oopsie! I reversed the if and else; it kill -9'ed if you told it not to and the other way around...fixed.
[Server etc. | C2D 2.2 @ 3.0 GHz / 4 GB RAM / 3x1 TB + 1x2 TB SATA disks + 1.5 TB ext. | Gentoo]
[Laptop | Macbook Pro 15" / Core i7 (Sandy) Quad 2.2 GHz / 16 GB RAM / Samsung 840 250 GB SSD + 1 TB + 2 TB HDD / 6750M 1 GB / OS X, Win 7]
Top
guero61
l33t
l33t
Posts: 811
Joined: Mon Oct 14, 2002 2:22 am
Location: Behind you

  • Quote

Post by guero61 » Thu Apr 10, 2003 2:48 am

My few toys that are useful outside of the private networks I use --

Code: Select all

alias psg="ps -awef |grep"
alias psu="ps -u"
alias ct="tar -cvzf"
alias xt="tar -xvpf"
alias xzt="tar -xvzpf"
alias xjt="tar -xvjpf"
alias ll="ls -lF --color"
alias lla="ls -laF --color"
alias r="fc -s"

set -o vi

Those, and I love using "cd -", it saves so much typing!
Top
Jimbow
Guru
Guru
User avatar
Posts: 597
Joined: Tue Feb 18, 2003 11:41 pm
Location: Silver City, NM

  • Quote

Post by Jimbow » Thu Apr 10, 2003 3:22 am

Here are some (hopefully) non-dups:

Code: Select all

alias snice="sudo nice -n 5"
alias smerge="snice emerge"
alias kern="snice make dep && snice make clean bzImage modules modules_install"

loc () {
    locate -i $@ | grep -v ^/usr/portage | grep -v ^/var
}

burn () {
    sudo cdrecord -v speed=4 dev=0,0,0 -data $1
}

start () {
    nohup $@ &
}

#-------- long ls listings /w pager --------
ll  () { ls -lF   $@ | more;}
lla () { ls -lAF  $@ | more;}
llt () { ls -lAFt $@ | more;}

#-------- clean: removes emacs *~ and #*# files --------
clean () {
    if [[ "$#" == "0" ]] ; then set '.'; fi;
    for dir in $@; do
        if [[ -d $dir ]]; then
            rm -f ${dir}/*~ $dir/#*#;
        else
            echo "clean: missing directory '${dir}'"
        fi
    done;
}

#-------- li: ls -F if directory, less if file --------
li (){
    if [[ -d $1 ]] ; then
         ls -F $1;
    elif [[ -f $1 ]] ; then
        less $1;
    else
        ls -F $1
    fi
}
After Perl everything else is just assembly language.
Top
Yarrick
Bodhisattva
Bodhisattva
User avatar
Posts: 304
Joined: Wed Jun 05, 2002 11:36 am
Location: Malmö, Sweden
Contact:
Contact Yarrick
Website

  • Quote

Post by Yarrick » Thu Apr 10, 2003 3:42 am

Code: Select all

ls -h
can also be useful. It displays file sizes as human-readable, using giga/mega/kilo/bytes for size instead of just bytes.

somtimes i miss an alias to mkdir && cd a new folder... havent written one yet though.
Top
morgap98
n00b
n00b
Posts: 25
Joined: Sat Nov 02, 2002 6:53 pm

  • Quote

Post by morgap98 » Thu May 22, 2003 9:08 pm

i can't get my laptop to parse the .bashrc file. The only time that i can make changes to my bash prompts are through the /etc/profile script.

NOTE: if i type "bash" [enter] then it will parse my .bashrc,

how can i get this to automatically happen, i don't think i should be modifiying my /etc/profile script like this!!!

</P33T>
Top
BackSeat
Apprentice
Apprentice
Posts: 242
Joined: Fri Apr 12, 2002 4:51 pm
Location: Reading, UK

  • Quote

Post by BackSeat » Thu May 22, 2003 9:56 pm

For those unfamiliar with ^R reverse search in bash, here's an extra tip. After ^R type a few characters and the command line that contained those characters will be shown. Type ^R again at that point, and the search will continue back through the history.

For those aliasing ls='ls --color' you might prefer to use

Code: Select all

lss='ls --color=auto'
That way the coloUr escape sequences are only sent if the output is connected to a terminal (so sending the output of ls to a file doesn't result in embedded escape sequences.

In a similar way, I alias grep:

Code: Select all

alias grep --color-auto
which highlights the matching pattern in the output. Try it: you'll never want to be without it.

Finally (for now), if you think 'less' is just a way of paging through a file, read the man page. There is more flexibility in this program than a lot of people realise.

BS
Top
Redson
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 137
Joined: Tue Apr 15, 2003 10:23 pm
Contact:
Contact Redson
Website

FORTUNE RULES!!!!

  • Quote

Post by Redson » Thu May 22, 2003 11:07 pm

tactless wrote:Not really a "trick", but here's something I put in my bashrc:

Code: Select all

fortune
Great way to start the day :)[/code]
That is awesome! You inspired me to write my first pseudo bash script!!!!
It essentially picks a certain type of fortune depending on what day it is.
I put it in my bashrc:

Code: Select all

NUMBER_OF_FORTUNES=3
DATE=`eval date +%d`  #Produces only the date Number.

let "DATE=$DATE%$NUMBER_OF_FORTUNES"

case "$DATE" in
	[0]  ) fortune;; #Random fortune
	[1]  ) fortune /usr/share/fortune/starwars;;  #Quoute from Star Wars
	[2]  ) fortune /usr/share/fortune/homer;;  #Quote from Homer
esac
note that to do this you need to
emerge fortune-mod-homer
emerge fortune-mod-starwars

I would also recommend doing emerge -s fortune for a list of other cool fortune files.
Redson
http://watchred.com/
Top
Redson
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 137
Joined: Tue Apr 15, 2003 10:23 pm
Contact:
Contact Redson
Website

  • Quote

Post by Redson » Thu May 22, 2003 11:26 pm

morgap98 wrote:i can't get my laptop to parse the .bashrc file. The only time that i can make changes to my bash prompts are through the /etc/profile script.

NOTE: if i type "bash" [enter] then it will parse my .bashrc,

how can i get this to automatically happen, i don't think i should be modifiying my /etc/profile script like this!!!

</P33T>
Hello fellow N00B! I had this problem for a while, fortunately somebody finally told me you have to put

Code: Select all

[ -f ~/.bashrc ] && source ~/.bashrc
at the end of your .bash_profile so it reads your .bashrc

After doing that I think you have to do

Code: Select all

source .bash_profile
env-update
though I'm not sure about that. Then remember to restart your shell before the .bashrc takes effect
Redson
http://watchred.com/
Top
ebrostig
Bodhisattva
Bodhisattva
User avatar
Posts: 3152
Joined: Sat Jul 20, 2002 12:44 am
Location: Orlando, Fl

  • Quote

Post by ebrostig » Fri May 23, 2003 9:52 pm

Since we are all sharing and beeing very happy in this thread, I thought I was going to add to the confusion 8)

Here is my .bash_profile

Code: Select all

alias ls="ls --color=auto"
alias l="ls -l "
alias lm="ls -l| more"
alias la="ls -a "
alias llm="ls -la | more"
alias ln="ls -lLt | more"
alias cdo="cd $ORACLE_HOME"
## LS_COLORS should be on one line, broken up here as not to mess up phpBB too much :)
export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:
or=40;31;01:ex=00;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:
*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:
*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:
*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:
*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:';
alias grep="grep --color=auto"
shopt -s cdspell 
shopt -s cdable_vars
shopt -s checkhash 
shopt -s checkwinsize 
shopt -s mailwarn
shopt -s sourcepath
shopt -s no_empty_cmd_completion
shopt -s histappend histreedit
shopt -s extglob

shopt -s extglob	# necessary

complete -A hostname   rsh rcp telnet rlogin r 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'   gzip
complete -f -X '!*.ps'  gs ghostview gv
complete -f -X '!*.pdf' acroread
complete -f -X '!*.+(gif|jpg|jpeg|GIF|JPG|bmp)' xv gimp

function lowercase()  # move filenames to lowercase
{
    for file ; do
        filename=${file##*/}
        case "$filename" in
        */*) dirname==${file%/*} ;;
        *) dirname=.;;
        esac
        nf=$(echo $filename | tr A-Z a-z)
        newname="${dirname}/${nf}"
        if [ "$nf" != "$filename" ]; then
            mv "$file" "$newname"
            echo "lowercase: $file --> $newname"
        else
            echo "lowercase: $file not changed."
        fi
    done
}

function xtitle () 
{ 
    case $TERM in
	xterm* | dtterm | rxvt) 
	    echo -n -e "\033]0;$*\007" ;;
	*)  ;;
    esac
}

alias top='xtitle Processes on $HOST && top'
alias eworld='xtitle Emerge update world && emerge -u --deep world'
alias esync='xtitle Emerge rsync in progress && emerge rsync'
alias ncftp="xtitle ncFTP ; ncftp"
alias splus="xtitle SQL*Plus && sqlplus \"/ as sysdba\""
Erik
'Yes, Firefox is indeed greater than women. Can women block pops up for you? No. Can Firefox show you naked women? Yes.'
Top
balk
n00b
n00b
Posts: 62
Joined: Wed Apr 10, 2002 6:28 am
Location: Olanda
Contact:
Contact balk
Website

  • Quote

Post by balk » Fri May 23, 2003 11:38 pm

BackSeat wrote: Finally (for now), if you think 'less' is just a way of paging through a file, read the man page. There is more flexibility in this program than a lot of people realise.

BS
How often I press '/' in any other program when trying to search for a word! Should be implemented in every browser too. Less rules

I also curse on Windows when I try to alt-drag a window... nice features
Powered by Gentoo since 1.0_rc6
Top
grant.mcdorman
Apprentice
Apprentice
User avatar
Posts: 295
Joined: Wed Jan 29, 2003 2:01 am
Location: Toronto, ON, Canada

  • Quote

Post by grant.mcdorman » Sat May 24, 2003 12:15 am

NiklasH wrote:
wbsoft wrote:

Code: Select all

nX()
{
  for i in `seq 0 9`
  do
    if [ ! -e "/tmp/.X${i}-lock" ] ; then
      XFree86 ":$i" -query localhost &
      break
    fi
  done
}
the last one, nX, starts a new X login on a new display. (You should add localhost to /etc/X11/xdm/Xaccess)
I can't get this to work...
The nX function starts a new X window, but I get no login prompt (gdm, in my case).
Am I doing something wrong? I tried to add just 'localhost' in Xaccess. Should I add something more? I also tried to add CHOOSER localhost, but that didn't work either.
Maybe I'm just stupid... :? But I would really like this to work, so any help is very appreciated!
You need to do several things to get this to work.

First off, most display managers - especially kdm and gdm - are configured to ignore the -query (technically, it's XDMCP Query). You need to modify your window manager configuration file.

Display manager configuration

For kdm, it is in /usr/kde/3.1/share/config/kdm/kdmrc (the 3.1 will vary, of course, if you're running a release other than 3.1.x). In this file you will find:

Code: Select all

[Xdmcp]
# Whether KDM should listen to XDMCP requests. Default is true.
#Enable=false
# The UDP port KDM should listen on for XDMCP requests. Don't change the 177.
#Port=177
# File with the private keys of X-terminals. Required for XDM authentication.
# Default is ""
#KeyFile=/usr/kde/3.1/share/config/kdm/kdmkeys
# XDMCP access control file in the usual XDM-Xaccess format.
# Default is /usr/kde/3.1/share/config/kdm/Xaccess
# XXX i'm planning to absorb this file into kdmrc, but i'm not sure how to
# do this best.
Xaccess=/etc/X11/xdm/Xaccess
Make sure that the 'Enable=false' line is commented out, and the 'Xaccess=/etc/X11/xdm/Xaccess' is not commented out.

For gdm, please check this next section; I don't have gdm installed. However, according to the online references I can find, its configuration files are in /etc/gdm/Init/gdm.conf.

In this file, set it up as follows:

Code: Select all

[xdmcp]
Enable=1
I can't see a configuration for Xaccess, so presumably it uses the standard one.

Xaccess configuration
For most purposes, you just need to add the following line to /etc/X11/xdm/Xaccess:

Code: Select all

*
That's it (one asterix). You can make it more restrictive - the comments in the file should be adequate.

The nX function should now work.

Note, by the way, that there is a hole in this script: the presence of the /tmp/.Xn-lock is not a 100% guarantee that there's a server running, as this file might be left around if the server crashes.

Important: Firewalling
Be sure to have UDP port 177 closed on your firewall (if it's a sensible firewall, you have to explicitly open ports). The protocol used - XDMCP - is not that secure; in addition, if you use the Xaccess setup I've suggested your display manager will offer login windows to any X display - including random unknown ones on the Internet, if they can get at ports 177 and 6000 on your machine.
Top
nephros
Advocate
Advocate
User avatar
Posts: 2139
Joined: Fri Feb 07, 2003 2:46 am
Location: Graz, Austria (Europe - no kangaroos.)
Contact:
Contact nephros
Website

  • Quote

Post by nephros » Sat May 24, 2003 12:47 am

oh well, I might just add to that:

Code: Select all

alias dir="echo NO SUCH FILE OR DIRECTORY"
alias x="startx"
alias y="startx -- :1"
alias h="history"
alias ..="cd .."
alias cd..="cd .."
alias ...="cd ~"
alias nano="nano -w -T 4"
alias pico="nano -w -T 4"
and for root:

Code: Select all

alias unmerge="emerge unmerge"
alias semerge="screen emerge"
also note that you can prefix any command with a \ backslash to escape any aliases you have set. So \pico would launch a real pico instead of the nano alias...
Please put [SOLVED] in your topic if you are a moron.
Top
flickerfly
l33t
l33t
User avatar
Posts: 677
Joined: Fri Nov 08, 2002 4:30 pm
Location: Lanham, MD
Contact:
Contact flickerfly
Website

  • Quote

Post by flickerfly » Mon Jun 23, 2003 4:52 pm

nitro322 wrote:If you haven't noticed, the left and right windows keys on your keyboard will change you to the virtual terminal to the left and right of your current one. Nice.
How? I use fluxbox, you?
An Evil Genious' Guide to Sheeple and How To Avoid Becoming One | 0x4C9EF4A
Top
carambola5
Apprentice
Apprentice
User avatar
Posts: 214
Joined: Wed Jul 10, 2002 8:53 pm

  • Quote

Post by carambola5 » Mon Jun 23, 2003 8:17 pm

flickerfly wrote:
nitro322 wrote:If you haven't noticed, the left and right windows keys on your keyboard will change you to the virtual terminal to the left and right of your current one. Nice.
How? I use fluxbox, you?
For fluxbox, put this in your ~/.fluxbox/keys

Code: Select all

...
None Super_R :NextWorkspace
None Super_L :PrevWorkspace
...
Other fun keys mods are (assuming a multimedia keyboard):

Code: Select all

None XF86AudioPlay :ExecCommand xmms -t
None XF86AudioStop :ExecCommand xmms -s
None XF86AudioPrev :ExecCommand xmms -r
None XF86AudioNext :ExecCommand xmms -f
None XF86AudioLowerVolume :ExecCommand ~/bin/changevol d
None XF86AudioRaiseVolume :ExecCommand ~/bin/changevol u
None Print :ExecCommand ~/bin/screenie
where changevol is (I removed my muting code because I'm not sure if it works or not):

Code: Select all

#!/bin/bash
case $1 in
  "d") aumix -v-2
    ;;
  "u") aumix -v+2
    ;;
  "*") echo "Error"
esac
and screenie is:

Code: Select all

#!/bin/bash
PICPATH=$HOME/pictures/screenshots
if [ -f "$PICPATH/index.dat" ]; then echo 1 > $PICPATH/index.dat; fi
INDEX=`cat $PICPATH/index.dat`
import -window root $PICPATH/ss$INDEX.png
echo $(($INDEX + 1)) > $PICPATH/index.dat
(I think that'll work)
Top
Brandy
Bodhisattva
Bodhisattva
User avatar
Posts: 820
Joined: Sun Jun 08, 2003 1:08 pm
Location: New Zealand
Contact:
Contact Brandy
Website

  • Quote

Post by Brandy » Tue Jun 24, 2003 2:13 am

klieber wrote:I find it remarkable how many people don't use the history command. That, combined with the '!n' to re-issue a frequently-used command saves me tons and tons of time.
I agree. The history is sometimes very useful. You can also use it to fix spelling mistakes. :)
Let's say you want to add a new user:

Code: Select all

root@dante / # usradd -m -c "Brandy Westcott" brandy -g users -G wheel,portage -s /bin/bash
bash: usradd: command not found
hmm... bad spelling. No problem:

Code: Select all

^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

Ciao, Brandy
Faber est suae quisque fortunae.
Top
flickerfly
l33t
l33t
User avatar
Posts: 677
Joined: Fri Nov 08, 2002 4:30 pm
Location: Lanham, MD
Contact:
Contact flickerfly
Website

  • Quote

Post by flickerfly » Tue Jun 24, 2003 11:13 am

:idea:
carambola5 wrote:

Code: Select all

...
None Super_R :NextWorkspace
None Super_L :PrevWorkspace
...
Thanks, I don't have a multimedia keyboard here though. This will be nice to work with and I'll keep the multimedia stuff in memory for later. Thanks. :D
An Evil Genious' Guide to Sheeple and How To Avoid Becoming One | 0x4C9EF4A
Top
burmashave
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 82
Joined: Sun Dec 01, 2002 12:30 am
Contact:
Contact burmashave
Website

  • Quote

Post by burmashave » Tue Jun 24, 2003 8:54 pm

Wow, this is a superb thread! I've been using Linux for about 2 years now; however, I couldn't figure out how the power users got by without using some gui tools.

I've added "history" and "ls" commands to my bashrc, and also added fortune. Thanks for all the above suggestions.

I often find myself grepping about for files, and the only find command I can remember is "find --iname", so I wrote a script to handle my find operations:

Code: Select all

#! /bin/sh

# findfile -- a utility for finding files and directories

PATH=/usr/bin:/bin; export PATH

case $1 in 
	fn) find -iname $2 -print 2>/dev/null | more;;
    fs) find -size +$2k -print 2>/dev/null | more;;
    fm) find -cmin -$2 -print 2>/dev/null | more;;
    fd) find -iname $2 -type d -print 2>/dev/null | more;;
    fds) du -m * 2>/dev/null | sort -rn | head -$2;;
    ffs) PERCENTAGE=$2
		df -kl | grep -iv filesystem |  awk '{  print $6" "$5} '| while
		 	read LINE; do
  			PERC=`echo $LINE | cut -d"%" -f1 | awk '{  print $2 } '`
  			if [ $PERC -gt $PERCENTAGE ]
            	then
    			echo $LINE  
  			fi
         	done;;
	fbad) find . -type l -print 2>/dev/null | perl -nle '-e || print';;
    f) echo "findfile usage:"
       echo 
	   echo "fn <name>   find file <name>, case insensitive, errors suppressed, wildcards OK"
	   echo "fs <n>      find file greater than <n> kilobytes"
	   echo "fm <n>      find file modified within last n minutes"
	   echo "fd <name>   find directory <name>, case insensitive"
	   echo "fds <n>     find top <n> directories, based on diskspace usage (in megabytes)"
	   echo "ffs <n>     find file systems with usage greater than <n> percent"
	   echo "fbad        find bad symlinks"
	   echo "f           list findfile options"
	   echo
    esac
Then, I added the following aliases to bashrc:

Code: Select all

alias fn="findfile fn"
alias fs="findfile fs"	
alias fm="findfile fm"
alias fd="findfile fd"	
alias fds="findfile fds"
alias ffs="findfile ffs"
alias fbad="findfile fbad"
alias f="findfile f"
I put the findfile script in PATH, and now I can find files using a short command, or simply enter "f" to get a list of my find options:

Code: Select all

admin@cruise admin $ f
findfile usage:
 
fn <name>   find file <name>, case insensitive, errors suppressed, wildcards OK
fs <n>        find file greater than <n> kilobytes
fm <n>        find file modified within last n minutes
fd <name>  find directory <name>, case insensitive
fds <n>       find top <n> directories, based on diskspace usage (in megabytes)
ffs <n>       find file systems with usage greater than <n> percent
fbad            find bad symlinks
f                 list findfile options
As my title implies, I am a noob, so I would welcome any suggestions about my script.

Another thing I put in bashrc is an alias for my SSH connections:

Code: Select all

alias myserver="ssh -l admin xxx.xxx.xxx.xxx" # ssh to server
If you're using a key to authenticate, the command "myserver" will automatically initiate a session.
Top
thadk
Tux's lil' helper
Tux's lil' helper
Posts: 123
Joined: Fri Jun 21, 2002 3:09 am

  • Quote

Post by thadk » Mon Jul 28, 2003 7:17 am

Quick Question: How can you make any process run like a daemon. I.e. how can you run a process and then close the xterm window or ssh session and still have the process run in the background.

Also I have a tip: To search through files looking for specific content you can use:

Code: Select all

$ find . -exec grep -H [search-string] {} \;
OR
$ grep -R [search-string] *
Top
scap1784
Apprentice
Apprentice
User avatar
Posts: 225
Joined: Wed Dec 25, 2002 8:58 pm

  • Quote

Post by scap1784 » Mon Jul 28, 2003 9:27 am

Code: Select all

alias burn="cdrecord -vv speed=8 dev=0,0,0  -eject "
I also made a few 4 letter words aliases for fortune so when my friends get on here and get mad at the computer it talks back! kinda a stress reiliver i guess
Top
viperlin
Veteran
Veteran
Posts: 1319
Joined: Tue Apr 15, 2003 5:50 pm
Location: UK

  • Quote

Post by viperlin » Mon Jul 28, 2003 9:47 am

probably THE most usefull one ever:

Code: Select all

alias lsd="ls --color -d */"
try it, it's lovely and really usefull in those massive directory's.
Top
vers_iq
Apprentice
Apprentice
Posts: 264
Joined: Sat May 18, 2002 8:41 pm

  • Quote

Post by vers_iq » Mon Jul 28, 2003 3:47 pm

Empty_One wrote:dumb question, but how is the hisory better than just cycling through the list with the up arrow? Seems like you would have to read thru the list anyway
The function of history is not only to repeat a certain command, but it's most useful to keep track the chain of command line in certain console. expecially if u are in the middle of a task which requires u to enter command inputs in particular order.
"You know the world is going crazy when the best rapper is a white guy, the best golfer is a black guy, the Swiss hold the America's cup, France accusing the US of arrogance and Germany doesn't want to go to war."
Top
Bellrang QT
Tux's lil' helper
Tux's lil' helper
Posts: 81
Joined: Fri May 16, 2003 1:07 pm

  • Quote

Post by Bellrang QT » Mon Jul 28, 2003 4:32 pm

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?
I <3 forums.gentoo.org
Top
nico--
n00b
n00b
Posts: 59
Joined: Mon Jul 29, 2002 6:38 pm

  • Quote

Post by nico-- » Mon Jul 28, 2003 10:34 pm

thadk wrote:Quick Question: How can you make any process run like a daemon. I.e. how can you run a process and then close the xterm window or ssh session and still have the process run in the background.
Use &:

Code: Select all

mpg123 mylegallyrippedmp3file.mp3 &
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.
Quidquid latine dictum sit, altum viditur.
Top
thadk
Tux's lil' helper
Tux's lil' helper
Posts: 123
Joined: Fri Jun 21, 2002 3:09 am

  • Quote

Post by thadk » Mon Jul 28, 2003 10:51 pm

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`
Top
Post Reply

376 posts
  • Page 3 of 16
    • Jump to page:
  • Previous
  • 1
  • 2
  • 3
  • 4
  • 5
  • …
  • 16
  • Next

Return to “Documentation, Tips & Tricks”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic