# Your system aliases



## lMicROl (Feb 18, 2010)

What you use alias?  It will be possible interestingly not only me :stud
I use:

```
alias mic       make install clean
alias mrc       make reinstall clean
alias mdc       make deinstall clean
alias pfu       portsnap fetch update
alias wtf       man
```


----------



## Nicholas (Feb 18, 2010)

Haha, wtf. )

I don't use aliases.


----------



## Beastie (Feb 18, 2010)

"ls" default aliases and this one: *alias xinit xinit -- -nolisten tcp -tst*.


----------



## FRANCOIS (Feb 18, 2010)

lMicROl said:
			
		

> What you use alias?  It will be possible interestingly not only me :stud
> I use:
> 
> ```
> ...




```
alias pkg_radd 'pkg_add -r'
alias ping 'ping -c4'
alias cls 'clear'
alias FTP 'ftp -a'
alias del 'rm -r'
```


----------



## graudeejs (Feb 18, 2010)

```
alias ls='ls -FG'
alias scilab='scilab -nw -nb'
alias bc='bc -l'
alias sudo='sudo -E'
alias vi="vim"
alias less="less -c"
alias mathomatic="mathomatic -b"
```


----------



## edwtjo (Feb 18, 2010)

```
alias glg="git log"
alias gsh="git show"
alias gci="git commit -a"
alias gsv="git commit -a -m 'save'"
alias gco="git checkout"
alias gps="git push"
alias gpl="git pull"
alias gad="git add"
alias gst="git status"
alias gas="git stash"
alias gdf="git diff"
alias gbr="git branch"
alias gsup="git svn rebase"
alias gsci="git svn dcommit"

alias rs="screen -d -r"

alias yim="yi --as=vim"

alias pub="cd $REPOS_PATH/pub"
alias own="cd $REPOS_PATH/own"
```


----------



## ikbendeman (Mar 4, 2010)

*Useful aliases (and prompt)*

I thought I'd share some useful aliases from my ~/.cshrc... hopefully its useful for someone.


```
# unrelated but I also like my prompt to be user[currentdir]#
set prompt = "%n[%C05]# "


# go to given port directory, e.g. gotoport mplayer = cd /usr/ports/multimedia/mplayer
alias gotoport          'cd `whereis -sq \!*`'
# cat out the description file of the given port
alias portdescr             'cat `whereis -sq \!*`/pkg-descr'
# list outdated ports
alias oldports          pkg_version -IvL '='
```

Please feel free to post any others you may use


----------



## FRANCOIS (Mar 4, 2010)

```
alias pid 'ps -afx|grep'
```


----------



## ckester (Mar 4, 2010)

The usual aliases involving *ls*, and a few others that might be of interest.   

But for most things I use (bash) functions instead. 


```
alias la='ls -abFG'
alias lc='ls -bCG'
alias ll='ls -abhlG'
alias lr='ls -bRG'

alias e="vim"
alias y="/usr/local/bin/e"   # simple expression evaluator

alias cclive='cclive -f best -F "%t.%s"'
```

I like to use "e" to invoke the text editor, because that's what you use in vi(m) and most tools (e.g., misc/vifm) that have been influenced by vi.   

Unfortunately, that creates a name clash with the nifty little expression evaluator math/e.  So I also have an alias for it.  I used *y* because it reminds me of *y = f(x)*.


----------



## jalla (Mar 5, 2010)

My three most useful aliases 


```
alias mroe more
alias mkea make
alias mkae make
```

And a convenient shortcut for adding other frequent typo's

```
alias vc 'vi ~/.cshrc;source ~/.cshrc'
```


----------



## SirDice (Mar 5, 2010)

jalla said:
			
		

> My three most useful aliases
> 
> 
> ```
> ...


Works for (t)csh: [cmd=]set correct = command[/cmd]


----------



## sverreh (Mar 5, 2010)

```
alias cdburn    "mkisofs -o cd.iso -r \!*;\
                 sudo burncd -f /dev/acd0 data cd.iso fixate; rm cd.iso"
alias devl      "sudo camcontrol devlist"
alias mcd       "sudo mount -r -t cd9660 /dev/acd0 /mnt; cd /mnt; ls"
alias mfl       "sudo mount_msdosfs -u sverreh /dev/da0 /a; cd /a; ls"
alias msk       "cd /usr/ports; make search key=\!* display=name,path,info\
                 keylim=1|less; cd -"
alias msn       "cd /usr/ports; make search name=\!* display=name,path,info\
                 keylim=1|less; cd -"
alias po        "popd -v \!*"
alias pu        "pushd -v \!*"
alias xpdf      "xpdf -g 1000x1000+140+0 -papercolor cornsilk -mattecolor steelblue\
                 -z 175 -level1 \!*"
alias xt        "xterm -sb -sl 9999 -cc 33:48,36-37:48,43:48,45-47:48,64:48\
                 -geometry 80x25+100+100 -cr red -bg \!:1 -fg \!:2 -fn 7x13&"
```


----------



## wonslung (Mar 5, 2010)

how about


```
alias mcr "make config-recursive install clean"
```


----------



## ikbendeman (Mar 5, 2010)

I posted a thread just like this the other day but it must have gotten deleted !


```
#.csh rc - default aliases snipped

alias  lm           'ls -F | more'
# cd to the directory 'port', usage: cdport 'port'
# make sure to use backquotes around whereis
alias  cdport       'cd `whereis -sq \!*`'
# cat out the pkg-descr file of given port  
# portdescr 'port'
alias  portdescr    'cat `whereis -sq \!*`/pkg-descr'
alias  portplist    'cat `whereis -sq \!*`/pkg-plist | more'
alias  oldports     pkg_version -IvL '='
```


----------



## ikbendeman (Mar 5, 2010)

sorry, my thread got merged not deleted [embarassed]


----------



## ckester (Mar 5, 2010)

ikbendeman said:
			
		

> ```
> # cd to the directory 'port', usage: cdport 'port'
> # make sure to use backquotes around whereis
> alias  cdport       'cd `whereis -sq \!*`'
> ```



Nice!  If you have the sourcecode for FreeBSD itself installed, cdport can take you there too.  

Try it with anything from /usr/bin.


----------



## ikbendeman (Mar 5, 2010)

yes ive found it quite useful  maybe it should be named cdsrc instead


----------



## ckester (Mar 6, 2010)

If *whereis* returns an empty string, the *cdport* alias takes you to your home directory -- which might be unexpected or not what you want.

So in bash I would use a shell function instead. 

For csh, I'd have the alias invoke a script, like so:


```
alias src source $HOME/bin/cdsrc
```

A simple cdsrc script might look like this:


```
#!/bin/csh

set d = `whereis -sq $1`

if ( "X$d" == "X" ) then
	echo "No source directory found for $1"
else
	cd $d
endif
```


----------



## Erratus (Mar 7, 2010)

```
alias grep grep --color        #colored search 
alias helpcommand info         #place cursor over command and do alt-h
```


----------



## freethread (Mar 7, 2010)

I use this to help me (a unix noob) to stay at 'home'


```
alias q         exit
alias cls       clear
alias sysoff    'shutdown -p now'
alias diskstat  'df -achT'
alias ver       'echo "`uname` `uname -r`"'
alias dir       'ls -ahlFGT'
alias del       rm
alias copy      cp
alias md        mkdir
alias rd        rmdir

if ( `whereis -bq mc` != "" ) then
   alias edit   'mc -e'
   alias view   'mc -v'
else
   alias edit   ee
   alias view   'less -M -Q -J -~'
endif
```


----------



## Beastie (Mar 7, 2010)

Erratus said:
			
		

> ```
> alias helpcommand info         #place cursor over command and do alt-h
> ```


I always thought the usefulness of aliases lies in having less typing than with the original command.


----------



## Beastie (Mar 7, 2010)

freethread said:
			
		

> ```
> alias cls       clear
> ```


How about *^L* (with t/csh)?



			
				freethread said:
			
		

> ```
> alias sysoff    'shutdown -p now'
> ```


How about halt(8) (reboot(8))?


----------



## freethread (Mar 7, 2010)

dear Beastie, perhaps there are many ways to do something, my background is Windows, I love FreeBSD like Windows, much more than linux, I like tcsh more than bash, but I cannot spend my life reading manuals and papers, so when I found a way to do something I call it with a confortable name and aliases it.

'cls' already exists in my mind so 'clear' become 'cls'. 'sysoff' was not previously in my mind, when I found how to turn freebsd off I call it 'sysoff' and aliased, problem solved.

In my very own opinion, many freebsd users (and forum people) are real experts about FreeBSD 1st and also other OSs, but 'not all people born teached', what is simple for you could be complicated fot others.


----------



## Erratus (Mar 7, 2010)

Beastie said:
			
		

> I always thought the usefulness of aliases lies in having less typing than with the original command.


May be you didn't get how and when to use it? Did you try?


----------



## idle (Mar 9, 2010)

My favourite. 

```
alias 'make love' 'Not war.'
```
I don't know who author, it's csh built-in from time immemorial.


----------



## ikbendeman (Mar 10, 2010)

ckester said:
			
		

> If *whereis* returns an empty string, the *cdport* alias takes you to your home directory -- which might be unexpected or not what you want.
> 
> So in bash I would use a shell function instead.
> 
> ...



Weird, on mine it doesn't change directories, it just gives an error.. also, if i make a script, the script works, but it appears to be run in a subshell, which exits upon completion of the script, thus I am back where i was before, any ideas how to fix this?


----------



## ckester (Mar 10, 2010)

ikbendeman said:
			
		

> Weird, on mine it doesn't change directories, it just gives an error.. also, if i make a script, the script works, but it appears to be run in a subshell, which exits upon completion of the script, thus I am back where i was before, any ideas how to fix this?



To avoid the subshell, use "source" as shown in my csh example.

What's the text of the error you get with the alias?


----------

