Question

In Linux please just type out command assuming files and directories are there Q21: display those...

In Linux please just type out command assuming files and directories are there

Q21: display those line and line number do not contain “apple” from files whose name contains “file”.

Q22: find all files, where file size is bigger than 100k and smaller 500k, and where filename ends with “.py”

Q23: delete all directories with size larger than 10M or smaller than 1M.

Q24: find out the five largest files or directories from current working directory, and output the result to “Top5sortedlist.txt”.

Q25: Extract between 10th to 20th character from “table1.txt”, and append result to “table2.txt”.

Homework Answers

Answer #1

(Ans 1)

ls | grep "file" | xargs grep -vn apple
#line and line number which does not contain "apple"

(Ans 2)

find -iname "*.py" -size +0.1M -size -0.5M
#finding python files of the given size range

(Ans 3)

find . -type 'd' -size +10M -size -1M -delete
#delete all directories in the given size range

(Ans 4)

du -a | sort -n -r | head -n 5 | cut -f2 > Top5sortedlist.txt
#find the five largest files or directories from current working directory and output redirect to a file

(Ans 5)

cut -c10-20 < table1.txt >> table2.txt #cut is used to cut the required set of characters out.
#the >> operator appends the result to table2.txt
Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT