Linux Assignment5 1. Write a Linux command that will count the number of lines o
ID: 3751167 • Letter: L
Question
Linux Assignment5 1. Write a Linux command that will count the number of lines of your text files (.txt). That means total line count of every file. 2. How will you copy a directory including subdirectories from directory 1 to directory 2? 3. What command to use to unzip file in Linux? 4. What command to use if you want to a particular string called "include" within a folder. First go to the required folder then type 5. Create a file called foo. Assign the file only read and write permission. 6. Which command do you use to delete all the files in the current directory including its subdirectories? 7. Print the number of files in your directory 8. What command to use to get the status of all the processes running on the system? 9. Print the command for listing all files ending in capitals and small letters? 10. Print the command that kill the last background job?Explanation / Answer
1)wc -l *
wc means word count. -l specify count no of lines. * means all files in the folder
2)cp -r /directory1/directory /directory2
cp means copy .-r means recursively copy
3)unzip
4)Q not clear.Some word missing in between.
You may get back to me through comments with complete q.
5)To create a new file ,
touch foo
It will be created with permission ->rw-r--r--.. ie users can only read and write it.
I we want to change it to only users can read and write , we can give command
chmod 600 foo
6)rm -r *
recursively removes all files and directories if you have permission from the current directory
7)ls -1 | wc -l
ls->list files in a directory
1->only one entry per line.
| : pipe output of (ls -1) to ..
wc -l: wordcount and count only lines
8)ps au
a->gives all processes of current user
u->gives all processes of all users
9)ls | egrep [a-zA-Z]$
ls ->lista ll the files
|->pipe to
egrep->regular expression
[a-zA-Z]$ indicates words ending with small / capital letters
10)kill %%
%%->refers to the last background job executed
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.