alias in unix

alias is probably the best option in order to save key strokes.

to make an alias
suppose I want to open htdocs folder which is in /Application/MAMP/htdocs/ , but for that i have to type few lines in terminal. But by making an alias it can be done with only one small word. To do so, just type this line in the terminal.
alias ht='open /Applications/MAMP/htdocs/'

to see the alias
just type
alias

to remove all aliases
unalias -a

to remove a specific one
unalias [name of the alias]

Advertisements

chmod – change file/folder permission in ubuntu

sample command:

 sudo chmod 754 /opt/lampp/htdoc

chmod command sets the permission of a file or folder. chmod command uses three digit code as an argument and the file or folder location.

In the example,

  • 7 – Owner(current user)
  • 5 – Group(set by owner)
  • 4 – anyone else

The fundamental concept:

Execute is 1, Write is 2 and Read is 4.

Sum of these basic ones makes combination of permissions:

  • 0 – no permission, this person cannot read, write or execute
  • 1 – execute only
  • 2 – write only
  • 3 – execute and write only (1 + 2)
  • 4 – read only
  • 5 – execute and read only (1 + 4)
  • 6 – write and read only (2 + 4)
  • 7 – execute, write and read (1 + 2 + 4)

source: online