Question

In: Computer Science

1. Write a bash command that will display the value of all environment variables defined in...

1. Write a bash command that will display the value of all environment variables
defined in your shell process, sorted in alphabetical order, and numbered.
Here is a sample of the type of output your command should produce:

1 }
2 ALSA_CONFIG_PATH=/etc/alsa-pulse.conf
3 AUDIODRIVER=pulseaudio
4 BASH_FUNC_mc%%=() { . /usr/share/mc/mc-wrapper.sh
5 COLORTERM=1

2. Write a bash command that will display the value (and only the value) of the
JAVA_ROOT environment variable. Here is a sample of the type of output your
command should produce:

/usr/lib64/jvm/jre

3. Write a bash command that will add your working directory and your home directory
to the current value of the PATH variable. Make sure your new PATH value works
no matter what your current working directory might be.


4. Write a bash command that will display the process ID number and the total CPU time
for each process on the system. Do not display any additional information. Here is a
sample of the type of output your command should produce:

PID TIME
24648 00:00:00
25431 00:00:00
27567 00:00:00
27568 00:00:00
27569 00:00:00
27570 00:00:00

5. Write a bash command that will display the name of every file on the Linux system
whose file contaent contains the string "doug.jones". The command must run in the
background, must redirect standard error to /dev/null, and must redirect standard
output to ~/out.

6. Write a bash command that will kill all of the even-numbered processes associated
with your userid, and no other processes.

7. Write a bash command that will start the program
/home/courses/140u-doug.jones/zombie_maker
as a background process, with standard output redirected to /dev/null.
  
This program will create a zombie process.

8. Write a bash command that will display the process id, parent process id, and wait
channel (search for wchan in man ps) for all zombie processes on the server.
Do not display any additional information.
Here is an example of the type of output your command should produce:

28318 28317 exit

9. Write a bash command that will kill job 1.

10. Write a bash command that will generate a file named
~/cpp_files
that contains the name and absolute path of all files on the system
that contain the line
int main(int argc, char **argv)

The contents of the file ~/cpp_files should be in alphabetical order.
The command you create should run in background, and redirect standard
error to the file ~/stderr.

Solutions

Expert Solution

Answer 1
*********
printenv | nl

Answer 2
********
printenv | grep "jre"

Answer 3
*********
export PATH="$PATH:$pwd

Answer 4
*********
ps -O %px | awk '{print $1 " "$4}'

We are allowed to do only 4 exercise out of any given.

if you have any doubt then please ask me without any hesitation in the comment section below , if you like my answer then please thumbs up for the answer , before giving thumbs down please discuss the question it may possible that we may understand the question different way and we can edit and change the answers if you argue, thanks :)


Related Solutions

Here are the tasks for this assignment: 1. Write a bash command line to determine if...
Here are the tasks for this assignment: 1. Write a bash command line to determine if the server 'syccuxfs01.pcc.edu' is reachable from the syccuxas01.pcc.edu server. 2. As you have read, TCP/IP messages are passed from one device to another until the message reaches its destination. Write a bash command line that will verify that no more than two (2) network devices are used to pass messages from the syccuxas01.pcc.edu server to the www.pcc.edu server. 3. Write a bash command line...
Windows XP Command Line questions. a) What is the command to display all of the files...
Windows XP Command Line questions. a) What is the command to display all of the files on the disk in drive A:--do not use the DIR command or the CHKDSK command C:\> b) Display the contents of the PERSONAL.FIL file located in the root directory of drive A: one screenful at a time C) Display the contents of the PERSONAL.FIL file located in the root directory of drive A:, one screenful at a time, beginning with the 25th record, on...
this is bash scripting. a. Explain the difference between grep and egrep? b. Write a command...
this is bash scripting. a. Explain the difference between grep and egrep? b. Write a command to list files where third letter is x or y? c. Write command to remove array element with id 5
UNIX ONLY Write a bash script that will accept a filename as a command line argument....
UNIX ONLY Write a bash script that will accept a filename as a command line argument. Your script should first check whether the filename has been passed as argument or not (hint: at least one argument has to be provided). If no argument has been provided your script should display appropriate message and exit. If a file name has been provided, your script should check if the file exists in the current directory and display the contents of the file....
Give the PowerShell command that would display the “Path” environment variable. What two PowerShell commands will...
Give the PowerShell command that would display the “Path” environment variable. What two PowerShell commands will display all of the users currently logged into a server? What command would give helpful information about the Get-Command cmdlet.
Write a bash script named q1f.sh that will edit the PATH environment variable to include the...
Write a bash script named q1f.sh that will edit the PATH environment variable to include the sourcefiles directory in your home directory and make the new variable global. Please show picture of output.
                      Contact Manager COMMAND MENU ---------------------------------------------------------- list - Display all contacts view - View
                      Contact Manager COMMAND MENU ---------------------------------------------------------- list - Display all contacts view - View a contact add - Add a contact del - Delete a contact exit - Exit program Command: list 1. Tom van Rossum 2. Edward Idle Command: view Number: 2 Name: Edward Idle Email: [email protected] Phone: +44 20 7946 0958 Command: add Name: John Smith Email: [email protected] Phone: 559-123-4567 John Smith was added. Command: list 1. Tom van Rossum 2. Edward Idle 3. John Smith Command: exit...
1. Write the statement that will display all of the information in the PetOwner table using...
1. Write the statement that will display all of the information in the PetOwner table using the asterisk (*) notation. 2. Write the statement that will display all of the information in the PetOwner table without using the asterisk (*) notation. 3. Write the statement that will display the first and last names of the owners in that order. 4. Write the statement to display the breed, type and DOB of all pets having a type of Cat. 5. Write...
this is bash scripting. a. Write a shell script that adds an extension “.deb” to all...
this is bash scripting. a. Write a shell script that adds an extension “.deb” to all the files in a directory. b. Write a command sequence or a script to insert a line “GHIJKLM” at every 10th line of a file? c. Write a bash command or script to find all the files modified in less than 5 days and print the record count of each.
In Linux (Ubuntu), write a script to check command arguments (3 arguments maximum). Display the argument...
In Linux (Ubuntu), write a script to check command arguments (3 arguments maximum). Display the argument one by one. If there is no argument provided, remind users about the mistake. If there is an easy way to use a loop to get all arguments, use it? a. Display the source code in an editor (#4-1) b. Execute your script in the terminal, and display the command and the result (#4-2)
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT