-
Create a new directory named
project_files
in your home directory:mkdir ~/project_files
-
Inside
project_files
, create three directories:reports
,logs
, anddata
:mkdir ~/project_files/reports ~/project_files/logs ~/project_files/data
-
Navigate to the
reports
directory and create two files:report1.md
andreport2.md
:touch ~/project_files/reports/report1.md ~/project_files/reports/report2.md
-
Navigate to the
logs
directory and create four files:system.log
,error.log
,file1.pdf
, andfile2.pdf
:touch ~/project_files/logs/system.log ~/project_files/logs/error.log ~/project_files/logs/file1.pdf ~/project_files/logs/file2.pdf
-
In the
data
directory, create a text file nameddata.csv
and another namedinfo.txt
:touch ~/project_files/data/data.csv ~/project_files/data/info.txt
-
Use the
nano
text editor to add some random content toreport1.md
,system.log
, anddata.csv
:nano ~/project_files/reports/report1.md nano ~/project_files/logs/system.log nano ~/project_files/data/data.csv
-
Archive all files in the
logs
directory into a tar archive namedlogs_backup.tar
:tar -cvf ~/project_files/logs_backup.tar ~/project_files/logs/file1.pdf ~/project_files/logs/file2.pdf ~/project_files/logs/system.log ~/project_files/logs/error.log
OR
cd ~/project_files/logs/ tar -cvf logs_backup.tar *
-
Move
logs_backup.tar
to theproject_files
directory:mv ~/project_files/logs/logs_backup.tar ~/project_files/
-
Extract the
logs_backup.tar
archive back into thelogs
directory:tar -xf ~/project_files/logs_backup.tar -C ~/project_files/logs
-
Find and list all files with the
.md
extension starting from the home directory(~)
using thefind
command:find ~ -name "*.md"
-
Search for all files ending with
.log
in theproject_files
directoryfind ~/project_files -name "*.log"
-
Search for all files named
file1.pdf
in theproject_files
directory.find ~/project_files -name "file1.pdf"
-
Search for all files with the
.pdf
extension in theproject_files
directory, ignoring case.find ~/project_files -iname "*.pdf"
-
Search for all regular files (not directories) in the
logs
directory.find ~/project_files/logs -type f
-
Create a symbolic link for
data.csv
namedlink_data.csv
in theproject_files
directory:ln -s ~/project_files/data/data.csv ~/project_files/link_data.csv
-
Modify
link_data.csv
and verify if the changes are reflected indata.csv
:nano ~/project_files/link_data.csv cat ~/project_files/data/data.csv
-
Delete the symbolic link
link_data.csv
:rm ~/project_files/link_data.csv
-
Create a file named
summary.txt
in theproject_files
directory and redirect the output ofecho "Summary Start"
to it:echo "Summary Start" > ~/project_files/summary.txt
-
Append the current date and time to
summary.txt
:date >> ~/project_files/summary.txt
-
Use a pipeline to count the number of lines in
summary.txt
and display it, appending the result tosummary.txt
with thetee
command:wc -l ~/project_files/summary.txt | tee -a ~/project_files/summary.txt
-
Count the number of words in
report1.md
and display it:wc -w ~/project_files/reports/report1.md
-
Count the number of characters in
system.log
and append the result tosummary.txt
:wc -c ~/project_files/logs/system.log >> ~/project_files/summary.txt
-
Count the total number of files and directories in
project_files
and append the result tosummary.txt
:find ~/project_files | wc -l >> ~/project_files/summary.txt
-
Display the contents of
summary.txt
:cat ~/project_files/summary.txt