tutorials:bash
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tutorials:bash [2011/01/11 15:22] – [Remote Reboot] 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 13: | Line 13: | ||
==== .bashrc (Mac OS X) ==== | ==== .bashrc (Mac OS X) ==== | ||
- | < | + | < |
# .bashrc | # .bashrc | ||
# User specific aliases and functions | # User specific aliases and functions | ||
Line 33: | Line 33: | ||
alias ll='ls -alFG | more' | alias ll='ls -alFG | more' | ||
</ | </ | ||
+ | |||
+ | |||
+ | # under home directory, | ||
+ | mv .bashrc .bashrc_v2 | ||
+ | # create anyother .bashrc file and paste the below script into it. | ||
+ | nano .bashrc | ||
==== .bashrc (Ubuntu) ==== | ==== .bashrc (Ubuntu) ==== | ||
- | < | + | < |
# .bashrc | # .bashrc | ||
# User specific aliases and functions | # User specific aliases and functions | ||
Line 43: | Line 49: | ||
# User specific environment and startup programs | # User specific environment and startup programs | ||
export PATH=" | export PATH=" | ||
+ | export PERL5LIB=" | ||
# enable color support of ls and also add handy aliases | # enable color support of ls and also add handy aliases | ||
Line 55: | Line 62: | ||
alias egrep=' | alias egrep=' | ||
fi | fi | ||
+ | |||
+ | # some more ls aliases | ||
+ | alias l='ls -lF' | ||
+ | alias ll='ls -alF' | ||
+ | alias lm='ls -alF | more' | ||
# shell command alias | # shell command alias | ||
Line 60: | Line 72: | ||
alias ..='cd ..' | alias ..='cd ..' | ||
alias cd..=' | alias cd..=' | ||
- | alias l='ls -lF' | ||
- | alias lm='ls -lF | more' | ||
- | alias ll='ls -alF | more' | ||
- | </ | ||
- | ===== Secure Shell (SSH) ===== | + | # short cut |
- | ==== Remote Access ==== | + | alias pls='cd ~/ |
- | To login: | + | alias sc='cd /scratch/$USER/' |
- | <code bash> | + | |
- | $ ssh username@host.ip.address | + | |
- | </code> | + | |
- | To logout: | + | # ssh alias for connecting |
- | <code bash> | + | # Academia Sinica |
- | $ exit | + | # hickory |
- | </ | + | export HICKORY='140.109.56.179' |
- | + | alias hickory=' | |
- | ==== Remote Reboot ==== | + | |
- | In the case that you need to reboot a machine remotely, login through '' | + | |
- | <code bash> | + | |
- | sudo shutdown -r now | + | |
- | </ | + | |
- | + | ||
- | ==== Remote Reboot ==== | + | |
- | In the case that you need to shutdown a machine remotely, login through '' | + | |
- | <code bash> | + | |
- | sudo shutdown -P now | + | |
- | </ | + | |
- | + | ||
- | ==== SSH key ==== | + | |
- | === Generate key-pairs === | + | |
- | <code bash> | + | |
- | ssh-keygen -t 'rsa' | + | |
- | </ | + | |
- | === Auto-authentication === | + | |
- | Append | + | |
+ | </ | ||
===== Shell Scripts ===== | ===== Shell Scripts ===== | ||
==== Pack Up Directories ==== | ==== Pack Up Directories ==== | ||
- | <code bash> | + | <file bash tz> |
#!/bin/sh | #!/bin/sh | ||
for x | for x | ||
Line 108: | Line 95: | ||
gzip " | gzip " | ||
done | done | ||
- | </code> | + | </file> |
Line 121: | Line 108: | ||
sudo vsdbutil -a / | sudo vsdbutil -a / | ||
</ | </ | ||
- | |||
tutorials/bash.1294730535.txt.gz · Last modified: 2011/01/11 15:22 by chkuo