Linux Practical Assignment
Linux Practical Assignment
(Basic Commands)
Q1. Explain the following commands and give an example on how to use all the flags.
man
info
help
whatis
apropos
whoami
echo
hostname
uname
tty
aliase
Linux Assignment 2
(Directory and file commands)
29/08/2024
Q1. Explain what each of the following commands does and give an example on how to use
it:
touch
ls
rm
cat
cp
mkdir
pwd
cd
Q2. What each of the following commands does?
1) cd /
2) cd ~
3) cd
4) cd ..
5) cd .
6) cd -
Q3. Specify which command would you use (and how) for each of the following scenarios
Create a new directory
Remove a directory with files
Display the content of a file
Change working directory to user home directory
Check the current working directory
How to count the number of lines in a file? What about words?
List three ways to print all the files in the current directory
Q1. What is the purpose of ps command. Explain all the output parameters of the ps
command with example : PID, TTY, TIME, CMD. Explain all flags used with ps command
and what will be the output.
Q2. Explain the use of ps aux command.
a - all users
u - shows the user/owner
x - displays processes not executed in the terminal (making the output rather long)
Q3. What is the purpose of top command. Explain all the output parameters of the top
command with example : PID, User, PR, NI, VIRT, RES, SHR, S: (mention different state of
the process), %CPU, %MEM, TIME+, Command.
Q4. What is the purpose of kill and killall command. Describe all the flags used with kill
command with example.
Q5. Run the given command : killall sleep
What is the output of this command?
Q6. What is the purpose of nice and renice command. Explain all parameters passed with
both the commands with example.
Q7. Explain the bg and fg command and its parameter.
Q8. Execute the following commands on Linux Terminal.
i) Find all the running process on your system
ii) Find currently running process with ps command.
iii) Kill two of the process referring to the PID mentioned in previous outputs.
iv) Change the priority of any two and view the changes with top command.
v) Show the use of bg, fg command.
vi) Run ps aux command where a - all users, u - shows the user/owner, x - displays
processes not executed in the terminal (making the output rather long)
vii) Set priority as -10 for gnome-terminal command.
viii) Reset the priority of earlier command after checking its PID to -2.
Linux Assignment 4
(File Permission Commands)
Q1. Create a file group.txt and check its file permissions and find the group to which your file
belongs.
Q2. Find all the groups in your system.
Q3. Change the group of group.txt to another group.
Q4. Use the chmod functionality to change the permission of others to read only.
Q5. Change the permission of group to execute and read using numeric chmod functionality.
Q6. Create a file run_all.sh and add following commands inside it: a) Display date b) Display
the current working directory c) Lists the contents of the current directory d) Prints a
“Welcome to Linux” message on the terminal.
Q7. Check the permission of your file. Now make your file executable using chmod.
Q8. Run your file using all the three methods:
sh run_all.sh
bash run_all.sh
./run_all.sh
Linux Assignment 5
(Linux Script)