tutorials:bash
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
tutorials:bash [2010/07/31 01:04] – created chkuo | tutorials:bash [2012/11/23 13:59] (current) – [.bashrc (Ubuntu)] hsu | ||
---|---|---|---|
Line 4: | Line 4: | ||
===== Sample Configuration Files ===== | ===== Sample Configuration Files ===== | ||
==== .bash_profile ==== | ==== .bash_profile ==== | ||
- | < | + | < |
# .bash_profile | # .bash_profile | ||
# Get the aliases and functions | # Get the aliases and functions | ||
Line 12: | Line 12: | ||
</ | </ | ||
- | ==== .bashrc ==== | + | ==== .bashrc |
- | < | + | < |
# .bashrc | # .bashrc | ||
# User specific aliases and functions | # User specific aliases and functions | ||
Line 21: | Line 21: | ||
# User specific environment and startup programs | # User specific environment and startup programs | ||
export PATH=" | export PATH=" | ||
+ | |||
+ | # enable color support | ||
+ | alias grep=' | ||
# shell command alias | # shell command alias | ||
Line 29: | Line 32: | ||
alias lm='ls -lFG | more' | alias lm='ls -lFG | more' | ||
alias ll='ls -alFG | more' | alias ll='ls -alFG | more' | ||
+ | </ | ||
- | # short cut to active project directory | + | |
+ | # under home directory, | ||
+ | mv .bashrc .bashrc_v2 | ||
+ | # create anyother .bashrc file and paste the below script into it. | ||
+ | nano .bashrc | ||
+ | |||
+ | ==== .bashrc (Ubuntu) ==== | ||
+ | <file bash .bashrc> | ||
+ | # .bashrc | ||
+ | # User specific aliases and functions | ||
+ | # set prompt, format = ' | ||
+ | PS1=' | ||
+ | |||
+ | # User specific environment and startup programs | ||
+ | export PATH=" | ||
+ | export PERL5LIB=" | ||
+ | |||
+ | # enable color support of ls and also add handy aliases | ||
+ | if [ -x / | ||
+ | test -r ~/ | ||
+ | alias ls='ls --color=auto' | ||
+ | #alias dir=' | ||
+ | #alias vdir=' | ||
+ | |||
+ | alias grep=' | ||
+ | alias fgrep=' | ||
+ | alias egrep=' | ||
+ | fi | ||
+ | |||
+ | # some more ls aliases | ||
+ | alias l='ls -lF' | ||
+ | alias ll='ls -alF' | ||
+ | alias lm='ls -alF | more' | ||
+ | |||
+ | # shell command alias | ||
+ | alias .=' | ||
+ | alias ..='cd ..' | ||
+ | alias cd..=' | ||
+ | |||
+ | # short cut | ||
alias pls=' | alias pls=' | ||
alias sc='cd / | alias sc='cd / | ||
# ssh alias for connecting to other machines | # ssh alias for connecting to other machines | ||
- | | + | # Academia Sinica |
- | # maple | + | # hickory |
- | export | + | export |
- | alias maple='ssh $MAPLE' | + | alias hickory='ssh $HICKORY' |
- | # oak | + | |
- | export OAK=' | + | |
- | alias oak=' | + | |
</ | </ | ||
- | |||
- | ===== ssh key ===== | ||
- | ==== Generate key-pairs ==== | ||
- | <code bash> | ||
- | ssh-keygen -t ' | ||
- | </ | ||
- | ==== Auto-authentication ==== | ||
- | Append ' | ||
- | |||
- | ===== Remote reboot ===== | ||
- | In the case that you need to reboot a machine remotely, login through '' | ||
- | <code bash> | ||
- | sudo shutdown -r now | ||
- | </ | ||
- | |||
===== Shell Scripts ===== | ===== Shell Scripts ===== | ||
==== Pack Up Directories ==== | ==== Pack Up Directories ==== | ||
- | < | + | < |
#!/bin/sh | #!/bin/sh | ||
for x | for x | ||
Line 71: | Line 97: | ||
</ | </ | ||
+ | |||
+ | ===== Disk permissions ===== | ||
+ | Useful for checking eternal hard drive (in Mac OS X) | ||
+ | ==== Check ==== | ||
+ | <code bash> | ||
+ | sudo vsdbutil -c / | ||
+ | </ | ||
+ | ==== Enable ==== | ||
+ | <code bash> | ||
+ | sudo vsdbutil -a / | ||
+ | </ | ||
tutorials/bash.1280509479.txt.gz · Last modified: 2010/07/31 01:04 by chkuo