Skip to content

Instantly share code, notes, and snippets.

@elundmark
Created March 30, 2011 02:12
Show Gist options
  • Save elundmark/893736 to your computer and use it in GitHub Desktop.
Save elundmark/893736 to your computer and use it in GitHub Desktop.
Some bash aliases for your terminal, tested on Ubuntu 10.10, dependencies may vary.
# lazy way to copy text to clipboard
copy () { echo "$1"|xargs echo -n | /usr/bin/xclip -selection clipboard ; }
# zip file/folder
zipf () { zip -r "$1".zip "$1" ; }
# make .tar.gz
tarf () { tar -cvzf "$1".tar.gz $1 ; }
# extract .tar.gz
xtarf () { tar xzvf "$1" -C "$2" ; }
# makes _rm delete files/folders to the trash-can
# 'sudo ' is to support sudo _rm
alias sudo='sudo '
alias _rm='mv -f -t ~/.local/share/Trash/files'
alias aliases='nano ~/.bash_aliases'
alias pbcopy='/usr/bin/xclip -selection clipboard'
alias pbpaste='/usr/bin/xclip -selection clipboard -o'
alias rebuild-icons='sudo gtk-update-icon-cache --force --ignore-theme-index /usr/share/icons'
# alias for qrencode which prodiced QR code images
alias qr='qrencode -o qrcode.png -m 1 -s'
alias dlsite='wget --no-dns-cache --random-wait -S -r -p -e robots=off -U mozilla'
alias dlsite_debug='wget -q --server-response --save-headers --no-cache --no-dns-cache --random-wait -S -r -p -e robots=off -U mozilla'
alias cd..='cd ../'
alias cd...='cd ../../'
alias cd....='cd ../../../'
alias make5='find -type f -exec md5sum "{}" \; > md5sum.txt'
alias 5='md5sum -c md5sum.txt'
alias diskid='ls -l /dev/disk/by-uuid/'
alias j='eject'
alias c='eject -t'
alias sai='sudo apt-get install'
alias sar='sudo apt-get remove'
alias sau='sudo apt-get update'
alias export-podcasts="cd /home/elundmark/.local/share/rhythmbox && grep -A 5 -e podcast-feed rhythmdb.xml | grep -e '<location>' | sed 's: *</*[a-t]*>::g' > /home/elundmark/Övrigt/PodFeeds.txt && cd"
alias files='la -l -a'
alias hidden='ls -lhtrdF .*'
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
# if my usb drive is disconnected I can still access WHAT files are on it
alias content_to_file='cd /media/DRIVE && ls -1aAFR > ~/DRIVE-contents.txt'
# LAMP stuff
alias stop-server='sudo /etc/init.d/mysql stop && sudo /etc/init.d/apache2 stop'
alias start-server='sudo /etc/init.d/mysql start && sudo /etc/init.d/apache2 start'
alias restart-network='sudo /etc/init.d/networking restart'
# export / import mysql to file when using LAMP and ex. MAMP with the same shared web folder over Dropbox :)
alias expsql='/usr/bin/mysqldump -mysql_admin -the_password table_name > ~/web-apps/newbackup.sql'
alias impsql='mysql -mysql_admin -the_password table_name < ~/web-apps/newbackup.sql'
alias rmsql='rm ~/web-apps/newbackup.sql'
# LAMP on Ubuntu or MAMP on the Mac ?
alias mamp-host='sudo cp --force /etc/hosts /etc/hosts.bak && sudo cp --force /etc/hosts.mamp /etc/hosts'
alias lamp-host='sudo cp --force /etc/hosts /etc/hosts.bak && sudo cp --force /etc/hosts.lamp /etc/hosts'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment