Softenger (I) PVT Ltd. Assignment 3
Softenger (I) PVT Ltd. Assignment 3
==> We can use echo $HOME Command & the output will be /trainee/mp07121182 2. Create new sub-dir tree in your home dir d1/d2/d3? ==>mkdir -p d1/d2/d3 3. Display the contents of d1. Create new 7 files in d1 with different extensions? ==>first go to dir d1 and run the command ls -l Or in home directory run ls -l d1 it will display contents of d1 directory, Now we can create files in d1 by using touch command Ex. Touch 1.txt 2.txt 3.c 4.c 5.txt 6.c 7.c 4. Display list of files ending with .txt in single command? ==> we can find files ending with .txt in current dir as find . -name *.txt the output will be as $1.txt $2.txt $5.txt 5. Print the disk usage of d1? ==> using command du d1 the output will be as shown below bash-3.2$ du d1 2 d1/d2/d3 4 d1/d2 6 d1 6. Print the date in format dd/mm/yy? ==> $date '+date=%d/%m/%y' $date=13/08/12 7. How to display the current shell? ==> echo $SHELL /bin/sh 8. Print the list of files containing Softenger in single command? ==> grep -l Softenger * 9. How to find out the no of users accounts present on 192.168.1.204 server box using single command? ==> cut -d : -f 1 /etc/passwd | wc -l
10. Print currently logged in users with their IP addresses? ==> using who command 11.What does this command do; grep $SHELL /etc/passwd |cut d: -f1 ==> It will show the list of users working in default shell 12. How do you print every line of a file twice? 13. How to display PS output without header files? ==>ps | tail + 2 14. Find out the occurrence of three consecutive and identical characters (like aaa or bbb). 15. If i invoke ls l file will the access time of file changes? ==> NO 16. How will you add the parent directory to your existing PATH? ==> PATH=$PATH:/usr/bin:/usr/sbin:/trainee/mp07121182: export PATH 17. How will you repeat last command in BASH shell? ==> using !! 18. If the owner doesnt have write permissions on a file but its group has, can he edit the file? ==> NO 19. Try creating a dir in /bin and /tmp. What do you notice and why does that happen? ==>when I tried to creat a directory manoj , the output was, bash-3.2$ mkdir manoj mkdir: Failed to make directory "manoj"; Permission denied 20 . Can you group files in /dev dir into 2 groups and how?