LINUX BASICS (312001) PRACTICAL NO 3 ANSWERS K SCHEME
![]() |
LINUX BASICS (312001) PRACTICAL NO 3 ANSWERS K SCHEME |
Experiment No 03: Execute general-purpose Linux commands
Practical Significance:
General purpose commands are inbuilt programs that can be invoked in multiple ways. These commands work interactively from a terminal. A terminal that provides a command line interface using a shell program.
Program code
1. Write down different options of kill command
Answer:
- kill PID
- kill -SIGNAL PID
- kill PID1 PID2 PID3...
- killall NAME
- kill -9 -1 (use with caution)
2.Write options of uname command.
Answer:
-a (or --all): Print all available information (equivalent to specifying all options -snrvmo).
-s (or --kernel-name): Print the kernel name.
-n (or --nodename): Print the system's hostname.
-r (or --kernel-release): Print the kernel release number.
-v (or --kernel-version): Print the kernel version.
-m (or --machine): Print the machine's hardware name (architecture).
-p (or --processor): Print the processor type (architecture).
-i (or --hardware-platform): Print the hardware platform type.
-o (or --operating-system): Print the operating system name.
Result(s)
We successfully gain knowledge about different options for kill commands in Linux.
Practical related questions
3. Name the command which terminate the process
Answer:
kill: This is the most basic command for sending termination signals to processes. It needs the process ID (PID) of the process you wish to terminate. By default, it sends a SIGTERM signal, which asks the process to stop smoothly. You can also define a different signal with the -signal option.
killall: This command terminates all processes with a distinct name. Be cautious using this command, as it can terminate numerous processes at once, potentially disrupting your system.
5. Write a command for full listing of all running process with output
Answer:
- ps -ef
ps: stands for process status
-e: shows all processes (equivalent to -A for all processes)
-f: provides a full listing format with various details about each process
- ps aux
ps: stands for process status
-a: shows all processes (similar to -e or -A)
-u: displays processes in a user-oriented format
6. Write use of passwd command.
Answer:
The passwd command changes the login password or password phrase for the user ID determined. If user-id is omitted, the login name associated with the existing terminal is used. You are prompted for the new password or password phrase.
7. To delay process for specific time command used is ______________ (ps/sleep).
Answer: sleep
The ps command is used to display information about running processes, not to delay them.
Example : sleep 10 ; your_command
Exercise:
What is output of following commands?
1. ps -f
UID PID PPID C STIME TTY TIME COMMAND
root 1 0 0 Feb11 ? 00:00:00 systemd
root 2 0 0 Feb11 ? 00:00:00 kthreadd
root 3 2 0 Feb11 ? 00:00:00 rcu_gp
... (many more lines)
user100 1234 567 0 Feb11 pts/0 00:00:00 bash
user100 1235 1234 0 Feb11 pts/0 00:00:00 sleep 10 # Example command being delayed
2. whoami
3. uname -s
Linux (Operating system name)