0% found this document useful (0 votes)
2 views2 pages

Script AD-01

The document provides an overview of the chmod and echo commands in Linux and Unix-like systems. It details the syntax, options, and examples for changing file permissions and printing text to standard output. Key points include how to use octal numbers for permissions and enabling escape sequences in echo commands.

Uploaded by

John Brown
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Script AD-01

The document provides an overview of the chmod and echo commands in Linux and Unix-like systems. It details the syntax, options, and examples for changing file permissions and printing text to standard output. Key points include how to use octal numbers for permissions and enabling escape sequences in echo commands.

Uploaded by

John Brown
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Landmark Software Solutions

Linux Batch Shell Scripting on AWS RHL Server with Engr. Kah Kissinger

<<<< Support Material 01 – Batch Shell Scripting >>>>>

===================================================================

Basics of Chmod and echo commands, including their syntax and usage examples

</> chmod command

 Used to change file or directory permissions in Linux and Unix-like systems.

 Controls who can access or modify files and directories.

Syntax: chmod [options] mode file...


1 2 3
1 Options:
 -R: Recursively change permissions for directories and their contents.
 -r: Remove the read permission.
 -w: Remove the write permission.
 -x: Remove the execute permission.
2 Mode:
 A three-digit octal number representing permissions:
o First digit: Permissions for the owner.
o Second digit: Permissions for the group.
o Third digit: Permissions for others.
 Each digit can be a combination of these values:
o 4: Read permission.
o 2: Write permission.
o 1: Execute permission.
3 File… : file_name.ext e.g file.txt

Examples:
1. chmod 777 file.txt # make a file executable for everyone.
2. chmod 600 directory #make a directory readable and writable only by the owner
3. chmod –R 444 directory #recursively make all files in a directory readable by everyone.
</> echo command

 Prints text to the standard output.


 Often used for debugging, displaying messages, or creating simple scripts.
Syntax: echo [options] [string]
1 Options: 1 2
 -e: Enable escape sequences (e.g., \n for new line, \t for tab).
 -n: Do not print a newline character at the end.

Examples:
1. echo “Hello, world!” # Print a message to the console
2. echo “This is a message” #Print a message with a newline
3. echo –n “No newline here” # Print a message without a newline
4. echo “Line 1\n Line 2\tTab” # Use escape sequences.

You might also like