Join WhatsApp Group Join Now!

LINUX BASICS (312001) Experiment No 05: Execute file and Directory manipulation commands

LINUX BASICS (312001) Experiment No 05: Execute file and Directory manipulation commands
Please wait 0 seconds...
Scroll Down and click on Go to Link for destination
Congrats! Link is Generated

LINUX BASICS (312001) Experiment No 05: Execute file and Directory manipulation commands

LINUX BASICS (312001) Experiment No 05: Execute file and Directory manipulation commands
LINUX BASICS (312001) Experiment No 05: Execute file and Directory manipulation commands


In this Linux Basics manual practical number five we are going to learn Execute file and Directory manipulation commands in Linux. Data and programs are stored in files. These are organized in directories. Simply, a directory is just a file that contains other files (or directories). Various operations that can be performed on a file are created, opened, read, written, moved, closed, and renamed.

Program code

1. Create 3 blank files p1 p2 p3 using touch command

Answer:

Bash

touch myfiles/p1 myfiles/p2 myfiles/p3

Questions

1. What are the options of wc command

Answer:

Option Description
-c or --bytes Counts bytes.
-l or --lines Counts lines. (default)
-m or --chars Counts characters (excluding newlines).
-w or --words Counts words.
--help Displays help information and exits.
--version Displays version information and exits.
-L or --max-line-length Prints length of longest line per file.
--files0-from=F Reads input from files listed in file F (NUL-terminated)


2. What are different options of diff command?

Answer:


3. What is the difference between comm and cmp command

Answer:

Feature comm command cmp command
Purpose Compares two sorted files line by line. Compares the contents of two files byte by byte.
Input Requirement Both files must be pre-sorted in ascending order. Files don't need to be sorted.
Output Shows three lists: lines only in the first file, lines only in the second file, and lines present in both files. Reports the byte and line number (if applicable) where the first difference occurs. If no difference is found, it exits silently (no output).
Use Case Identifying lines unique to each file or common to both. Checking if two files are identical or finding the first point of difference.
Example comm file1.txt file2.txt cmp report.txt report.bak

Hi everyone, I'm Suraj Diware, and I'm passionate about helping students succeed in MSBTE programs. This blog is dedicated to providing clear and concise explanations of MSBTE curriculum topics, along with practical tips and resources to sup…

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.