Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

Name: Huỳnh Chiếm Phương Nguyên – SE180068

Class: SE1814
 man

 Syntax: man [command]

 Purpose: Displays the manual page for a given command.

 Examples:

 man ls - Displays the manual page for the "ls" command, providing information on how
to use it and its options.

 man grep - Shows the manual page for the "grep" command, explaining how to search
text using regular expressions.

 who

 Syntax: who

 Purpose: Displays a list of users currently logged into the system.

 Examples:

 who - Shows a list of currently logged-in users, along with information about their
sessions.

 who -q - Displays only the number of logged-in users.


 date

 Syntax: date [options] [+format]

 Purpose: Displays or sets the system date and time.

 Examples:

 date - Displays the current date and time in the default format.

 date "+%Y-%m-%d %H:%M:%S" - Formats and displays the date and time as "YYYY-MM-
DD HH:MM:SS.
 top
 Syntax (top): top
 Purpose (top): Display real-time system information and processes.
 Examples:

top - Opens a real-time system monitoring tool showing CPU, memory, and process information.

 su

Syntax:
 su [options] [username]: Switch user or superuser.

Examples:

 su nguyenhcp: Switches to user "nguyenhcp".

 kill

Syntax:

 kill [pid]: Terminates a process by process ID.

Examples:

 kill 2873: Terminates the process with PID 2873 forcefully.


The grep command in Linux is used to search for strings in text files. The result will be all lines in the
text.txt file containing the string. If there are no lines containing the string, no results are returned.
The above source code calls the system command "man ls" in the Linux environment using the system()
function in the C programming language.

You might also like