SlideShare ist ein Scribd-Unternehmen logo
1 von 13
Downloaden Sie, um offline zu lesen
Unix basics 2
     System Software




                                       Roman Prykhodchenko
                            rprikhodchenko@kture.kharkov.ua


Tuesday, February 8, 2011
Permissions
                 $ ls -l /bin/bash

       Permissions                Owner group



    -rwxr-xr-x               1 root   wheel   1346544 Feb 11   2010 /bin/bash




                            Owner user


Tuesday, February 8, 2011
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 ./ex




Tuesday, February 8, 2011
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 ./ex




Tuesday, February 8, 2011
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
                                     permissions

Tuesday, February 8, 2011
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 ./ex




Tuesday, February 8, 2011
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 ./ex


Tuesday, February 8, 2011
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 ./ex



Tuesday, February 8, 2011
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//python




Tuesday, February 8, 2011
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.gz




Tuesday, February 8, 2011
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/README




Tuesday, February 8, 2011
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.txt




Tuesday, February 8, 2011
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/lsof




Tuesday, February 8, 2011

Weitere ähnliche Inhalte

Was ist angesagt?

Unix Basics 04sp
Unix Basics 04spUnix Basics 04sp
Unix Basics 04spDr.Ravi
 
Linux Introduction (Commands)
Linux Introduction (Commands)Linux Introduction (Commands)
Linux Introduction (Commands)anandvaidya
 
Managing your data - Introduction to Linux for bioinformatics
Managing your data - Introduction to Linux for bioinformaticsManaging your data - Introduction to Linux for bioinformatics
Managing your data - Introduction to Linux for bioinformaticsBITS
 
Programming in C Session 4
Programming in C Session 4Programming in C Session 4
Programming in C Session 4Prerna Sharma
 
Nguyễn Vũ Hưng: Basic Linux Power Tools
Nguyễn Vũ Hưng: Basic Linux Power Tools Nguyễn Vũ Hưng: Basic Linux Power Tools
Nguyễn Vũ Hưng: Basic Linux Power Tools Vu Hung Nguyen
 
The structure of Linux - Introduction to Linux for bioinformatics
The structure of Linux - Introduction to Linux for bioinformaticsThe structure of Linux - Introduction to Linux for bioinformatics
The structure of Linux - Introduction to Linux for bioinformaticsBITS
 
UNIX Command Cheat Sheets
UNIX Command Cheat SheetsUNIX Command Cheat Sheets
UNIX Command Cheat SheetsPrashanth Kumar
 
Chap 5 php files part 1
Chap 5 php files part 1Chap 5 php files part 1
Chap 5 php files part 1monikadeshmane
 
File management in C++
File management in C++File management in C++
File management in C++apoorvaverma33
 

Was ist angesagt? (20)

Unix Basics 04sp
Unix Basics 04spUnix Basics 04sp
Unix Basics 04sp
 
File_Management_in_C
File_Management_in_CFile_Management_in_C
File_Management_in_C
 
Linux Introduction (Commands)
Linux Introduction (Commands)Linux Introduction (Commands)
Linux Introduction (Commands)
 
Managing your data - Introduction to Linux for bioinformatics
Managing your data - Introduction to Linux for bioinformaticsManaging your data - Introduction to Linux for bioinformatics
Managing your data - Introduction to Linux for bioinformatics
 
Programming in C Session 4
Programming in C Session 4Programming in C Session 4
Programming in C Session 4
 
Nguyễn Vũ Hưng: Basic Linux Power Tools
Nguyễn Vũ Hưng: Basic Linux Power Tools Nguyễn Vũ Hưng: Basic Linux Power Tools
Nguyễn Vũ Hưng: Basic Linux Power Tools
 
Basic Linux day 1
Basic Linux day 1Basic Linux day 1
Basic Linux day 1
 
The structure of Linux - Introduction to Linux for bioinformatics
The structure of Linux - Introduction to Linux for bioinformaticsThe structure of Linux - Introduction to Linux for bioinformatics
The structure of Linux - Introduction to Linux for bioinformatics
 
File management
File managementFile management
File management
 
Know the UNIX Commands
Know the UNIX CommandsKnow the UNIX Commands
Know the UNIX Commands
 
Basic Linux day 6
Basic Linux day 6Basic Linux day 6
Basic Linux day 6
 
File accessing modes in c
File accessing modes in cFile accessing modes in c
File accessing modes in c
 
Basic linux day 4
Basic linux day 4Basic linux day 4
Basic linux day 4
 
Introduction to linux day1
Introduction to linux day1Introduction to linux day1
Introduction to linux day1
 
File Management in C
File Management in CFile Management in C
File Management in C
 
Piping into-php
Piping into-phpPiping into-php
Piping into-php
 
UNIX Command Cheat Sheets
UNIX Command Cheat SheetsUNIX Command Cheat Sheets
UNIX Command Cheat Sheets
 
Chap 5 php files part 1
Chap 5 php files part 1Chap 5 php files part 1
Chap 5 php files part 1
 
File management in C++
File management in C++File management in C++
File management in C++
 
Introduction to c part 4
Introduction to c  part  4Introduction to c  part  4
Introduction to c part 4
 

Ähnlich wie 2 Unix basics. Part 2

Lession1 Linux Preview
Lession1 Linux PreviewLession1 Linux Preview
Lession1 Linux Previewleminhvuong
 
Linux for CS Majors
Linux for CS MajorsLinux for CS Majors
Linux for CS Majorsworr1244
 
FILE PERMISSION OR ACCESS MODE
 FILE PERMISSION OR ACCESS MODE FILE PERMISSION OR ACCESS MODE
FILE PERMISSION OR ACCESS MODEVpmv
 
Licão 06 process text streams with filters
Licão 06 process text streams with filtersLicão 06 process text streams with filters
Licão 06 process text streams with filtersAcácio Oliveira
 
101 3.3 perform basic file management
101 3.3 perform basic file management101 3.3 perform basic file management
101 3.3 perform basic file managementAcácio Oliveira
 
Linux-Fu for PHP Developers
Linux-Fu for PHP DevelopersLinux-Fu for PHP Developers
Linux-Fu for PHP DevelopersLorna Mitchell
 
Deploying and maintaining your software with RPM/APT
Deploying and maintaining your software with RPM/APTDeploying and maintaining your software with RPM/APT
Deploying and maintaining your software with RPM/APTJoshua Thijssen
 
Unix(introduction)
Unix(introduction)Unix(introduction)
Unix(introduction)meashi
 
03 browsing the filesystem
03 browsing the filesystem03 browsing the filesystem
03 browsing the filesystemShay Cohen
 
04-1-Linux.ppt
04-1-Linux.ppt04-1-Linux.ppt
04-1-Linux.pptEidTahir
 
Tutti i miei sbagli, versione 7 Marzo 2012 al XPUG mi
Tutti i miei sbagli, versione 7 Marzo 2012 al XPUG miTutti i miei sbagli, versione 7 Marzo 2012 al XPUG mi
Tutti i miei sbagli, versione 7 Marzo 2012 al XPUG miAndrea Francia
 
Linux powerpoint
Linux powerpointLinux powerpoint
Linux powerpointbijanshr
 
A Quick Introduction to Linux
A Quick Introduction to LinuxA Quick Introduction to Linux
A Quick Introduction to LinuxTusharadri Sarkar
 
35 ls Command Examples in Linux (The Complete Guide).pdf
35 ls Command Examples in Linux (The Complete Guide).pdf35 ls Command Examples in Linux (The Complete Guide).pdf
35 ls Command Examples in Linux (The Complete Guide).pdfMangesh Dhulap
 

Ähnlich wie 2 Unix basics. Part 2 (20)

Basics of Linux
Basics of LinuxBasics of Linux
Basics of Linux
 
Basic Linux
Basic LinuxBasic Linux
Basic Linux
 
Lession1 Linux Preview
Lession1 Linux PreviewLession1 Linux Preview
Lession1 Linux Preview
 
Linux for CS Majors
Linux for CS MajorsLinux for CS Majors
Linux for CS Majors
 
Linux shell scripting
Linux shell scriptingLinux shell scripting
Linux shell scripting
 
FILE PERMISSION OR ACCESS MODE
 FILE PERMISSION OR ACCESS MODE FILE PERMISSION OR ACCESS MODE
FILE PERMISSION OR ACCESS MODE
 
Licão 06 process text streams with filters
Licão 06 process text streams with filtersLicão 06 process text streams with filters
Licão 06 process text streams with filters
 
Unix Basics Commands
Unix Basics CommandsUnix Basics Commands
Unix Basics Commands
 
101 3.3 perform basic file management
101 3.3 perform basic file management101 3.3 perform basic file management
101 3.3 perform basic file management
 
Linux-Fu for PHP Developers
Linux-Fu for PHP DevelopersLinux-Fu for PHP Developers
Linux-Fu for PHP Developers
 
Deploying and maintaining your software with RPM/APT
Deploying and maintaining your software with RPM/APTDeploying and maintaining your software with RPM/APT
Deploying and maintaining your software with RPM/APT
 
Unix(introduction)
Unix(introduction)Unix(introduction)
Unix(introduction)
 
03 browsing the filesystem
03 browsing the filesystem03 browsing the filesystem
03 browsing the filesystem
 
Linux ppt
Linux pptLinux ppt
Linux ppt
 
04-1-Linux.ppt
04-1-Linux.ppt04-1-Linux.ppt
04-1-Linux.ppt
 
Tutti i miei sbagli, versione 7 Marzo 2012 al XPUG mi
Tutti i miei sbagli, versione 7 Marzo 2012 al XPUG miTutti i miei sbagli, versione 7 Marzo 2012 al XPUG mi
Tutti i miei sbagli, versione 7 Marzo 2012 al XPUG mi
 
Linux powerpoint
Linux powerpointLinux powerpoint
Linux powerpoint
 
A Quick Introduction to Linux
A Quick Introduction to LinuxA Quick Introduction to Linux
A Quick Introduction to Linux
 
QSpiders - Unix Operating Systems and Commands
QSpiders - Unix Operating Systems  and CommandsQSpiders - Unix Operating Systems  and Commands
QSpiders - Unix Operating Systems and Commands
 
35 ls Command Examples in Linux (The Complete Guide).pdf
35 ls Command Examples in Linux (The Complete Guide).pdf35 ls Command Examples in Linux (The Complete Guide).pdf
35 ls Command Examples in Linux (The Complete Guide).pdf
 

Kürzlich hochgeladen

Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...KokoStevan
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfChris Hunter
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterMateoGardella
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfSanaAli374401
 

Kürzlich hochgeladen (20)

Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 

2 Unix basics. Part 2

  • 1. Unix basics 2 System Software Roman Prykhodchenko rprikhodchenko@kture.kharkov.ua Tuesday, February 8, 2011
  • 2. Permissions $ ls -l /bin/bash Permissions Owner group -rwxr-xr-x 1 root wheel 1346544 Feb 11 2010 /bin/bash Owner user Tuesday, February 8, 2011
  • 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 ./ex Tuesday, February 8, 2011
  • 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 ./ex Tuesday, February 8, 2011
  • 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 permissions Tuesday, February 8, 2011
  • 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 ./ex Tuesday, February 8, 2011
  • 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 ./ex Tuesday, February 8, 2011
  • 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 ./ex Tuesday, February 8, 2011
  • 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//python Tuesday, February 8, 2011
  • 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.gz Tuesday, February 8, 2011
  • 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/README Tuesday, February 8, 2011
  • 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.txt Tuesday, February 8, 2011
  • 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/lsof Tuesday, February 8, 2011