SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2015-07-21 11:44:34

smacz
#! Junkie
Registered: 2014-12-09
Posts: 250

Aliases/Functions thread

## Colorize the ls output ##
alias ls='ls --color=auto --group-directories-first'
 
## Use a long listing format ##
alias ll='ls -la --human-readable'

## Show hidden files, but not ./. and ./.. ##
alias la='ls -A'

## Colorize grep commands ##
alias grep='grep --color=auto'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'

## Make parent directories as needed and output result ##
alias mkdir='mkdir -pv'

## Don't let ping go on forever ##
alias ping='ping -c 5'

## Is this thing on? ##
alias pingg='ping -c 5 google.com'
alias pinggg='ping -c 5 8.8.8.8'

## Say my name, say my name ##
alias myip='dig +short myip.opendns.com @resolver1.opendns.com'

## Hidden files and folders are files too, ya know ##
alias cp='cp -ar'

## Who's permission is denied? ##
alias ${explative}ing='sudo $(history -p !!)'

## Building a better understanding ##
alias lsblk='lsblk -f'

## I'm too lazy to remember the content of this directory ##
function cdls    { builtin cd "$@" && ls; }

## New for systemd ##
function start()    { sudo systemctl start $@; }
function stop()     { sudo systemctl stop $@; }
function restart()  { sudo systemctl restart $@; }
function status()   { sudo systemctl status $@; }
function enable()   { sudo systemctl enable $@; }
function disable()  { sudo systemctl disable $@; }

## Get outta my sight! ##
alias clr='clear'

## I have found the light ##
alias emacs='vim'

## I most certainly not youtube-dl that video! ##
alias erase='cat /dev/null > ~/.bash_history'

## Don't watch, ma ##
alias shh='unset HISTFILE'

## Up...up...and away! ##
alias cu='cd ..'

## This time in human ##
alias df='df -h'

## You fatty file ##
alias diskspace='du -S | sort -n -r |more'

## I want all of you ##
alias du='du -ch'

## I know it's more typing but...c'mon ##
alias godmode='sudo'

## That's it, my keyboard is going in the trash! #
alias frak='fortune'

## Here's lookin at you, xarchiver ##
extract () {
   if [ -f $1 ] ; then
       case $1 in
           *.tar.bz2)   tar xvjf $1    ;;
           *.tar.gz)    tar xvzf $1    ;;
           *.bz2)       bunzip2 $1     ;;
           *.rar)       unrar x $1       ;;
           *.gz)        gunzip $1      ;;
           *.tar)       tar xvf $1     ;;
           *.tbz2)      tar xvjf $1    ;;
           *.tgz)       tar xvzf $1    ;;
           *.zip)       unzip $1       ;;
           *.Z)         uncompress $1  ;;
           *.7z)        7z x $1        ;;
           *)           echo "don't know how to extract '$1'..." ;;
       esac
   else
       echo "'$1' is not a valid file!"
   fi
 }

## And thanks for all the fish ##
alias forkbomb=':(){ :|:& };:'

Last edited by smacz (2015-07-21 21:06:57)

Offline

Be excellent to each other!

#2 2015-07-21 15:17:22

damo
#! gimpbanger
From: N51.5 W002.8 (mostly)
Registered: 2011-11-24
Posts: 5,434

Re: Aliases/Functions thread

Offline

#3 2015-07-21 16:27:43

brontosaurusrex
#! Red Menace
Registered: 2012-06-15
Posts: 1,643

Re: Aliases/Functions thread

Offline

#4 2015-07-21 18:11:33

Head_on_a_Stick
CatMod
From: A world of pure imagination
Registered: 2014-01-21
Posts: 4,797

Re: Aliases/Functions thread

alias touch='xinput set-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 1' # in case I accidently hit the "disable touchpad" key
alias 1='xbacklight -set 1'
alias 2='xbacklight -set 10'
alias 3='xbacklight -set 25'
alias 4='xbacklight -set 50'
alias 5='xbacklight -set 75'
alias 10='xbacklight -set 100'
alias mv='mv -iv'

Last edited by Head_on_a_Stick (2015-07-21 18:21:11)

Offline

#5 2015-07-21 18:14:42

brontosaurusrex
#! Red Menace
Registered: 2012-06-15
Posts: 1,643

Re: Aliases/Functions thread

@Head_on_a_Stick: the idea was to keep dwm going as its git is going without re-patching (not that I really know how to patch properly anyway).

Offline

#6 2015-07-21 18:18:06

cloverskull
#! Junkie
Registered: 2013-10-26
Posts: 377

Re: Aliases/Functions thread

What's the best way to use zsh/oh-my-zsh with custom sh aliases? Where do you put them? .zshrc seems wrong to me. Any ideas?

Offline

#7 2015-07-21 18:19:53

Head_on_a_Stick
CatMod
From: A world of pure imagination
Registered: 2014-01-21
Posts: 4,797

Re: Aliases/Functions thread

Offline

#8 2015-07-21 19:04:25

cloverskull
#! Junkie
Registered: 2013-10-26
Posts: 377

Re: Aliases/Functions thread

Offline

#9 2015-07-21 19:08:30

Head_on_a_Stick
CatMod
From: A world of pure imagination
Registered: 2014-01-21
Posts: 4,797

Re: Aliases/Functions thread

Offline

#10 2015-07-21 19:30:17

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Aliases/Functions thread

Offline

#11 2015-07-21 19:53:02

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Aliases/Functions thread

####################
# ALIAS DEFINITIONS & FUNCTIONS
# Thanks to Mark Buck
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

### My Aliases #####
if [ -f ~/bin/Bash/bash_aliases ]; then
    . ~/bin/Bash/bash_aliases
fi

### My Functions ###
if [ -f ~/bin/Bash/bash_functions ]; then
 . ~/bin/Bash/bash_functions
fi

####################

Offline

#12 2015-07-21 21:12:58

smacz
#! Junkie
Registered: 2014-12-09
Posts: 250

Re: Aliases/Functions thread

^Woohoo! This guy!

I think I learn more about apt-get through your aliases than I have by reading the man page.

Offline

#13 2015-07-21 21:34:47

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Aliases/Functions thread

I'm happy you are happy.  I have been 'collecting' these for a long time ...

This one:

alias al='cat ~/bin/Bash/bash_aliases'

I just changed (something damo said a while back)

alias al='alias | less'

Lists your aliases in alphabetical order.  ( Thanks damo )

Offline

#14 2015-07-22 15:26:25

damo
#! gimpbanger
From: N51.5 W002.8 (mostly)
Registered: 2011-11-24
Posts: 5,434

Re: Aliases/Functions thread

Because I've been doing a lot with BL github recently, I set up some bash functions and aliases to speed things up. Here is part of my .bash_aliases

alias font='sudo fc-cache -f -v'

# run lightdm for testing
alias ldm='dm-tool add-nested-seat --screen 1920x1080'

#################################################################################

bl-gitStatus(){
    for i in bunsen-*;do
        cd "$i"
        echo ----
        echo "Status of $i"
        echo
        git status
        cd ../
    done
}

bl-gitPull(){
    for i in bunsen-*;do
        cd "$i"
        echo ----
        echo "Pull from $i"
        echo
        git pull
        cd ../
    done
}

bl-gitSync(){
    for i in bunsen-*;do
        cd "$i"
        echo ----
        echo "Fetching from $i"
        echo
        git fetch upstream
        git merge upstream/master
        cd ../
    done
}

bl-gitRemote(){
    for i in bunsen-*;do
        cd "$i"
        echo ----
        echo "Remote for $i"
        echo
        git remote -v
        cd ../
    done
}
# to deal with each git repos in bunsen-labs dir
alias gitstat='bl-gitStatus'
alias gitpull='bl-gitPull'
alias gitsync='bl-gitSync'
alias gitremote='bl-gitRemote'

And output of 'aliases | less':

alias aptget='sudo apt-get install --no-install-recommends'
alias aptget-s='sudo apt-get install --no-install-recommends --simulate'
alias aptgetr='sudo apt-get install --reinstall --no-install-recommends'
alias aptgetr-s='sudo apt-get install --reinstall --no-install-recommends --simulate'
alias aptitudes='aptitude search'
alias aptpol='apt-cache policy'
alias aptrem='sudo apt-get remove'
alias aptremp='sudo apt-get remove --purge'
alias apts='apt-cache search'
alias aptshow='apt-cache show'
alias dir='dir --color=auto'
alias distup='sudo apt-get update && sudo apt-get dist-upgrade --no-install-recommends'
alias distup-s='sudo apt-get update && sudo apt-get dist-upgrade --no-install-recommends --simulate'
alias font='sudo fc-cache -f -v'
alias gitpull='bl-gitPull'
alias gitremote='bl-gitRemote'
alias gitstat='bl-gitStatus'
alias gitsync='bl-gitSync'
alias grep='grep --color=auto'
alias hold='sudo apt-mark hold'
alias l='ls -CF'
alias la='ls -A'
alias ldm='dm-tool add-nested-seat --screen 1920x1080'
alias ll='ls -al'
alias loc8all='locate'
alias loc8bkp='locate -d /var/lib/mlocate/backups.db'
alias loc8home='locate -d /var/lib/mlocate/home.db'
alias loc8trash='locate -d /var/lib/mlocate/trash.db'
alias loc8win='locate -d /var/lib/mlocate/windows.db'
alias ls='ls -h --color=auto'
alias rm='rm -I'
alias showhold='apt-mark showhold'
alias unhold='sudo apt-mark unhold'
alias upd8all='sudo updatedb -v  --prunepaths="/home/damo/.local/share/Trash /mnt/windoze /mnt/backups /mnt/data /var/spool /var/tmp /tmp"'
alias upd8bkp='sudo updatedb -v -U /mnt/backups -o /var/lib/mlocate/backups.db'
alias upd8home='sudo updatedb -v -U /home/damo -o /var/lib/mlocate/home.db --prunepaths=/home/damo/.local/share/Trash'
alias upd8trash='sudo updatedb -v -U /home/damo/.local/share/Trash/files -o /var/lib/mlocate/trash.db'
alias upd8win='sudo updatedb -v -U /mnt/windoze -o /var/lib/mlocate/windows.db'
alias update='sudo apt-get update'
alias upgrade='sudo apt-get upgrade --no-install-recommends'
alias usb='ls -l /dev/disk/by-id/*usb* | awk {'\''print ($11)'\''} | cut -c 7-$NF'
alias xxev='xev -g +730+10 | sed "/^MotionNotify/,/^$/d"'

Offline

#15 2015-07-22 15:54:24

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Aliases/Functions thread

Offline

#16 2015-07-22 16:35:07

Nili
#! Die Hard
From: 127.0.0.1
Registered: 2013-03-20
Posts: 811
Website

Re: Aliases/Functions thread

Some awesome aliases. Thanks everyone for your efforts.  cool

Offline

#17 2015-07-22 17:37:59

smacz
#! Junkie
Registered: 2014-12-09
Posts: 250

Re: Aliases/Functions thread

Offline

#18 2015-07-22 18:34:52

damo
#! gimpbanger
From: N51.5 W002.8 (mostly)
Registered: 2011-11-24
Posts: 5,434

Re: Aliases/Functions thread

Offline

#19 2015-07-23 03:16:27

johnraff
nullglob
From: Nagoya, Japan
Registered: 2009-01-07
Posts: 4,148
Website

Re: Aliases/Functions thread

# to deal with each git repos in bunsen-labs dir
alias gitstat='bl-gitStatus'
alias gitpull='bl-gitPull'
alias gitsync='bl-gitSync'
alias gitremote='bl-gitRemote'

Last edited by johnraff (2015-07-23 08:12:03)

Offline

#20 2015-07-23 13:33:31

Head_on_a_Stick
CatMod
From: A world of pure imagination
Registered: 2014-01-21
Posts: 4,797

Re: Aliases/Functions thread

Forgot about this one on $BETTER_HALF's machine (Debian Stable with Chromium & pepperflash):

alias up='sudo sh -c "update-pepperflashplugin-nonfree --install;apt-get update && apt-get upgrade"'

Last edited by Head_on_a_Stick (2015-07-25 02:05:09)

Offline

#21 2015-07-23 16:18:24

damo
#! gimpbanger
From: N51.5 W002.8 (mostly)
Registered: 2011-11-24
Posts: 5,434

Re: Aliases/Functions thread

Offline

#22 2015-07-23 16:53:16

smacz
#! Junkie
Registered: 2014-12-09
Posts: 250

Re: Aliases/Functions thread

TBH I had only learned about using functions as aliases while doing my research about what to put in '~/.bash_aliases'. Otherwise I would've thought I had to put them in /usr/bin as their own #!/bin/bash script.

Offline

#23 2015-07-25 00:39:45

Head_on_a_Stick
CatMod
From: A world of pure imagination
Registered: 2014-01-21
Posts: 4,797

Re: Aliases/Functions thread

alias sudo='/usr/bin/sudo'
alias passwd='/usr/bin/passwd'
alias su='/bin/su'

Last edited by Head_on_a_Stick (2015-07-25 02:08:59)

Offline

#24 2015-07-31 02:06:46

johnraff
nullglob
From: Nagoya, Japan
Registered: 2009-01-07
Posts: 4,148
Website

Re: Aliases/Functions thread

Last edited by johnraff (2015-07-31 02:25:35)

Offline

Help fund CrunchBang, donate to the project!

#25 2015-09-14 19:25:20

Head_on_a_Stick
CatMod
From: A world of pure imagination
Registered: 2014-01-21
Posts: 4,797

Re: Aliases/Functions thread

orphan() {
	if [[ ! -n $(pacman -Qdt) ]]; then
		echo "All clear!"
	else
		sudo pacman -Rns $(pacman -Qqdt)
	fi
}

Last edited by Head_on_a_Stick (2015-09-14 20:02:22)

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: bleh

Debian Logo