Lab2 - OSG202
Lab2 - OSG202
1
Tăng Dư Yến - SE171310
OSG202 (Operating Systems)
View the unix directory:
2
Tăng Dư Yến - SE171310
OSG202 (Operating Systems)
Create a file: there are many ways to create a file
- Create the file with name thoca.txt with contents “Cong cha nhu nui thai
son” located at 98 directory:
- Adding the “Nghia me nhu nuoc trng nguon chay ra” sentence into
thoca.txt:
3
Tăng Dư Yến - SE171310
OSG202 (Operating Systems)
View the file content: using any command as cat, more, less, tail,
…
View the thoca.txt file:
4
Tăng Dư Yến - SE171310
OSG202 (Operating Systems)
Copy a file/ directory: cp
Copy the thoca.txt file to the linux directory:
Copy the windows directory to linux directory:
View the linux directory:
Move objects: mv
Move the thoca.txt file in the linux library to the openbsd library:
Move the windows directory to penbsd directory:
Rename: mv
5
Tăng Dư Yến - SE171310
OSG202 (Operating Systems)
Rename the windows directory in the openbsd directory to wins:
View the openbsd directory
6
Tăng Dư Yến - SE171310
OSG202 (Operating Systems)
Delete a file: rm
Delete the thoca.txt file in openbsd directory
If wanting to delete without asking before, the option (–f) is used
To delete the directory, the option (-rf) is used
7
Tăng Dư Yến - SE171310
OSG202 (Operating Systems)
Change to the directory: cd
Change the current directory to the 2003 directory:
8
Tăng Dư Yến - SE171310
OSG202 (Operating Systems)
Change to the root directory: cd /
9
Tăng Dư Yến - SE171310
OSG202 (Operating Systems)
Searching: find, grep, whereis, which
Search the thoca.txt file:
Search the “Cong cha nhu nui thai son” sentences in the thoca.txt file
Search the location, source and man page of the grep command:
Search the directory that contain the ls command:
10
Tăng Dư Yến - SE171310
OSG202 (Operating Systems)
Zip or unzip: gzip/ gunzip, zip/unzip, tar
- Using gzip/gunzip:
Zip the thoca.txt file
Unzip
- Using tar
Zip the thoca.txt file to the .tar extension:
Checking
11
Tăng Dư Yến - SE171310
OSG202 (Operating Systems)
Zip the thoca.txt file to the .tar.gz extension:
Checking
Unzip .tar
Unzip .tar.gz
12