mkdir SystemsScripting
Explanation: Creates a new folder called "SystemsScripting".
cd SystemsScripting
mkdir lab01
cd lab01
touch file1.txt file2.txt
Explanation: touch creates empty files.
mkdir folder1 folder2
ls
alias copydir='cp -r'
Explanation: -r allows recursive copying of directories.
alias
copydir folder1 folder1_copy
ls
unalias copydir
alias
mv file1.txt renamed_file.txt
mv file2.txt folder1/
sudo apt-get install gedit
gedit filename.sh
#!/bin/bash
# Display welcome message with username
echo "Welcome $USER to System Scripting Lab 1"
# List contents of home directory
echo "Listing Home Directory:"
ls ~
chmod +x welcome.sh
./welcome.sh
Explanation:
#!/bin/bash → Shebang, defines interpreter$USER → Environment variable for current userls ~ → Lists home directory#!/bin/bash
# Create two folders
mkdir folderA folderB
# Create five files in folderA
touch folderA/file1.txt folderA/file2.txt folderA/file3.txt folderA/file4.txt folderA/file5.txt
# Move three files to folderB
mv folderA/file1.txt folderA/file2.txt folderA/file3.txt folderB/
# Display contents of both folders
echo "Contents of folderA:"
ls folderA
echo "Contents of folderB:"
ls folderB
#!/bin/bash
# Create folders
mkdir folder1 folder2
# Create five files
touch folder1/file{1..5}.txt
# Move all files using globbing (* matches all files)
mv folder1/* folder2/
# Rename folder2
mv folder2 newFolder
# Change into renamed folder
cd newFolder
# Grant read and execute permission to group
chmod g+rx *
# List detailed file info
ls -l
Key Concepts:
* → Matches all files (globbing)chmod g+rx → Adds read & execute permissions to groupls -l → Shows permissions, ownership, size#!/bin/bash
# Ask user for file name
read -p "Enter file name: " filename
# Ask user for destination
read -p "Enter destination folder path: " destination
# Check if file exists in destination
if [ -f "$destination/$filename" ]; then
echo "File already exists in destination."
# Ask for confirmation
read -p "Overwrite? (y/n): " choice
if [ "$choice" == "y" ]; then
mv -f "$filename" "$destination/"
echo "File overwritten successfully."
else
echo "Operation cancelled."
fi
else
mv "$filename" "$destination/"
echo "File moved successfully."
fi
Explanation:
read -p → Takes user input-f → Checks if file existsmv -f → Forces overwriteif statements → Controls logic flowchmod +x before running scriptsmv, cp, and rm*, ?, []ls -l.bashrc