Last articles


Bash Jquery Linux php PluXml Raspberry Pi Tools Unix


12 october 2012

List the active alias: alias
Disable all alias: unalias-a
Disable a particular alias: unalias aliasname

Here is a small collection of handy alias:

### Very usefull
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias cdh='cd ~'

alias lt='ls -lhart --color=auto'
alias ll='ls -lF --color=auto'
alias la='ls -alF --color=auto'
alias ls='ls -F'

alias psgb="ps -aux | grep bash"
alias psx="ps -auxw | grep $1"

alias svi='sudo vim'
alias snan='sudo nano'

alias scr='screen -R -D'

alias hcl='history -c; clear'

#Make mount command output pretty and human readable format
alias mount='mount |column -t'

#Show open ports
alias ports='netstat -tulanp'

# if user is not root, pass all commands via sudo #
if [ $UID -ne 0 ]; then
	alias reboot='sudo reboot'
	alias poweroff='sudo poweroff'
	alias halt='sudo /sbin/halt'
	alias shutdown='sudo /sbin/shutdown'

## get meminfo ## 
alias meminfo='free -m -l -t'
## get top process eating memory
alias psmem='ps auxf | sort -nr -k 4'
alias psmem10='ps auxf | sort -nr -k 4 | head -10'
## get top process eating cpu ##
alias pscpu='ps auxf | sort -nr -k 3'
alias pscpu10='ps auxf | sort -nr -k 3 | head -10'

### Debian apt
alias aptu='sudo apt-get update'
alias aptua='sudo apt-get update && sudo apt-get upgrade'
alias apti='sudo apt-get install'
alias aptr='sudo apt-get remove'
alias apts='apt-cache search'

## shortcut  for iptables and pass it via sudo#
# display all rules #
alias iptlist='sudo /sbin/iptables -L -n -v --line-numbers'
alias iptlistin='sudo /sbin/iptables -L INPUT -n -v --line-numbers'
alias iptlistout='sudo /sbin/iptables -L OUTPUT -n -v --line-numbers'
alias iptlistfw='sudo /sbin/iptables -L FORWARD -n -v --line-numbers'
alias firewall=iptlist

###   Handy Extract Program
extract () {
   ee() { # echo and execute
       echo "$@"
       $1 "$2"
   for x in "$@"; do
       [[ -f $x ]] || continue
       case "$x" in
           *.tar.bz2 | *.tgz )    	ee "tar xvjf" "$x"    ;;
           *.tar.gz | *.tbz2 )    	ee "tar xvzf" "$x"    ;;
           *.bz2 )                	ee "bunzip2" "$x"     ;;
           *.rar )                	ee "unrar x" "$x"     ;;
           *.gz )                 	ee "gunzip" "$x"      ;;
           *.tar )                	ee "tar xvf" "$x"     ;;
           *.zip )                	ee "unzip" "$x"       ;;
           *.Z )                  	ee "uncompress" "$x"  ;;
           *.7z )                 	ee "7z x" "$x"        ;;

### This piece of code lists the size of every file and subdirectory of the current directory,
### much like du -sch ./* except the output is sorted by size, 
###with larger files and directories at the end of the list. 
###Useful to find where all that space goes. 
dusa ()
   du -a --max-depth=1 | sort -n | awk '{
               if (size >= 1024)
                       size = size /1024;
               if (size >= 1024)
                       size = size /1024;
               printf "%6.1f%s %s\n",  size, unit, $0;

export HISTFILESIZE=5000              # Larger history
export CLICOLOR=1                     # Use colors (if possible)
export LSCOLORS=ExGxFxdxCxDxDxBxBxExEx 

Classified in : Homepage, Unix - Tags : Unix, Linux, Bash

1 comment

thursday 08 june 2017 @ 09:35 best essay writing essay said : #1

Everything is very open with a very clear description of the challenges.It was truly informative. Your website is extremely helpful. Many thanks for sharing!

Write a comment

What is the last letter of the word zlsaj? : 

Last articles