misc.
Customise Command Line Prompt
function prompt
{
local WHITE=”\[\033[1;37m\]”
local GREEN=”\[\033[0;32m\]”
local CYAN=”\[\033[0;36m\]”
local GRAY=”\[\033[0;37m\]”
local BLUE=”\[\033[0;34m\]”
export PS1=”
${GREEN}\u${CYAN}@${BLUE}\h ${CYAN}\w${GRAY}
$ ”
}
prompt
save in .bashrc
Customise Alias Commands
Alias NICKNAME=’full command here’
alias today=’date +”%A, %B %-d, %Y”‘
alias ls=’ls -a’
alias nasdrive=’ssh root@2.221.132.118′
alias myvserver=’ssh root@62.233.83.78′
alias ll=’ls -l’
alias la=’ls -a’
alias rm=’rm -i’
alias df=’df -h’
alias – view all the aliases
alias dus – view a particular alias
\aliasname – temporarily stop using aliases
unalias aliasname – remove an alias
Customise the Welcome Message
clear
echo -e “Lifehacker, the Productivity and Software Guide”
echo -e “”
echo -ne “Today is “; date
echo -e “”; cal ;
echo -ne “Uptime:”;uptime | awk /’up/
{print $3,$4}’
Magento – How to Reset the Admin Password
http://www.redstage.com/magento/blog/2010/03/11/magento-how-to-reset-the-admin-password/
tail -f /var/log/httpd/access_log to view all Ip’s loggin in via ssh
grep -2 -iIr “err\|warn\|fail\|crit” /var/log/* – Get all possible problems from any log files
mkdir <file pathand directory name> && cd $.. – Combine mkdir & cd into single command
ps aux | sort -nk +4 | tail – Display top ten running processes sorted by memory usage
lsof -P -i -n – Display current Internet usage of applications
> file.txt – Empty a file without removing it
curl ifconfig.me – Get your external IP address
history | awk ‘{a[$2]++}END{for(i in a){print a[i] ” ” i}}’ | sort -rn | head – List of commands you use most often
Issues when downloading from Yum
yum clean metadata
yum -y remove yum-fastestmirror