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...
Write a C program which prints the environment variables to a file "sample.txt" . All variables...
Write a C program which prints the environment variables to a file "sample.txt" . All variables are followed by a newline character. example: example: inputs: envp/environ = {"E1=5","E2=9",NULL} outputs: env.txt as a string would be "E1=5\nE2=9\n".
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....
Write a BASH shell script (see the Important Notes section) that acts as a DOS command...
Write a BASH shell script (see the Important Notes section) that acts as a DOS command interpreter (the user enters the DOS command and the script executes the corresponding Linux command). The script should loop continuously until the user enters the QUIT command Prior to accepting a command, display a prompt containing your first name and the greater than symbol (>) Example prompt: linux> The DOS command, and any arguments, should be stored in variables $command – the DOS command...
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...
Web Programming Task + Database sql Write a command to display the ISBN number and the...
Web Programming Task + Database sql Write a command to display the ISBN number and the price in the table books. Question #2: What command did you enter? Answer: Write a command to increase the price of each book in the table books by 50 cents. Question #3: What command did you enter? Answer: Write a command to display the price and title in the table books of ISBN 0-672-31697-8 Question #4: What command did you enter? Answer: Write a...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT