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?
> 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.
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'
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

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:

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.