Tuesday 10 October 2017

Alias Command in Unix and Lunix

  • Alias is a shortcut to reference a command. 
  • It can be used to avoid typing long commands that are frequently used.
  • For common patterns it can reduce keystrokes and improve efficiency. 
One best example why we will use alias ?
A user want to delete a file with confirm delete option for that we type
rm -i file.txt
remove file.txt? y
But some time we forgot to write -i , to avoid this such issue we use alias.

CommandDesc
Syntax Of aliasalias [-p] [name="value"]
Example:
aliasIt will show you list of alish which is present in system
alias ls="ls -al"lists the names of the files and directories within the current directory
alias df="df -h"size, amount of space used, amount of space available (-h) in MB and GB
alias rm="rm -i"increasing the safety of the system by making commands interactive. It is use for remove files
alias cp="cp -i"increasing the safety of the system by making commands interactive .It is use for copy files
Removing Aliases
Syntaxunalias [-a] name(s)
Example:unalias rm

No comments:

Post a Comment