Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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...
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?
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?
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.