How would I go about answering these questions In linux. Please provide the correct linux command needed to answer these 4 questions
5. Display total words of each file under your root directory and subdirectories.
6. Change permission of every filename ends “.py” to — write read execute, group - read execute, other - execute
7. Find every line which contains “hello” from your file system, display both file name, line number.
8. Combine files with name “p3.py”, “p31.py”, “p32.py”, and redirect result to py.py
ANSWERS: LINUX COMMANDS
5. DISPLAY TOTAL WORD OF EACH FILE UNDER YOU ROOT DIRECTORY AND SUBDIRECTORIES
# find . -type f -print | wc -l
6. change the permission of every filename ends ".py" to write read execute, group-read execute, other - execute.
chmod +wrx -.py ======> this command for write read and execute ".py" files
chmod g+rx ======> this command for read and execute in a group
chmod o+x ========> this command for execute in others.
w == write, r== read , x== execute, g==group, o==other.
7.find every line which contains "hello" from your file system. display both file name and line number
grep -R 'hello'
$ grep -n 'hello'
8.combine files with name "p3.py","p31.py" "p32.py"and redirect result "py.py"
cat p3.py p31.py p32.py >> py.py
Get Answers For Free
Most questions answered within 1 hours.