Skip to content

Instantly share code, notes, and snippets.

ls . # files in current directory
ls .. # files in parent directory
tree > log.txt # put the results of a command in a file (You must have tree installed. It's available via macports <sudo port install tree>)
ls >> log.txt # append the results of a command in a file
mkdir -p one/two/ # create multiple directories in one step
env # print out environment variables in name value pair
Control + a # go to the beginning line
Control + e # go to the end line
Control + k # delete all to the right
@y2kdev
y2kdev / aliases
Created February 11, 2011 13:22
aliases for bash setup
# UTILS
alias tc='top -o cpu' # check cpu usage
alias tm='top -o vsize' # check memory usage
alias dud="du -d 1 -h" # disk usage
alias c="clear" # clear interface
alias dc="rm -rf" # remove folder with content in it
alias h="history" # review log of commands
alias tgzu="tar -xzvf" # uzip tar gzip file
alias dl="wget -N" # download file and overwrite if required
alias dlc="curl -O" # download file and overwrite if required
@y2kdev
y2kdev / env
Created February 11, 2011 04:32
env for bash shell layout
#ENV Variables
export PATH=/opt/local/bin:/opt/local/sbin:$PATH:~/bin
export USER_NAME=`whoami`
export IP="YOUR_IP_ADDRESS"
export PORT="YOUR_PORT_NUMBER"
export USER="YOUR_USER_NAME"
export DEVPATH=~/Documents/Projects/yourprojectname
export SVN_REPO_PATH=~/Documents/svn
export GIT_REPO_PATH=~/Documents/git
@y2kdev
y2kdev / config
Created February 11, 2011 04:26
config for bash shell
# Documentation on Colors from http://wiki.archlinux.org/index.php/Color_Bash_Prompt
#Prompt Elements:
#\u -Username
#\w -Current Directory
#\d -Date
#\D -{fmt} Date as sprintf
#\h -Subdomain
#\H -Full Host name
#\n -new line
echo "<html><head><title>VIRTUAL HOST TEST</title></head><body><h1>VIRTUAL HOST CONFIGURED!</h1></body></html>" > /vhosts/domains/YOURDOMAIN.com/public/index.html
# domain: YOURDOMAIN.com
# public: /vhosts/domains/YOURDOMAIN.com/public
<VirtualHost YOURIP:80>
# Admin email, Server Name (domain name) and any aliases
ServerAdmin [email protected]
ServerName YOURDOMAIN.com
ServerAlias www.YOURDOMAIN.com
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml text/css application/x-javascript text/javascript
# .htaccess
# To be stored in a web directory in which you wish to password protect from the public.
# This simple script refers to an .htpasswd file that should be stored outside of the public html folder of your domain.
# Be sure to update the path to the AuthUserFile, the root path of your webserver will differ based on your host.
Options +Indexes
AuthUserFile /{YOUR_HOME_DIRECTORY}/{YOUR_PATH}/{YOUR_SECURE_PATH}/.htpasswd
AuthType Basic
AuthName "Login Required:"
Require valid-user