Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 04-25-2011, 08:36 AM   #1
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...

Old 04-25-2011, 09:34 AM   #2
Senior Member
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
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, 10:31 AM   #3
LQ Newbie
Registered: Apr 2011
Posts: 8

Rep: Reputation: 0
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:

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?

Old 04-25-2011, 12:34 PM   #4
Senior Member
Registered: Dec 2008
Location: root
Distribution: Slackware & BSD
Posts: 1,665

Rep: Reputation: 489Reputation: 489Reputation: 489Reputation: 489Reputation: 489
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, 01:32 AM   #5
LQ Newbie
Registered: Apr 2011
Posts: 14

Original Poster
Rep: Reputation: 0

Thanks for all the useful replies. I was just going through the below link:
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, 08:08 PM   #6
Registered: Jun 2003
Location: Washington
Distribution: Fedora, Raspbian, Ubuntu via Chrome/Crouton
Posts: 367

Rep: Reputation: 48
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 08:09 PM.
Old 04-27-2011, 03:05 AM   #7
LQ Newbie
Registered: Apr 2011
Posts: 14

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


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 09:01 AM
echo $PATH = /home/g3rc4n/bin:/usr/local/bin:/usr/bin:/bin:/usr/games ? i_heart_pandas Linux - Software 7 09-18-2009 09:33 AM
Failed to chck remot comnd executin using shells /usr/bin/ssh and /usr/bin/rsh farnaw4u Linux - Software 2 04-06-2009 01:08 AM
NFS, Umask, userid with /bin/sh jxrod2000 Linux - Server 1 09-28-2008 08: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 02:02 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:26 PM.

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