October 15, 2018

Cool Bash Aliases for FreeBSD

FreeBSD Logo

Every day, the shell is your most used program. Using aliases can make your live much easier. In the following we have listed a few useful aliases to brighten up your day.

Root access is required to edit the following files and to execute commands. Log in as root (su) or simply prepend sudo to all commands that require root privileges.

Enable color in the console

For colorful experience under FreeBSD you need to install gnuls.

cd /usr/ports/misc/gnuls
make install clean; rehash

Edit the bash profile

Open the file ~/.profile with your favorite text editor.

vi ~/.profile

Paste the following lines at the bottom of the file.

# Rewrite ls to use gnuls
alias ls='gnuls --color=auto'
alias ll='gnuls -lh'
alias la='gnuls -lha'

# Fast change up
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'

# Change to the previous path
alias -- -='cd -'

# History
alias h='history'

# Clear
alias c='clear'

# Human readable
alias df='df -h'
alias du='du -h'

# Current timestamp
alias timestamp='date "+%Y%m%d%H%M%S"'

# Create a timestamp directory
alias tsdir='timestamp | xargs mkdir'

# Search for a process name
alias psg='ps ax | grep -v grep | grep '

# Ten highest memory usage processes
alias psram='ps aux | sort -rnk 4 | head'

# Extended process status without ps itself
alias ps='ps aux | grep -v "ps aux"'

# Funny
alias wtf='man'

Speak Your Mind