• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1806
  • Last Modified:

unix command

please let me know if there is a difference between:

chmod 776 ~/filename

and

chmod 776 filename


And what exactly  do I get with

ls -l ~\ filename

Thanks
0
negahdar
Asked:
negahdar
  • 4
  • 3
  • 2
  • +2
1 Solution
 
ravenplCommented:
> 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.
0
 
negahdarAuthor Commented:
what's the exact meaning for:

chmod 776 ~/filename?

chmod 511 *.c

chmod 711 ~/*

Thanks
0
 
ravenplCommented:
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'
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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
filename2...
then it matches filename+ whatever
0
 
ravenplCommented:
Your HOME dir - sorry, mispelled
> then it matches filename+ whatever
Yes, but '?' maches one char only (any char), while '*' maches any string (including empty)
0
 
yuzhCommented:
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.

0
 
ahoffmannCommented:
>> 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 ;-)
0
 
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  
thanks
0
 
ahoffmannCommented:
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, ..." ...
0
 
ravenplCommented:
> sh for dummies
And I already suggested: man sh # man bash
0
 
yuzhCommented:
Have a look at the links in:

http:Q_20626712.html
http:Q_20665909.html
http:Q_20684016.html

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

Good night !
0
 
Brian BushSolutions ArchitectCommented:
This is a great book about Unix Shell Commands, no matter what your exposure is:
http://www.amazon.com/gp/product/0672324903/sr=8-8/qid=1143818332/ref=pd_bbs_8/104-9973086-0983938?%5Fencoding=UTF8

--brian
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 4
  • 3
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now