unix command

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

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

> 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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
negahdarAuthor Commented:
what's the exact meaning for:

chmod 776 ~/filename?

chmod 511 *.c

chmod 711 ~/*

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'
Bootstrap 4: Exploring New Features

Learn how to use and navigate the new features included in Bootstrap 4, the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites.

negahdarAuthor Commented:
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
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 ;-)
negahdarAuthor Commented:
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, ..." ...
> 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 ArchitectCommented:
This is a great book about Unix Shell Commands, no matter what your exposure is:

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.