by LinuxBender · 8y ago · 0 comments
alias fix='reset; stty sane; tput rs1; clear; echo -e "\033c"'
List only directories: alias lsd='ls -h -b --color=auto -d */'
List by size: alias lss='ls -Ao --sort=s'
Hand dyslexia, or the alternate to installing "sl" alias sl=ls
alias xit=exit
alias moer="more"
alias mroe="more"
Long PS alias p="ps -Hefcwww"
Shorthand for disk and memory usage: alias f="df -Ph;free -m"
Bash function to display colors: function colors()
{
for fgbg in 38 48 ; do
for color in {0..256} ; do
echo -en "\e[${fgbg};5;${color}m ${color}\t\e[0m"
if [ $((($color + 1) % 10)) == 0 ] ; then
echo
fi
done
echo
done
}
Functions to do rot13 and rot47 to get around word filters function rot13() { if [ -r $1 ]; then cat $1 | tr '[N-ZA-Mn-za-m5-90-4]' '[A-Za-z0-9]'; else echo $* | tr '[N-ZA-Mn-za-m5-90-4]' '[A-Za-z0-9]'; fi }
function rot47() { if [ -r $1 ]; then cat $1 | tr '\!-~' 'P-~\!-O' ; else echo $* | tr '\!-~' 'P-~\!-O'; fi }
A couple of memory stat functions function memfree() {
free|awk '/^Mem/ {printf "%4.1f",($2-$4-$6-$7)/$2*100}'
}
function memperuser() {
ps aux | awk 'NR != 1 {x[$1] += $4} END{ for(z in x) {print z, x[z]"%"}}'
}No comments yet.