Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
show me your aliases
View unanswered posts
View posts from last 24 hours

Goto page 1, 2, 3  Next  
Reply to topic    Gentoo Forums Forum Index Gentoo Chat
View previous topic :: View next topic  
Author Message
neenee
Veteran
Veteran


Joined: 20 Jul 2003
Posts: 1786

PostPosted: Wed Jan 28, 2004 12:52 pm    Post subject: show me your aliases Reply with quote

apologies if this is a duplicate - i did search the forums
before i posted.

since i was pondering on the possible uses of aliases,
i thought a thread on this, where people share their
aliases, would be a useful thing.

to start this off, here are mine:

Code:
alias rm='rm -i'
alias mv='mv -i'
alias cp='cp -i'
alias ls='ls --color=auto'
alias lx='ls --color=auto -Fs'
alias lh='ls --color=auto -Fsh'
alias free='freecolor -m'
alias root='sudo /bin/bash --login'
alias blank='echo < /dev/null >'
alias grep='grep --colour=auto'
Back to top
View user's profile Send private message
Oyarsa
n00b
n00b


Joined: 01 Jul 2002
Posts: 73
Location: Mars

PostPosted: Wed Jan 28, 2004 3:21 pm    Post subject: Reply with quote

Is this the kind of stuff you mean?
Quote:
alias h=history
alias up='cd ..'
alias del='rm -i'
alias la='ls -a'
alias lst='ls -l'
alias dir='pwd; ls; ls | wc -w' # VAX style listing

# show size of subdirectories in K
alias csize='du -k | sort -r -n | more'

# a sort of recursive grep
alias rgrep='find . -name "*" | xargs grep '

# For old time Adventure fans
alias xyzzy='echo Nothing Happens'
alias plugh="echo That Doesn\'t Work Here"

_________________
Dew knot trussed yore spell chequer two fined awl ewer miss steaks.
Back to top
View user's profile Send private message
Aurora
l33t
l33t


Joined: 26 Sep 2003
Posts: 658
Location: Classified

PostPosted: Wed Jan 28, 2004 3:25 pm    Post subject: Reply with quote

This should be a helpful thread in terms of getting ideas for my own alias file. :)

Out of curiosity (and I did man ls), why do you have lx having only the -Fs arguments, and lh having -Fsh

i.e., what good is it to only have -Fs as opposed to -Fsh?

Great thread, btw...
_________________
"My downfall raises me to infinite heights." -Napoleon Bonaparte
Back to top
View user's profile Send private message
mlsfit138
Guru
Guru


Joined: 20 Sep 2003
Posts: 406
Location: Washington

PostPosted: Wed Jan 28, 2004 4:16 pm    Post subject: Reply with quote

Yeah, I think this could be an interesting thread. Maybe it would be better placed in Tips & Tricks though?
_________________
"Everytime you justify
another good in you dies"

-Converge, The Saddest Day, Petitioning the Empty Sky
Back to top
View user's profile Send private message
asimon
l33t
l33t


Joined: 27 Jun 2002
Posts: 979
Location: Germany, Old Europe

PostPosted: Wed Jan 28, 2004 4:26 pm    Post subject: Reply with quote

I very much like the following aliases which I haven't seen here yet:
Code:
alias ..='cd ..'
alias ...='cd ../..'
which emacs &>/dev/null && alias e='emacs'
Back to top
View user's profile Send private message
bigcat99
n00b
n00b


Joined: 06 Jan 2004
Posts: 45
Location: Boston

PostPosted: Wed Jan 28, 2004 4:29 pm    Post subject: Reply with quote

where to i define aliases?

Last edited by bigcat99 on Wed Jan 28, 2004 4:44 pm; edited 1 time in total
Back to top
View user's profile Send private message
ronmon
Veteran
Veteran


Joined: 15 Apr 2002
Posts: 1043
Location: Key West, FL

PostPosted: Wed Jan 28, 2004 4:32 pm    Post subject: Reply with quote

Being basically lazy :) , I'm a fan of aliases. Arguably, there is some psychological influence in my choice of spam filter related aliases. From my user .bashrc:
Code:

alias bs='bogolearn.sh'
alias la='ls -a'
alias ll='ls -al'
alias lr='ls -LR'
alias ls='ls --color'
alias mx2='mogrify -resize 200%x200%'
alias mx15='mogrify -resize 150%x150%'
alias mx17='mogrify -resize 175%x175%'
alias tug='tar zxvf'
alias tub='tar jxvf'
alias tcg='tar czf'
alias tcb='tar cjf'
alias mf='mailfilter'
alias ntn='nano ~/depot/hardware/track_nos'
alias g='wget'

And the ones from root that don't overlap:
Code:

alias fnc='find /etc -iname '._cfg????*''
alias bk='make -j4 bzImage && make -j4 modules && make modules_install'

The entire files (and a few others) are listed here.

Oyarsa, I like your 'up' alias. I'll be adding that one to my list.
Back to top
View user's profile Send private message
mlsfit138
Guru
Guru


Joined: 20 Sep 2003
Posts: 406
Location: Washington

PostPosted: Wed Jan 28, 2004 4:44 pm    Post subject: Reply with quote

bigcat99 wrote:
where to i define aliases?

you define aliases in ~/.bashrc. There are already a few aliases in there by default, so you can just add these to the list
_________________
"Everytime you justify
another good in you dies"

-Converge, The Saddest Day, Petitioning the Empty Sky
Back to top
View user's profile Send private message
puddleglum
n00b
n00b


Joined: 04 Jul 2002
Posts: 63
Location: Albuquerque

PostPosted: Wed Jan 28, 2004 5:01 pm    Post subject: Reply with quote

# list only directories
Code:
lsd lsd='ls -F | ls -d */'

# list only source code (c, c++, Perl in my case)
Code:
lsp='ls *.c *.h *.cc *.pl *.pm'

functions used as aliases

# decimal to hex
Code:
function d2h { echo 16o $1 p | dc }

# hex to decimal
Code:
function h2d { echo $1 | tr '[a-f]' '[A-F]' | xargs -i echo 16i {} p | dc }

# negative to hex
Code:
function n2h { echo 16o 0 0 $1 sa1 '[16*dla>y]sy' lyx '16*la' -p | dc }

# hex to negative
Code:
function h2n { echo $1 | tr '[a-f]' '[A-F]' | xargs -i echo 16i {} dsa1 '[10*dla>y]sy' lyx -p | dc }

_________________
Disregard everything below the line.
Back to top
View user's profile Send private message
asimon
l33t
l33t


Joined: 27 Jun 2002
Posts: 979
Location: Germany, Old Europe

PostPosted: Wed Jan 28, 2004 5:46 pm    Post subject: Reply with quote

Here is an other one for fast switching between source dir and build dir. kdecvs is the base under which the source dirs reside (i.e. kdecvs/kdebase) and kdecvs/build contains the build dirs named after the source dirs (i.e. kdecvs/build/kdebase). I have this alias since ages in my bashrc, it's from an KDE developer whose name I have forgotten (shame on me!):

Code:
alias cb='cd `pwd | sed -e 's,kdecvs,kdecvs/build,'`'
alias cs='cd `pwd | sed -e 's,kdecvs/build,kdecvs,'`'
Back to top
View user's profile Send private message
squiddy
n00b
n00b


Joined: 31 Mar 2003
Posts: 39
Location: Colorado, USA

PostPosted: Wed Jan 28, 2004 5:48 pm    Post subject: Reply with quote

Here are a few I commonly use (tcsh syntax):

Code:
alias forest        'ps -e --forest'
alias from          'grep '^From:' $MAIL'
# super-lp for duplex, 2 per side printing, with multiple files
alias slp           'a2ps -2rjA -s2 --medium=Letter'
alias rmtmp         'rm *~ #*#'
alias qfind         'find . -name'
# get info about latest kernel releases
alias kernelinfo    'finger @kernel.org'
alias mkthumb       'convert -resize 5%'


Last edited by squiddy on Wed Jan 28, 2004 6:29 pm; edited 1 time in total
Back to top
View user's profile Send private message
asimon
l33t
l33t


Joined: 27 Jun 2002
Posts: 979
Location: Germany, Old Europe

PostPosted: Wed Jan 28, 2004 5:52 pm    Post subject: Reply with quote

puddleglum wrote:

Code:
function d2h { echo 16o $1 p | dc }
function h2d { echo $1 | tr '[a-f]' '[A-F]' | xargs -i echo 16i {} p | dc }
function n2h { echo 16o 0 0 $1 sa1 '[16*dla>y]sy' lyx '16*la' -p | dc }
function h2n { echo $1 | tr '[a-f]' '[A-F]' | xargs -i echo 16i {} dsa1 '[10*dla>y]sy' lyx -p | dc }


This is no bash syntax, isn't it?
The manual says [ function ] name () { list; }
Back to top
View user's profile Send private message
PrakashP
Veteran
Veteran


Joined: 27 Oct 2003
Posts: 1249
Location: C.C.A.A., Germania

PostPosted: Wed Jan 28, 2004 5:59 pm    Post subject: Reply with quote

Nice thread, already added some.

Here are some of mine:

Code:

alias d="ls --color -h"
alias ls="ls --color=auto -h"
alias ll="ls --color -lh"
alias na="nano -w"
alias epw="emerge -uDpv world"
alias ew="emerge -uD world"
alias es="emerge sync"
alias kinst="mount /boot && cp arch/i386/boot/bzImage /boot/bzImage && umount /boot"
alias cdk="cd /usr/src/linux"
Back to top
View user's profile Send private message
Birnenpfluecker
Guru
Guru


Joined: 01 Sep 2003
Posts: 315
Location: Lage, Germany

PostPosted: Wed Jan 28, 2004 6:01 pm    Post subject: Reply with quote

Here are mine:
Quote:

alias d="ls --color"
10 alias ls="ls --color=auto"
11 alias ll="ls --color -l"
12 alias md='mkdir'
13 alias rd='rmdir'
14 alias h='history'
15 alias es='emerge -s'
16 alias ep='emerge -p'
17 alias merge='ACCEPT_KEYWORDS="~x86" emerge'
18 alias uw="emerge -UD world"
19 alias up="emerge -pUD world"
20 alias mp="mplayer"
Back to top
View user's profile Send private message
sigix
Apprentice
Apprentice


Joined: 25 Jul 2003
Posts: 192

PostPosted: Wed Jan 28, 2004 7:11 pm    Post subject: Reply with quote

Code:

alias rm='rm -i'
alias cp='cp -i'
alias ls='ls --color=auto'
alias mv='mv -i'
alias c='cd /mnt/c'
alias d='cd /mnt/d'
alias e='cd /mnt/e'
alias mf='mount /dev/fd0 /mnt/floppy'
alias uf='umount /mnt/floppy'
alias gf='cd /mnt/floppy'
alias www='ping 192.168.0.1'
alias gens='cd /var/www/html/gen'
alias connect='ssh -l kb 192.168.0.111'
alias web='cd /var/www/html'
alias off='init 0'
alias sweb='service httpd start;service mysqld start'
alias eweb='service httpd stop;service mysqld stop'
Back to top
View user's profile Send private message
m@o
Apprentice
Apprentice


Joined: 25 Nov 2003
Posts: 184
Location: /eu/at/grz

PostPosted: Wed Jan 28, 2004 7:36 pm    Post subject: Reply with quote

Code:
alias d="ls --color"
alias ls="ls --color=auto"
alias ll="ls --color -l"
alias lh="ls --color -lh"
alias mdvd="mount /mnt/cdrom1"
alias mcd="mount /mnt/cdrom2"
alias fbird="MozillaFirebird"
alias tbird="MozillaThunderbird"
Back to top
View user's profile Send private message
puddleglum
n00b
n00b


Joined: 04 Jul 2002
Posts: 63
Location: Albuquerque

PostPosted: Wed Jan 28, 2004 7:55 pm    Post subject: Reply with quote

Quote:
asimon wrote:
Quote:
puddleglum wrote:

Code:
function d2h { echo 16o $1 p | dc }
function h2d { echo $1 | tr '[a-f]' '[A-F]' | xargs -i echo 16i {} p | dc }
function n2h { echo 16o 0 0 $1 sa1 '[16*dla>y]sy' lyx '16*la' -p | dc }
function h2n { echo $1 | tr '[a-f]' '[A-F]' | xargs -i echo 16i {} dsa1 '[10*dla>y]sy' lyx -p | dc }




This is no bash syntax, isn't it?
The manual says [ function ] name () { list; }

You are probably right. These are bourne shell scripts which should
work in bash. They did for me here with bash-2.05a. I did have to
convert them, though since we use the csh shell at work. I'll check
when I get home what my linux box has in it.

It seams like I did get sloppy, though. My first two examples are
incorrect. They should be:
Code:
alias lsd='ls -F | ls -d */'
alias lsp='ls *.c *.h *.cc *.pl *.pm'

_________________
Disregard everything below the line.
Back to top
View user's profile Send private message
elzbal
Guru
Guru


Joined: 31 Aug 2002
Posts: 364
Location: Seattle, WA, USA

PostPosted: Wed Jan 28, 2004 7:56 pm    Post subject: Reply with quote

Here's mine:
Code:
 


As you can see, I like typing. :)

On a personal note, I *hate* the "rm -i", "mv -i", etc aliases. As an old-time Unix user, I don't like the silly "are you sure" messages. If I tell you to rm -r /, then I want you to do it. :)
Back to top
View user's profile Send private message
joehni
Apprentice
Apprentice


Joined: 27 Jul 2003
Posts: 175

PostPosted: Wed Jan 28, 2004 8:59 pm    Post subject: Reply with quote

elzbal wrote:
On a personal note, I *hate* the "rm -i", "mv -i", etc aliases. As an old-time Unix user, I don't like the silly "are you sure" messages. If I tell you to rm -r /, then I want you to do it.


Well, you can secure yourself selectivly. I have at least saved my root and home:

Code:
touch -- /-i ~/-i


Well, here some lines from my .bashrc, comes in handy when developing Java:

Code:

function ..()
{
    local i;
    local p;

    if [ $# == 0 ]; then
        cd ..;
    else
        i=$1
        p="."
        while [ $i -gt 0 ]; do
            p=$p/..
            i=$((i-1))
        done
        cd $p
    fi
}
Back to top
View user's profile Send private message
ecatmur
Advocate
Advocate


Joined: 20 Oct 2003
Posts: 3595
Location: Edinburgh

PostPosted: Wed Jan 28, 2004 9:04 pm    Post subject: Reply with quote

mm, fun:
Code:
alias anagrams='/bin/gawk '\''BEGIN { s=ARGV[1]; ARGV[1]=""; for (i=2; i<ARGC; ++i) { s=(s ARGV[i]); ARGV[i]="" }; target="^" tolower(sort(s)) "$" }; function sort(s) {ret=""; split(s, a, ""); n=asort(a); for (i=1; i<=n; ++i) if (a[i] ~ /[[:alnum:]]/) ret = (ret a[i]); return ret }; tolower(sort($0)) ~ target { print };'\'''
alias aspell='/usr/bin/aspell -d en.multi'
alias d='ls --color'
alias ginfo='gviminfo'
alias gman='/usr/bin/man -P "col -bp | iconv -c | gvim -R -c '\''set ft=man nomod nolist'\'' -"'
alias gview='gvim -R'
alias info='viminfo'
alias ll='ls --color -l'
alias ls='ls -F --color=auto'
alias man='/usr/bin/man -P "col -bp | iconv -c | view -c '\''set ft=man nomod nolist'\'' -"'
function viminfo () { vim -c "Info $1" -c "bdelete 1"; }
function gviminfo () { gvim -c "Info $1" -c "bdelete 1"; }
In case you hadn't guessed... I love vim!
Back to top
View user's profile Send private message
puddleglum
n00b
n00b


Joined: 04 Jul 2002
Posts: 63
Location: Albuquerque

PostPosted: Thu Jan 29, 2004 3:43 am    Post subject: Reply with quote

Quote:
This is no bash syntax, isn't it?


OK. Here are the versions of decimal/hex conversion from my .bashrc file. This one
accepts any number of entries and gives you a result for each one. One per line.

# Convert decimal to hex
Code:
d2h()
{
    for param
    do
        echo 16o $param p | dc
    done
}

# Convert hex to decimal
Code:
h2d()
{
    for param
    do
        echo $param | tr '[a-f]' '[A-F]' | xargs -i echo 16i {} p | dc
    done
}

# Convert negative decimal to hex
Code:
n2h()
{
    for param
    do
        echo 16o 0 0 $param sa1 '[16*dla>y]sy' lyx '16*la' -p | dc
    done
}

# Convert hex to negative decimal
Code:
h2n()
{
    for param
    do
        echo $param | tr '[a-f]' '[A-F]' | \
        xargs -i echo 16i {} dsa1 '[10*dla>y]sy' lyx -p | dc
    done
}

_________________
Disregard everything below the line.
Back to top
View user's profile Send private message
mlsfit138
Guru
Guru


Joined: 20 Sep 2003
Posts: 406
Location: Washington

PostPosted: Thu Jan 29, 2004 6:12 pm    Post subject: Reply with quote

joehni wrote:
elzbal wrote:
On a personal note, I *hate* the "rm -i", "mv -i", etc aliases. As an old-time Unix user, I don't like the silly "are you sure" messages. If I tell you to rm -r /, then I want you to do it.


Well, you can secure yourself selectivly. I have at least saved my root and home:

Code:
touch -- /-i ~/-i



what does that do?
_________________
"Everytime you justify
another good in you dies"

-Converge, The Saddest Day, Petitioning the Empty Sky
Back to top
View user's profile Send private message
ragnwald
n00b
n00b


Joined: 20 Dec 2002
Posts: 43
Location: Stockholm

PostPosted: Thu Jan 29, 2004 7:20 pm    Post subject: Reply with quote

The only alias i've got is

Code:


alias pico='nano -w'



:)
Back to top
View user's profile Send private message
ebrostig
Bodhisattva
Bodhisattva


Joined: 20 Jul 2002
Posts: 3152
Location: Orlando, Fl

PostPosted: Thu Jan 29, 2004 7:27 pm    Post subject: Reply with quote

First off all, this thread needs to be moved. This is not a question of support. Gentoo Chat would be the correct forum.

When that is said, there was a thread last year about a similar topic, quick console tricks that covers the same topic :)

Erik
_________________
'Yes, Firefox is indeed greater than women. Can women block pops up for you? No. Can Firefox show you naked women? Yes.'
Back to top
View user's profile Send private message
dh3rm3
Tux's lil' helper
Tux's lil' helper


Joined: 26 Aug 2003
Posts: 101

PostPosted: Thu Jan 29, 2004 7:31 pm    Post subject: Reply with quote

here are mine
Code:

alias siteput="sitecopy -uo"
alias siteget="sitecopy -so"
alias d="ls -alh --color"
alias ls="ls --color=auto"
alias ll="ls --color -l"
alias c='clear'
alias df='pydf'
alias make='make $* | grcat conf.gcc'
alias mad='madplay --tty-control -v -r *.mp3'
alias ogg='ogg123 -v *.ogg'
alias cd..='cd ..'
alias merge='ACCEPT_KEYWORDS=~x86 emerge'
alias grep="grep --color=auto"
alias sfv='cksfv -f *.sfv -i'
alias csfv='cksfv * > files.sfv'
alias ipupdate='ez-ipupdate -c ~/bin/ez.conf'
alias materm='multi-aterm'
alias mplayerdvd='mplayer dvd://1 -dvd-device /dev/hdb'
alias mplayervcd='mplayer vcd://1'
alias camrecord='transcode -i /dev/video0 -f 7 -y xvid -g 352x288 -z -x v4l -o file.avi'
alias mc="mc --colors directory=,green,default:executable=,default:link=,default:device=,default:special=,default:normal=,default:selected=red,default:marked=,default:markselect=,blue:core=,default"

_________________
dh3rm3's place
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo Chat All times are GMT
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum