LINUX
SHELL
Msc. Edona Zeneli
Coping files and directories: cp Prints the information inside a file:
–r cat
Rename files and directories: Highlights the information inside
mv a file: grep
2
TEST COMMAND
string1 = string2: checks if 2 strings are equal or not
string1 != string2: checks if 2 strings are not equal
-n string: checks if the string is empty and returns 1 for empty
num1 -eq num2: Checks whether two numbers are equal or not.
And returns 0 if the two numbers are equal and returns 1 if the two
numbers are not equal.
num1 -ne num2: Checks whether two numbers are not equal or
not. And returns 0 if the two numbers are not equal and returns 1 if
the two numbers are equal.
num1 -gt num2: Checks whether the first number is greater than
the second number or not. Returns 0 if the first number is greater
than the second number and returns 1 if the first number is not
greater than the second number.
3
num1 -ge num2: Checks whether the first number is greater than
or equal to the second number or not. And returns 0 if the first
number is greater than or equal to the second number and returns
1 if the first number is not greater than or equal to the second
number.
num1 -lt num2: Checks whether the first number is less than the
second number or not. And returns 0 if the first number is less than
the second number and returns 1 if the first number is not less than
the second number.
num1 -le num2: Checks whether the first number is less than or
equal to the second number or not. And returns 0 if the first number
is less than or equal to the second number and returns 1 if the first
number is not less than or equal to the second number.
4
5
VARIABLE
• Integer a=1
• Float a=1.1
• String a=“Hi”
6
SHELL SCRIPTS
• A single command line or a set of commands can
be stored in a file.
• The file must have the appropriate permission to
be executable.
• Shell script commands are stored in a file which
has the suffix .sh but which is not necessary!
7
FILE EXECUTION
• ./[Link]
• sh [Link]
• bash [Link]
8
OPEN A FILE THROUGH
TERMINAL
nano filename
9
10
READ A VARIABLE THROUGH
TERMINAL
11