LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-25-2011, 07:36 AM   #1
linux_user2011
LQ Newbie
 
Registered: Apr 2011
Posts: 14

Rep: Reputation: 0
umask and /usr/bin/umask


Not sure if this is the right place to ask this question. In Solaris we have umask (shell builtin) and /usr/bin/umask. However I could not find /usr/bin/umask in Linux.
I want to know the difference between both and how can we achieve the functionality of /usr/bin/umask in Linux as its not there...

Thanks!
 
Old 04-25-2011, 08:34 AM   #2
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,817

Rep: Reputation: 610Reputation: 610Reputation: 610Reputation: 610Reputation: 610Reputation: 610
I'm reading the man page for umask on Solaris 10, and I don't see the difference between it and the shell-builtin umask. What functionality isn't there?
 
Old 04-25-2011, 09:31 AM   #3
Franciozzy
LQ Newbie
 
Registered: Apr 2011
Posts: 8

Rep: Reputation: 0
Quote:
Originally Posted by linux_user2011 View Post
In Solaris we have umask (shell builtin) and /usr/bin/umask.
I believe most Linux distributions will only provide the built in umask. I've checked Debian Squeeze (bash 4.1.5(1)) and the manual page goes as follows:


Code:
umask [-p] [-S] [mode]
              The user file-creation mask is set to mode. If mode begins with a digit, it is interpreted
              as an octal number; otherwise it is interpreted as a symbolic mode mask similar to that
              accepted by chmod(1). If mode is omitted, the current value of the mask is printed.
              The -S option causes the mask to be printed in symbolic form; the default output is an
              octal number. If the -p option is supplied, and mode is omitted, the output is in a form
              that may be reused as input.  The return status is 0 if the mode was successfully changed
              or if no mode argument was supplied, and false otherwise.
I've compared that to OSX (10.6.7) /usr/bin/umask and it looks like the exact same set of parameters. Are you looking for any other resource that doesn't seem to be available on the bash's builtin?

Cheers
 
Old 04-25-2011, 11:34 AM   #4
malekmustaq
Senior Member
 
Registered: Dec 2008
Location: root
Distribution: Slackware & BSD
Posts: 1,617

Rep: Reputation: 442Reputation: 442Reputation: 442Reputation: 442Reputation: 442
Quote:
I want to know the difference between both and how can we achieve the functionality of /usr/bin/umask in Linux as its not there...
We and you, are achieving the same "functionality" even if we don't find it in the bin. Simply in most linux systems the umask is set 0022 automatically somewhere when the system goes up. You can find it in the /etc/profile, you can even set or change it in the .bashrc or anywhere you like.

The functionality of controlling the umask can be achieved easily within or without the terminal, which I assume you know already this time.
 
Old 04-26-2011, 12:32 AM   #5
linux_user2011
LQ Newbie
 
Registered: Apr 2011
Posts: 14

Original Poster
Rep: Reputation: 0
Hi,

Thanks for all the useful replies. I was just going through the below link:
link http://www.uncarved.com/blog/umasks.mrk
It says umask is shell builtin and when running /usr/bin/umask, the shell creates a copy of itself and run it from there. Running umask in Solaris box gives 0022 and /usr/bin/umask gives 022. I was confused whether 022 and 0022 both same and why the output is different.

Please help.
 
Old 04-26-2011, 07:08 PM   #6
pwalden
Member
 
Registered: Jun 2003
Location: Washington
Distribution: Fedora FC23, Raspbian, Ubuntu Precise via Chrome/Crouton
Posts: 356

Rep: Reputation: 43
As I recall my old Unix lessons, commands like cd and umask are built-ins because they have to execute within the shell and alter the ENV of the shell such that other commands forked from the shell will then inherit the shell's altered ENVironment. Whereas most other Unix commands were (originally) separate executeables that were forked from the shell inheriting the ENViroment.

The shell was really just; a simple shell that just forked other separate commands. However, any command that had to change the shell ENVironment, had to be a built-in.

Last edited by pwalden; 04-26-2011 at 07:09 PM.
 
Old 04-27-2011, 02:05 AM   #7
linux_user2011
LQ Newbie
 
Registered: Apr 2011
Posts: 14

Original Poster
Rep: Reputation: 0
Thanks pwalden for the useful information!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
umask and permissions: has umask 007 bad side effects? browny_amiga Linux - General 2 09-09-2011 08:01 AM
echo $PATH = /home/g3rc4n/bin:/usr/local/bin:/usr/bin:/bin:/usr/games ? i_heart_pandas Linux - Software 7 09-18-2009 08:33 AM
Failed to chck remot comnd executin using shells /usr/bin/ssh and /usr/bin/rsh farnaw4u Linux - Software 2 04-06-2009 12:08 AM
NFS, Umask, userid with /bin/sh jxrod2000 Linux - Server 1 09-28-2008 07:37 PM
path in services wrong for clamav updated frm 0.75 to 0.80 usr/bin vs usr/local/bin Emmanuel_uk Linux - Newbie 3 04-22-2005 01:02 AM


All times are GMT -5. The time now is 12:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration