Join Whatsapp Channel for Ignou latest updates JOIN NOW

Write the LINUX commands for the following: a) Use the cat command, and display all the .txt files in the current directory on the screen at one go. b) To copy dir3 to dir4 including sub-directories. c) To search for a certain pattern in the files existing in the current directory d) To list lines that does not include and in a text file. e) To compress all .dat files in the current directory. f) To decompress all the .dat files compressed in (e). g) To pause any process. h) To kill a process using its process-id. i) To send a set of files to the line printer. j) To list all the files in the present working directory including the hidden files.

Here are the Linux commands for each of the tasks you’ve listed:

(a) Use the cat command, and display all the .txt files in the current directory on the screen at one go:

cat *.txt

(b) To copy dir3 to dir4 including sub-directories:

cp -r dir3 dir4

(c) To search for a certain pattern in the files existing in the current directory:

grep "pattern" *

Replace “pattern” with the text you’re searching for.

(d) To list lines that do not include “and” in a text file:

grep -v "and" filename.txt

Replace “filename.txt” with the name of your text file.

(e) To compress all .dat files in the current directory:

gzip *.dat

This will compress all .dat files in the current directory using gzip.

(f) To decompress all the .dat files compressed in (e):

gzip -d *.dat.gz

This will decompress all .dat files that were compressed using gzip in the current directory.

(g) To pause any process:

You can pause a process by sending it the SIGSTOP signal. To do this, you need to find out the PID (Process ID) of the process you want to pause, then use the kill command to send the SIGSTOP signal to that process. For example:

kill -STOP PID

Replace PID with the actual Process ID of the process you want to pause.

(h) To kill a process using its process-id:

kill PID

Replace PID with the actual Process ID of the process you want to kill.

(i) To send a set of files to the line printer:

lp filename1 filename2 ...

Replace “filename1”, “filename2”, etc., with the names of the files you want to print.

(j) To list all the files in the present working directory including the hidden files:

ls -a

This will list all files in the current directory, including hidden files (those starting with a dot).

1 thought on “Write the LINUX commands for the following: a) Use the cat command, and display all the .txt files in the current directory on the screen at one go. b) To copy dir3 to dir4 including sub-directories. c) To search for a certain pattern in the files existing in the current directory d) To list lines that does not include and in a text file. e) To compress all .dat files in the current directory. f) To decompress all the .dat files compressed in (e). g) To pause any process. h) To kill a process using its process-id. i) To send a set of files to the line printer. j) To list all the files in the present working directory including the hidden files.”

Comments are closed.

error: Content is protected !!