Bidvertiser

Monday, May 20, 2013

Few must know unix commands

After spending more than 9 years of my life in microsoft os,  I feel great now to use my Mac notebook.  Especially I have fallen in love with the terminal and thrilled to learn the power of unix.  I curse myself for not being an unix user so far. Well, its never late to start. :-)

As a beginner I thought of sharing my learnings to my fellow unix beginners with few basic commands that you "must" know as an unix user.

Few basic "must" know unix commands

1. ls - list files and folders

What is ls?  A command to list all files and folders in a directory.
Usage: ls [-ABCFGHLOPRSTUWabcdefghiklmnopqrstuwx1] [file ...]

Explaining few commonly used parameters of lsls command args

2. pwd - present working directory

What is pwd?  A command to display the present working directory path.
Usage: pwd

3. chmod - file permissions changer

What is chmod?  A command to display the present working directory path.
Usage:  chmod arguments file
Permissions to a file can be of the following three categories,
  1. Read
  2. Write
  3. Execute
Let me try explaining this using numeric permissions,

Read

400 - read permission to owner
040 - read permission to group
004 - read permission to anybody

Write

200 - write permission to owner
020 - write permission to group
002 - write permission to anybody

Execute

100 - execute permission to owner
010 - execute permission to group
001 - execute permission to anybody

All permissions are in 3 digits,
xyz - indicates owner
xyz - indicates group
xyz - indicates anybody

For example:
chmod 777 filenmae means read-write-execute (full) permissions for anybody to the file.
chmod 644 filename means read and write permission to owner and read access to rest of the users to the file specified.
chmod 755 filename means read-write-execute permissions to owner and read and write access to others for the specified file.

The best way to learn any unix command is to do a "man" of that command.  For ex: man ls

No comments:

Post a Comment