1.a.basic Linux Command
1.a.basic Linux Command
a)
Aim :-
Study of Basic Linux Commands: echo, ls, read, cat, touch, test, loops, arithmetic
comparison, conditional loops, grep, sed.
Objective:
The objective of a practical studying basic Linux commands and related concepts such as
loops, arithmetic comparisons, and conditional statements includes:
Understanding Command-Line Operations: Gain proficiency in executing fundamental Linux
commands like echo, ls, read, cat, touch, test, grep, and sed to manipulate files, display
content, and search text.
Exploring Shell Scripting: Learn to create scripts incorporating loops and conditional
statements (if, while, for) to automate tasks and perform operations based on conditions.
Mastering Text Processing: Develop skills in using grep and sed for efficient text search and
manipulation within files or output streams.
Theory:-
echo
echo "Hello, world!"
ls
ls -l # Long listing format
read
echo "Enter your name: "
read name
cat
cat file.txt
touch
touch newfile.txt
Creates an empty file or updates the access and modification times of a file.
test
if test -f /path/to/file; then
Fi
Loop
Iterates over a list of items or based on a condition.
# For loop
for i in {1..5}; do
done
# While loop
counter=0
((counter++))
done
Arithmetic Operator
result=$((5 + 3))
Conditinal Loop
counter=1
# This loop will run as long as the counter is less than or equal to 5
do
done
grep
grep "pattern" file.txt