UNIX Assignment 2
UNIX Assignment 2
1. Create a directory called iiht and inside it creates three sub directories namely, trainers,
trainees and employees.
Ans : Use commands as follows,
mkdir iiht
cd iiht
pwd
mkdir namely
mkdir employers
mkdir trainees and employees
2. Move to employee’s directory and list all the process, then get back to the home directory.
Ans : Use ‘find -name “.txt” -print’ command to display .txt file and
Use ‘ls -d /etc/ [n]* command to files whose name start with ‘n’
5. List all files which are having first letter as A and last character as a in between any 4
characters.
Ans : Use ‘find -name “*[A!!!!a]” -print’ command to display all files which are having
first letter as A and last character as a in between any 4 characters.
6. List all files which does not have any numeric values in their file names.
Ans : Use ‘find -name “*[!(0-9)]” -print’ command to list all files which does not have
any numeric values in their file names.
7. Display the contents of a specified file in the directory.
Ans : Use ‘ ls / iiht’ command to display the contents of a specified file in the directory.
8. Create a file called first.txt and insert some content into and copy the contents to second.txt
file.
Ans : Use ‘mv second.txt final.txt’ command to move the contents from second.txt to
final.txt.