Question

Write the LINUX commands for the following:

(a) To display the present working directory. Make a directory with your name and add a text file
with the file name “text1”.
(b) To create any empty file using touch command.
(c) To move a file from one directory to any other directory.
(d) To display the first 10 lines of any text file.
(e) To grant the permissions of read and execute to the user and execute only permission to the
group and others for all the files in a current directory.
(f) To display the file content in a reverse order (from the last line) of any text file.
(g) To diplay the User ID / Group ID.
(h) To compare two files or streams.
(i) To translate the file content from lower case to upper case.
(j) To count no. of lines, words and characters in a file.

30 Nov 2023
Answer :
Word Count : 610

Sure, here's a guide to perform each of the tasks on both Linux and Windows command line:

### Linux Commands:

(a) Present Working Directory & Creating Directory/File:
```bash
pwd # To display the present working directory
mkdir YourName # Create a directory with your name
cd YourName # Navigate to the created directory
touch text1.txt # Create a text file named "text1"
```

(b) Create Empty File Using Touch Command:
```bash
touch filename.txt # Creates an empty file named "filename.txt"
```

(c) Move a File from One Directory to Another:
```bash
mv /path/to/source/file /path/to/destination/directory # Moves a file from source to destination
```

(d) Display First 10 Lines of a Text File:
```bash
head filename.txt # Displays the first 10 lines of the file "filename.txt"
```

(e) Set Permissions for Files in Current Directory:
```bash
chmod u+rx,g+x,o+x * # Grants read and execute permissions to the user, and execute to group and others for all files in the current directory
```

(f) Display File Content in Reverse Order:
```bash
tac filename.txt # Displays file content in reverse order (from the last line)
```

(g) Display User ID / Group ID:
```bash
id # Displays user and group ID information
```

(h) Compare Two Files or Streams:
```bash
_____ _____ _________ _____ __________ _______ ____ _____ _______ _______ ______ ______.
__________ ____ _________ ____ ________ _________ _____ ____ _______.
______ ____ ____ _______ ___ ___ ________ ____ ____ ___.
_______ ________ ____ ______ ________ ________ __________ ____ _______.
____ ____ ________ __________ _____ _____.
______ ______ ______ _______ ______.
_________ ________ __________ ___ ______ __________ ___ ____.
_______ ______ ____ __________ ___ ____.
______ __________ ______ _____ _________.
_____ __________ __________ ______ _____ _________ _______.
______ _________ _________ _____ ___ _____ _________ ___.
_____ _______ __________ _______ _________ ___ ____ ______ ___.
________ ______ __________ _____ ______ __________ ___ _______ ____ _______ __________.
________ _______ _________ ____ ______ ______ ___.
____ _____ ______ ________ ____ _________.
_______ _______ _____ _______ _________ _______ ________ ____ __________.
________ ________ _____ __________ _______ ______ ________ _____.
_________ ______ _______ _____ _________ _____ _______ _________ ______ ________.
_________ _____ _______ ___ _______ _____.
________ ______ _________ __________ _____ _________ ___ ______.
___ __________ _______ _____ ____ __________.
_________ __________ ____ ___ _______ ______.
__________ _________ _______ ________ _________ _____ __________ ___ _____ _______.
_______ ________ ________ ______ ___ ______.
______ __________ ____ __________ ________ ____ ______ ___ _________ ____ __________ _______.
_________ ______ _______ ____ ____.
________ _____ __________ ______ ______ _____ ___ _______.
____ ____ _____ __________ ___.
____ ______ ________ __________ __________ _________ _________ ___ ______ ___ ___ ___.
_______ ____ ___ ____ _______ ____ _______ _____ ___ ________ ___.
___ ______ ________ _________ _________ ________ ___ _______ _______ ___ __________.
_______ __________ ___ _____ __________ _________ ____ _______ _____ ___.
_________ ____ _________ ____ _____ ____ __________ ___ __________ ___ ________.
________ _______ ______ __________ ______ ____ ___ ___ __________.
__________ _____ _____ _________ ____ _____ _____ _____ ______ ___ ______ ___.
__________ ______ _________ ____ _________ _________ _______.
_______ _________ __________ ______ ______ _______ _____.
__________ ____ ___ _________ _________ ____ __________.
_________ ____ __________ ________ ______ _____ ______ _____.
________ ____ ________ __________ _______ __________ ________ ____ _________ _____ ___.
___ ______ ________ __________ __________ ______ ______ _____ ___ ______.
______ _____ _____ _______ ________ _______ _________ ___ __________.
_______ __________ _____ _________ _____ ____ __________ ______ ____.
_____ ________ ___ __________ ____ ___ ___.
_______ _______ ________ _______ ____ ___ _______ ______ _________ _________.

IGNOU ACADEMY
Your IGNOU journey, made easier.
  • Solved Assignments
  • Study Notes
  • Guess Papers
  • Question Papers
Skip in 10
'; fetch( "query.php?type=1&method=0&lr=0&app=401&mycartproduct=1", { method: "GET", cache: "no-store" } ) .then(function(response) { if (!response.ok) { throw new Error( "HTTP " + response.status ); } return response.text(); }) .then(function(html) { loader.innerHTML = html; /* Your existing function, if available. */ if (typeof updateTotals === "function") { updateTotals(); } else { calculateCartTotal(); } }) .catch(function(error) { console.error( "Cart loading error:", error ); loader.innerHTML = '
Unable to load cart.
'; });}/* ========================================================= CALCULATE TOTAL========================================================= */function calculateCartTotal() { let subtotal = 0; /* Looks for .item-price inside AJAX products. Examples accepted: ₹200 ₹200.00 Rs 200 Rs. 200 200 200.00 */ const prices = document.querySelectorAll( '#loadmycart .item-price' ); prices.forEach(function(element) { let text = element.textContent || ''; text = text .replace(/₹/g, '') .replace(/Rs\.?/gi, '') .replace(/,/g, '') .trim(); let value = parseFloat(text); if (!isNaN(value)) { subtotal += value; } }); updateCartDisplay(subtotal);}/* ========================================================= UPDATE TOTAL DISPLAY========================================================= */function updateCartDisplay(total) { const subtotalElement = document.getElementById('subtotal'); const totalElement = document.getElementById('total'); const checkoutButton = document.getElementById('checkoutButton'); const noItems = document.getElementById('noitems'); const amount = Number(total) || 0; if (subtotalElement) { subtotalElement.textContent = '₹' + amount.toFixed(2); } if (totalElement) { totalElement.textContent = '₹' + amount.toFixed(2); } /* EMPTY CART */ if (amount
Top