Lab 2
Lab 2
Task 1:
#man
- Displays the manual pages for a specified command. It provides detailed information about how to use
the command, its options, and usage examples.
syntax: man [OPTION…] [COMMAND NAME]…
- Command:
+ man ls:
+ man 5 passwd :
#fg,bg
+ bg command is used to place forceground jobs in background
+ fg command in used to put a background job in foreground
-syntax: bg [job_spec …]; fg [job_spec…]
#who
Shows information about users who are currently logged into the system
Syntax: who[options][filename]
#chown
- Change file ownership and group ownership
- Syntax
chown [OPTION]... [OWNER][:[GROUP]] FILE...
chown [OPTION]... --reference=RFILE FILE...
#chmod
The `chmod` command is used to modify this permission so that it can grant or restrict access to
directories and files.
Syntax:
chmod [options] [mode] [File_name]
chmod a+x [file_name]
It makes a file executable for everyone. It is the most used command after we install an executable
file, we still need to add a permission to actually make it an executable file.
#date
Display the system date and time & is also used to set date and time of the system
Syntax:
date [OPTION]... [+FORMAT]
date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]
- With no options, the date command displays the current date and time, including the abbreviated
day name, abbreviated month name, day of the month, the time separated by colons, the time zone
name, and the year.
-With u option: Displays the time in GMT(Greenwich Mean Time)/UTC(Coordinated Universal Time)
time zone.
#su
su - run a command with substitute user and group ID
Syntax:
su [options] [-] [user [argument...]]
#top
Displays a dynamic and real-time view of system processes and resource usage. It's a powerful tool for
monitoring system performance and identifying resource-intensive processes.
#kill
Syntax: kill [options] [PID]
Purpose: Used to terminate processes by sending signals to them. The most common signal is SIGKILL
(kill -9), which forcefully terminates a process.
#jobs
The jobs command displays the status of jobs started in the current terminal window.
Task 2:
The grep command is utilized to search for and display lines within a text file that match a
specific pattern. In this particular scenario, the file being searched is "thoca.txt," and the pattern
being sought is the phrase "nhu nui." Upon executing the grep command, it systematically scans
the content of "thoca.txt" line by line, seeking any lines that contain the specified string "nhu
nui." Once the search is complete, the command then outputs the lines in "thoca.txt" that
match the specified pattern.
Task 3: