In: Computer Science
What are the UNIX commands for each of these steps?
1. Delete all the files in the Classes and Backup directories
only.
2. Redirect echo step 23 to mark this step in the lab3.txt
file
3. Display all of the directories and sub-directories including
files so I can verify you completed all the
steps correctly.
4. Repeat the above step and redirect the output to the file
lab3.txt without erasing what is already in it!
5. Redirect echo step 26 to mark this step in the lab3.txt file
1. If you want to remove everything in Classes and Backup then use
following command
rm /path/to/dir/*
example :
To delete everything in Classes directory use command
: rm /home/Classes/*
To delete everything in Backup directory use command :
rm /home/Backup/*
Also if you want remove all sub-directories and files inside Classes and Backup then use following commands
rm -r /home/Classes/*
rm -r /home/Backup/*
2. Redirect echo step 23 to mark this step in the lab3.txt file
Here you are saying Redirect echo step 23 to mark this step in the lab3.txt file I am assuming that I have to echo step 23 to file lab3.txt
To do that you can use following command:
echo step 23 > lab3.txt
Additionally now if you want to see the contents of lab3.txt then use cat command as : cat lab3.txt
3. Display all of the directories and sub-directories including
files so I can verify you completed all the steps correctly.
the command use to display all of the directories and
sub-directories including files is "ls"
just type "ls" you can see all the directories and sub-directories including files.
4. Repeat the above step and redirect the output to the file
lab3.txt without erasing what is already in it!
If you want to append to a file you have to use >>. So your
examples would be
ls >> lab3.txt
5. Redirect echo step 26 to mark this step in the lab3.txt
file
This is same as command no 2.
echo step 26 > lab3.txt