Description
answer question on And screen shot and add to word .
Unformatted Attachment Preview
ﻛﻠﻴﺔ اﻟﺤﺎﺳﺐ اﻵﻟﻲ وﻧﻈﻢ اﻟﻤﻌﻠﻮﻣﺎت
COLLAGE OF COMPUTER AND INFORMATION SYSTEM
LAB#4 – Working with files in Linux
LAB OBJECTIVES:
In this lab, you will learn the following:
1. How to work with files in Linux.
a. How to list files in a directory.
b. How to display the type of file
c. How to download a file
d. How to rename a file by using mv command
e. How to change the date on a file
f. How to create a copy of a file into the same directory
g. How to create a copy of a file or set of files from a directory into another directory
h. How to move a set of files to another directory
i. How to remove a directory and all files into it
j. How to rename a file or set of files by using rename command
LAB DURATION:
Two hours.
LAB REQUIREMENT:
PC/Laptop with Linux (Ubuntu) Operating System.
Information System Department.
2023
LAB #3 – Working with directory in Linux
ﻛﻠﻴﺔ اﻟﺤﺎﺳﺐ اﻵﻟﻲ وﻧﻈﻢ اﻟﻤﻌﻠﻮﻣﺎت
COLLAGE OF COMPUTER AND INFORMATION SYSTEM
1. WORKING WITH DIRECTORIES
Exercise 1:
Using the directory and file management commands you have seen in the lectures, to solve the
following question:
Open new terminal
1. List the files in the /bin directory
2. Display the type of file of /bin/cat, /etc/passwd and /usr/bin/passwd. (use file
command )
3. Download UQU_logo.jpg and daleel11.pdf, where UQU_logo from
( https://upload.wikimedia.org/wikipedia/ar/f/ff/UQU_logo.jpg)
and Daleel book form (https://drive.uqu.edu.sa/_/dadregis/files/daleel11.pdf )
4. Display the type of file of UQU_logo.jpg and daleel11.pdf
5. Rename UQU_logo.jpg to UQU_logo.pdf (use mv command).
6. Create a directory ~/newdir and enter it.
7. Create the files today.txt and yesterday.txt in newdir.
8. Change the date on yesterday.txt to match yesterday’s date.
9. Copy yesterday.txt to copy.yesterday.txt
10. Rename copy.yesterday.txt to GoodLuck
11. Create a directory called ~/testbackup and copy all files from ~/newdir into it.
12. Use one command to remove the directory ~/testbackup and all files into it.
Information Technology Skills
1
LAB #3 – Working with directory in Linux
ﻛﻠﻴﺔ اﻟﺤﺎﺳﺐ اﻵﻟﻲ وﻧﻈﻢ اﻟﻤﻌﻠﻮﻣﺎت
COLLAGE OF COMPUTER AND INFORMATION SYSTEM
13. Create a directory ~/etcbackup and copy all *.conf files from /etc into it. Did
you include all subdirectories of /etc ?
14. Use (rename command) to rename all *.conf files to *.backup.
sudo apt install rename
rename ‘s/.conf/.backup/’ *.conf
Command
file
wget
touch -t [yy]yymmddhhmm
file1
ls
ls -al
ls -lh
cd dir
cd
pwd
mkdir dir
rm file
rm -r dir
rm -f file
rm -rf dir
cp file1 file2
cp -r dir1 dir2
mv file1 file2
ln -s file link
touch file
cat > file
exit
Information Technology Skills
Description
Display the type of file
Download file from link
Change the date of creating the file.
Directory listing
To list directory with hidden file
To list directory in human format
Change directory to dir
Change to home
Show current directory
Create a directory dir
Delete file
Force remove directory
Force removes file
Force remove directory dir*
Copy file1 to file 2
Copy dir1 to dir2; it creates dir2 if it does
not exist.
Rename or move file1 to file2 if file2 is
an existing directory. Move file1 into
directory file2
Create or update file
Create or update file
Places input into file
Log out of current session
2
Purchase answer to see full
attachment