# Favorite Aliases...



## diortemew (Jan 22, 2021)

Being with FreeBSD for only a few weeks I am still learning it and find myself falling back on Linux (and Windows WSL2 + Docker) for development. After all, it is all I know. But I am working toward using a single OS, hence my latest love for FreeBSD and desire to port to it completely eventually. But a lot of my aliases I use in Linux will not work for FreeBSD due mostly to the package managers (*dnf* in _Fedora_, *apt* in _Ubuntu_) so I will have some tweaking to do as I slowly integrate. A replace all script could likely handle half of these changes, but there are still a few I can't use. As such, I am very curious, what aliases do you use? What are your favorites? Will you share?

Here are only a few of mine (Fedora):

```
#my aliases
alias up2d8="sudo dnf update -y && sudo dnf upgrade -y && sudo dnf autoremove -y"
alias ook="speedtest"
alias nfl8="flatpak update"
```


----------



## SirDice (Jan 22, 2021)

diortemew said:


> ```
> alias up2d8="sudo dnf update -y && sudo dnf upgrade -y && sudo dnf autoremove -y"
> ```


Replace that one with:

```
alias up2d8="sudo 'pkg update && pkg upgrade && pkg autoremove'"
```



diortemew said:


> I am very curious, what aliases do you use?


Probably the only one I consistently use _everywhere_, is `ll`

```
# alias ll
ls -lAF
```


----------



## meine (Jan 22, 2021)

Nice to see that a lot of people have aliased a string for running updates. Below my aliases. Both backup lines are for a mirror (--delete) and an incremental backup, which also write a line to a logfile to see what backups I made and when.

For myself as a user I have aliases to start the default X (x11-wm/cwm in Xdefaults) or another, a shutdowner and one to synchronize some directories on my laptop that I only use now and then. There is an identical one that synchronizes my smartphone (that indeed understands rsync, ssh etc)

For root:


```
alias update    'pkg upgrade -y && pkg autoremove -y && pkg clean -y'

alias bak_now   'rsync -az --info=progress2 --delete --exclude-from=/media/bsd_now/exclude-list-rsync.txt /home/ /media/bsd_now/HOME_backup_now/ ; ( echo mirror backup @FreeBSD ; date ; echo ---------- ) >> /media/bsd_now/backup.bsd_now.log'

alias bak_all   'rsync -az --info=progress2 --exclude-from=/media/bsd_all/exclude-list-rsync.txt /home/ /media/bsd_all/HOME_backup_all/ ; ( echo incremental backup @FreeBSD ; date ; echo ---------- ) >> /media/bsd_all/backup.bsd_all.log'
```


For user:


```
alias x='startx'
alias s='screen'
alias box='startx /usr/local/bin/openbox'
alias wm='startx /usr/local/bin/wmaker'
alias quit='shutdown -p now'
alias lapsync='rsync -avz <some dirs> laptopname:/home/mydir/'
```


----------



## matt_k (Jan 22, 2021)

```
alias eco='vim /home/me/.config/spectrwm/spectrwm.conf'
alias keys='vim /home/me/.config/spectrwm/spectrwm_my.conf'
alias la='lsd -lA'
alias ll='lsd -l'
alias lm='lsd -tl'
alias ls='lsd'
alias lt='lsd -Sl'
alias pls='doas' #this one is fun to use
alias signal='dbus-run-session scli'
```

and it seems that I will add something like this, thanks for suggestions:

```
alias up="doas pkg update && doas pkg upgrade && doas pkg autoremove"
```


----------



## ralphbsz (Jan 22, 2021)

alias ls='ls -F'
alias la='ls -aF'
alias ll='ls -lF'
alias rm='rm -i'
alias mv='mv -i'
alias cp='cp -i'
alias e="emacs" or "emacs -nw" when running on XWindows.

The other aliases are very task- and user-specific. For example, on the root account I have "elog" = edit the daily log file (I hand-edit a running log of all sys admin activities). On machines within a cluster (like a household), I have aliases "toXXX" for "logging in to machine XXX"; sometimes those are not aliases, but shell functions that take parameters. On development machines where I use cvs, I have "cvsup" for "cvs update | pipe into my favorite script to see the results in a brief fashion". On some work machines, I have various versions of "hg pull".

One particular alias I like is "mkdircd", which creates a directory (with -p, so you can create multiple levels at once), and immediately cd's into it.


----------



## mickey (Jan 23, 2021)

```
alias   cls             'clear'
alias   dir             'clear ; ls -ahlsFG \!* | more -R'
alias   dirt            'clear ; ls -ahlstFG \!* | more -R'
alias   l               'ls -alG'
alias   ll              'ls -alsG'
alias   h               'history | more'
alias   md              'mkdir'
alias   px              'ps -axw'
alias   pkg-date        'pkg query -a "%t %n" | sort'
```


----------



## _martin (Feb 13, 2021)

My most used ones are:

```
alias ..='cd ..'
alias ll='ls -la'
alias bdf='df -m'
alias psg='ps ax | grep $1'
alias agdb='gdb -p $(pidof $1 )'
alias sd='dmesg | tail -2'
```
The last one is specific to Linux (see segfault message when I know program just crashed). I use bash for interactive shell and I like it.


----------



## delphinoob (Feb 13, 2021)

alias x="startx"
alias mkdir="mkdir -p "


----------



## ralphbsz (Feb 14, 2021)

Here is my mkdircd function, in bash syntax:

```
# Create a directory and immediately CD into it.
    function mkdircd () {
        if [ $# -ne 1 ] ; then
            echo "Usage: mkdircd <dir>"
            echo "       Create a directory and cd into it"
            return ; fi

        mkdir -p $1 || return
        cd $1
    }
```


----------

