We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now


unix command

negahdar asked
Medium Priority
Last Modified: 2013-12-26
please let me know if there is a difference between:

chmod 776 ~/filename


chmod 776 filename

And what exactly  do I get with

ls -l ~\ filename

Watch Question

Top Expert 2005
> chmod 776 ~/filename # should be: chmod 0776 ~/filename
changes permissions of file 'filename' placed in Your home directory ($HOME/filename)
> chmod 776 filename # should be: chmod 0776 filename
does the same, but it looks for file in current directory (execute 'pwd' to get current dir)
> ls -l ~\ filename # should be 'ls -l ~/filename' or 'ls -l ~/ filename'
first shows long listing fr file 'filename' in Your HOME ir, the second prints long listing of all files in Your HOME (except hidden) and the file 'filename' in current dir.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts


what's the exact meaning for:

chmod 776 ~/filename?

chmod 511 *.c

chmod 711 ~/*

Top Expert 2005

negahdar, I'm answering this, but don't ask for more commands - You should ask in the very first Q

> chmod 776 ~/filename?
changes permissions of files in Your HOME directory (~ stands for $HOME) that maches the pattern filename? - where ? may be any character
> chmod 511 *.c
as above, but looks for files in current dir, and matches all filenames(dirs also) which ends with .c ('.c' matches also)
> chmod 711 ~/*
as above, but matches al filenames(and dirs in fact) in Your $HOME.

Also note, that none of the above will match filenames(dirs) that are hidden. Hidden files/dirs are those which names starts with dot (eg: .hdden_name)
Please read 'man sh' chapter 'Pattern Matching'


OK, thanks a lot.
In your answers,
 what's ir in :
Your HOME ir

Then what is the purpose of adding ? in
chmod 776 ~/filename?
Is it if I have filename1
then it matches filename+ whatever
Top Expert 2005

Your HOME dir - sorry, mispelled
> then it matches filename+ whatever
Yes, but '?' maches one char only (any char), while '*' maches any string (including empty)

Just a bit more comemt to this question

chmod -- change the permissions mode of a file.
to leran more details about the usage and permission, do a:

man chmod

in commandline. that's the best way to learn, and create a dummy file/dir, try all
combination to leran how it work.

>> ls -l ~\ filename # should be 'ls -l ~/filename' or 'ls -l ~/ filename'
.. or ls -l \~filename

negahdar, no offence, but all you question sound like homework
would it not be better if you get a book (paper work) about shell basics? somthing like "sh for dummies"
then spend a few minutes to get used to the very basics of a shell, then you may ask about some special things like ~ which is in fact very special 'cause it depends on the shell and the shells configuration. Same applies to the usage of some other special chars like ? * / \ ' ! $ & and "

experts here really try to help you, but it's wasting time and resources if you ask such basics, in particular when you don't give more details about your used environment (type of OS, shell, etc.)

again: 3 days try&error can save 30 minutes reading ;-)


dear ahoffmann
yes you are rigt ,.....
3 days try&error can save 30 minutes reading
can you send me the name of the book which you suggest to read please?
i tried in amozon.com for that book (which u said a bove ) but i couldn't find it?
can u send me more Details about that book like isbn number , Author or publisher  
oops, my "sh for dummies" was just an example, I hadn't a particular book in mind, sorry for confusion.
I's hard to suggest books for beginners 'cause it depends on your current skill level, may be "UNIX for Dummies Quick Reference" is a good starter, then you can search amazon for "unix shells" and pick what you feel good with.
About shells, there exists one reference which covers most common used shells (bash, csh, ksh, sh, zsh, etc.), but can't remember its title, something like: "Unix shells: csh, bash, ..." ...
Top Expert 2005

> sh for dummies
And I already suggested: man sh # man bash

Have a look at the links in:


or do a serach on the web or EE you can find a lot more
Unix tutorials.

Good night !
Brian BushSolutions Architect

This is a great book about Unix Shell Commands, no matter what your exposure is:

Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.