Skip to content

Instantly share code, notes, and snippets.

@baalajimaestro
Created December 6, 2018 15:38
Show Gist options
  • Save baalajimaestro/9f2c85e8ba4909d7114b644edcb2fe9d to your computer and use it in GitHub Desktop.
Save baalajimaestro/9f2c85e8ba4909d7114b644edcb2fe9d to your computer and use it in GitHub Desktop.
OS Lab Questions
OS Lab 2
1. Display your login name, date ,who is the currently logged in user and home directory
2. Display sum of two integers
3. Create a file student.txt 3 in cse 3 in mech
Rollno|name|dept
Add 6 records
4.Display the number of records in student.txt
5 sort the file according to student name
6.Display student name and dept
7. Display students whose names begins with k
8. Display last two students
9. Create a soft link for the file created.
10.Count the number of processes in the system
Answers:
1. who;cd ~;pwd
2. a=10;b=20;echo `expr $a + $b`
3. cat > students.txt
1|A|CSE
2|B|MECH
3|C|CSE
4|D|MECH
5|E|MECH
6|F|CSE
4. cat students.txt|wc --lines
5. cat students.txt|cut -f 2 -d\||sort
6. cat students.txt|cut -f 2,3 -d\|
7. cat students.txt|grep \|k
8. cat students.txt|tail -n 2
9. ln -s students.txt lol.test
10. ps aux| wc --lines
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment