Unix basics 2     System Software                                       Roman Prykhodchenko                            rpr...
Permissions                 $ ls -l /bin/bash       Permissions                Owner group    -rwxr-xr-x               1 r...
Permissions         chown – change owner         Syntax:         chown [-fhv] [-R [-H | -L | -P]] owner[:group] file      ...
Permissions         chgrp – change owner group         Syntax:         chgrp [-fhv] [-R [-H | -L | -P]] group file        ...
Permissions                 $ ls -l /bin/bash                                            Group’s                          ...
Permissions         chmod – change mode         Syntax:         chmod [-fhv] [-R [-H | -L | -P]] mode file          Exampl...
Permissions          Example #2:          ls -l ./ex          -rwxrwxrwx        1 root   wheel   0 Feb   8 06:05 ./ex     ...
Permissions         Digital format                            rwx         7     -wx          3                            ...
File searching         which – checks if file is in PATH          Example:         which ls         /bin/ls         which ...
File searching         whereis – more detailed which. Displays info         about related files.          Example:        ...
File searching         find – searches files.         Searches files in any location.         Mostly used syntax:         ...
File searching         -exec option is used to execute apps with found files.          Replaces ‘{}’ with a file name. Com...
File searching         locate – searches for any part of path.         Searches files in any location but is not limited  ...
Upcoming SlideShare
Loading in …5
×

2 Unix basics. Part 2

728 views

Published on

Permissions, ownership, file search.

Published in: Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
728
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
27
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

2 Unix basics. Part 2

  1. 1. Unix basics 2 System Software Roman Prykhodchenko rprikhodchenko@kture.kharkov.uaTuesday, February 8, 2011
  2. 2. Permissions $ ls -l /bin/bash Permissions Owner group -rwxr-xr-x 1 root wheel 1346544 Feb 11 2010 /bin/bash Owner userTuesday, February 8, 2011
  3. 3. Permissions chown – change owner Syntax: chown [-fhv] [-R [-H | -L | -P]] owner[:group] file Example: ls -l ./ex -rw-r--r-- 1 romcheg staff 0 Feb 8 06:05 ./ex chown root:wheel ./ex ls -l ./ex -rw-r--r-- 1 root wheel 0 Feb 8 06:05 ./exTuesday, February 8, 2011
  4. 4. Permissions chgrp – change owner group Syntax: chgrp [-fhv] [-R [-H | -L | -P]] group file Example: ls -l ./ex -rw-r--r-- 1 romcheg staff 0 Feb 8 06:05 ./ex chgrp wheel ./ex ls -l ./ex -rw-r--r-- 1 romcheg wheel 0 Feb 8 06:05 ./exTuesday, February 8, 2011
  5. 5. Permissions $ ls -l /bin/bash Group’s permissions -rwxr-xr-x Other user’s Type permissions d folder l symbolic link c symbol IO device b block IO device p FIFO s socket Owner’s permissionsTuesday, February 8, 2011
  6. 6. Permissions chmod – change mode Syntax: chmod [-fhv] [-R [-H | -L | -P]] mode file Example: ls -l ./ex -rw-r--r-- 1 root wheel 0 Feb 8 06:05 ./ex chmod ugo+rwx ./ex ls -l ./ex -rwxrwxrwx 1 root wheel 0 Feb 8 06:05 ./exTuesday, February 8, 2011
  7. 7. Permissions Example #2: ls -l ./ex -rwxrwxrwx 1 root wheel 0 Feb 8 06:05 ./ex chmod go-rwx ./ex ls -l ./ex -rwx------ 1 root wheel 0 Feb 8 06:05 ./ex Example #3: ls -l ./ex -rwx------ 1 root wheel 0 Feb 8 06:05 ./ex chmod u-x,go=rw ./ex ls -l ./ex -rw-rw-rw- 1 root wheel 0 Feb 8 06:05 ./exTuesday, February 8, 2011
  8. 8. Permissions Digital format rwx 7 -wx 3 rw- 6 -w- 2 r-x 5 --x 1 r-- 4 --- 0 Example: ls -l ./ex -rw-r--r-- 1 root wheel 0 Feb 8 06:05 ./ex chmod 0755 ./ex ls -l ./ex -rwxr-xr-x 1 root wheel 0 Feb 8 06:05 ./exTuesday, February 8, 2011
  9. 9. File searching which – checks if file is in PATH Example: which ls /bin/ls which -a python /opt/local/bin/python /opt/local/bin/python /usr/bin/python /opt/local/bin//python /opt/local/bin//pythonTuesday, February 8, 2011
  10. 10. File searching whereis – more detailed which. Displays info about related files. Example: whereis ls ls: /bin/ls /usr/bin/ls /usr/share/man/man1/ls.1.gzTuesday, February 8, 2011
  11. 11. File searching find – searches files. Searches files in any location. Mostly used syntax: find [base_path] -[i]name [file_name] Example: find /usr -name README /usr/include/net-snmp/library/README /usr/lib/gcc/i686-apple-darwin10/4.0.1/include/README /usr/lib/gcc/i686-apple-darwin10/4.2.1/include/READMETuesday, February 8, 2011
  12. 12. File searching -exec option is used to execute apps with found files. Replaces ‘{}’ with a file name. Command ends with ‘;’ Example: find /usr -name README -exec cat {} >> ./file.txt ; Outputs all README files to file.txtTuesday, February 8, 2011
  13. 13. File searching locate – searches for any part of path. Searches files in any location but is not limited name. Example: locate bin/ls /var/ftp/bin/ls /bin/ls /sbin/lsmod /sbin/lspci /usr/bin/lsattr /usr/bin/lspgpot /usr/sbin/lsofTuesday, February 8, 2011

×