Showing posts with label bash. Show all posts
Showing posts with label bash. Show all posts

Monday, July 2, 2012

seq - print a sequence of numbers

Linux utility to generate sequence of numbers

seq 1 5
1
2
3
4
5

Thursday, December 15, 2011

cd command

Few most useful b commands
cd - # move back to the previous directory
cd ~ # move into your home directory
cd .. # move up one directory

Wednesday, December 14, 2011

Umask

umask is a set of setting default permissions for files or directories that you create on your system.
umask tells the system what permissions to remove from the normal default setting.
umask value can be a three or four digit value.

Global umask value can be change in /etc/bashrc (default value is 0022 or 022).
The extra 0 at the beginning just means that the number is in octal format.
umask can be set temporary using umask command

Example:
umask 077 (Owner - read, write and execute, Group - No Permissions, Others - No Permissions)

How to calculate umasks?
The octal umasks are calculated using bitwise AND of the unary complement of the argument using bitwise NOT. The octal notations are as follows:
Ocatal Value | Permission
0 - read, write and execute
1 - read, write
2 - read, execute
3 - read only
4 - write and execute
5 - write only
6 - execute only
7 - no permissions

Note: Directories must be executable (X) in order to browse them.