0% found this document useful (0 votes)
11 views12 pages

Lab 2 - Ho Dinh Anh

The document describes how to perform various operations in Linux/Unix like creating directories and files, viewing contents, copying, moving, renaming, deleting files and directories, changing directories, searching, zipping and unzipping files. It provides examples of commands like mkdir, ls, cp, mv, rm, cd, pwd, grep, gzip, tar etc and demonstrates their usage.

Uploaded by

anhhdse180670
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)
11 views12 pages

Lab 2 - Ho Dinh Anh

The document describes how to perform various operations in Linux/Unix like creating directories and files, viewing contents, copying, moving, renaming, deleting files and directories, changing directories, searching, zipping and unzipping files. It provides examples of commands like mkdir, ls, cp, mv, rm, cd, pwd, grep, gzip, tar etc and demonstrates their usage.

Uploaded by

anhhdse180670
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

LAB 2 for Operating Systems

Hồ Đình Anh - SE180670


Create a directory: mkdir

View the directory or file: ls or ll


View the hdh directory:

View the unix directory:


View the windows directory:

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 trong nguon chay ra” sentence into thoca.txt:
Create the empty file:

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:
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
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:


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:
Change to the directory: cd
Change the current directory to the 2003 directory:

Change the current directory to sub directory: cd ..

Change to the root directory: cd /


View the current directory: pwd

Searching
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:

Zip or unzip:
Using gzip/gunzip:
Zip the thoca.txt file:
Unzip:
Using tar
Zip the thoca.txt file to the .tar extension:

Checking

You might also like