0% found this document useful (0 votes)
124 views

Lab2 - OSG202

The document discusses various commands used in operating systems like Linux, Unix, and Windows for directory navigation and manipulation, file operations, searching and compression. It provides examples of using commands like mkdir, ls, cp, mv, rm, cd, pwd, find, grep, gzip and tar.

Uploaded by

tangduyen12345
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
124 views

Lab2 - OSG202

The document discusses various commands used in operating systems like Linux, Unix, and Windows for directory navigation and manipulation, file operations, searching and compression. It provides examples of using commands like mkdir, ls, cp, mv, rm, cd, pwd, find, grep, gzip and tar.

Uploaded by

tangduyen12345
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Tăng Dư Yến - SE171310

OSG202 (Operating Systems)

 Create a directory: mkdir

 View the directory or file: ls or ll


View the hdh directory:

1
Tăng Dư Yến - SE171310
OSG202 (Operating Systems)
View the unix directory:

View the windows 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:

Create the empty file:

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:

View the /etc/passwd and /etc/group 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:

5
Tăng Dư Yến - SE171310
OSG202 (Operating Systems)
 Rename: mv
Rename the windows directory in the openbsd directory to wins:
View the openbsd directory

Copy the thoca.txt directory in the openbsd directory to the freebsd


directory and rename to baitho.doc
View the baitho.doc file:

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

 Delete the empty directory: rmdir


Delete the 2000 directory:

7
Tăng Dư Yến - SE171310
OSG202 (Operating Systems)

 Change to the directory: cd


Change the current directory to the 2003 directory:

Change the current directory to sub directory: cd ..

8
Tăng Dư Yến - SE171310
OSG202 (Operating Systems)

Change to the root directory: cd /

 View the current directory: pwd

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

You might also like