linux command part2
Download
Skip this Video
Download Presentation
Linux Command – part2

Loading in 2 Seconds...

play fullscreen
1 / 15

Linux Command – part2 - PowerPoint PPT Presentation


  • 65 Views
  • Uploaded on

Linux Command – part2. Changing to a different directory. % cd Will take you to the parent % cd / This command will take you to the root directory (cygwin. Environment variables : . where the shell stores information that may be useful to the user’s shell session.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Linux Command – part2' - abena


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
changing to a different directory
Changing to a different directory
  • % cd

Will take you to the parent

  • % cd /

This command will take you to the root directory (cygwin

environment variables
Environment variables :

where the shell stores information that may be useful to the user’s shell session.

Examples of environment variables include:

  • HOSTNAME=localhost
  • SHELL=/bin/bash
  • HOME = your home

To print the variable value, Type:

echo $SHELL

reading manual
Reading manual
  • man = manual

$man

With the man command, you can retrieve the information in the manual and display it as text output on your screen. To use the man command.

  • IF you want to read a manual for ls command, type:

$ man ls

To exit from the manual page, simply press Q

file permission
File permission
  • Keep users from accessing other users’ private files
  • To protect important system files
  • permissions bits

rwxrwxrwx

Owner’s| Group | Others

r = read w = write x = execute

file permission cont
File permission (cont.)

For Files:

    • "Read" means to be able to open and view the file
    • "Write" means to overwrite or modify the file
    • "eXecute" means to run the file as a binary files are executable only if they are programs and shell scripts, not useful for data files.

For Directories:

    • "Read" means to be able to view the contents of the directory
    • "Write" means to be able to create new files/directories or delete files/directories within the directory
    • "eXecute" means to be able to "Change Directory" (cd) into the directory = permission to access the directory.
  • How to view the permission for a file or directory?
    • $ ls -al
file permission cont1
File permission (cont.)

For Files:

    • "Read" means to be able to open and view the file
    • "Write" means to overwrite or modify the file
    • "eXecute" means to run the file as a binary files are executable only if they are programs and shell scripts, not useful for data files.

For Directories:

    • "Read" means to be able to view the contents of the directory
    • "Write" means to be able to create new files/directories or delete files/directories within the directory
    • "eXecute" means to be able to "Change Directory" (cd) into the directory = permission to access the directory.
  • How to view the permission for a file or directory?
    • $ ls -al
file permission cont2
File permission (cont.)
  • Only the owner of a file can change its permission.
  • How to set file permission?
    • Use the command chmod(change file mode bits).
  • chmod has two notations:
    • Numeric(octal) notation.
    • Symbolic notation.
change permission on a file numeric
Change permission on a file - numeric
  • the file permissions aren\'t represented by characters. Instead, they are represented by a three-digit octal number.
  • 4 = read (r)2 = write (w)1 = execute (x)0 = no permission (-)

If the permission is

725

4+2+1

0+2+0

4+0+1

r-x

rwx

-w-

change permission on a file symbolic
Change permission on a file – symbolic
  • Permissions are represented by characters rwx
  • This gives “who” the specified permissions for a given filename.
  • The “who” is a list of letters re going to be giving permissions to. These may be specified in any order.
  • +  add the selected permission.
  • -  remove the selected permission.
change permission on a file
Change permission on a file

For r, w, x octal value is 4,2,1 respectively

owner(u) group(g) other(o) all(a)rwxrwxrwx

owner(u) group(g) other(o) all(a)---------

using file matching metacharacters this matches any one of the characters between the brackets
Using file-matching metacharactersThis matches any one of the characters between the brackets […]
echo command
Echo command
  • Use echo command to display text or value of variable.
  • "Double Quotes“
    • literally print everything inside the single quote. Even the special variables such as $HOSTNAME will be print as $HOSTNAME
  • \'Single quotes‘
    •  display the real meaning of special variables
  • `Back quote`
    • Used with commands only.
    • To execute command
ad