Question

Unix questions, i need help on Hint: Commands to study to answer this question: predefined shell...

Unix questions, i need help on

Hint: Commands to study to answer this question: predefined shell variables,

and .profile script file, echo

SHELL, HOME, PATH, MAIL and TERM are predefined shell variables. You can use the value of a shell variable in a shell command putting $ in front of it. For example, to display the value of the HOME directory of the user, specify $HOME in the echo command like echo $HOME.

Do not give just the value of the shell variable as answer to questions given below.

1) Display the value of SHELL

2) SHELL contains the pathname of the shell program you are using. With echo command, answer what is the name of the shell program

3) Display the value of HOME

4) With echo command, answer what the HOME value stand for

5) Display the value of PATH

6) PATH contains the list of directories shell searches for the nonbuilt-in command (that is, the executable program file with name same as the command you typed). The directories in the list are separated by : character.

With echo command, answer whether the list contains . (dot or period) and whether the shell searches the current working directory.

7) Display the value of MAIL

8) With echo command, answer where the system stores your emails. Indicate whether it is a directory or file.

9) Display the value of TERM

10) With echo command, answer what is the type of the terminal you are using. Note: The combination of keyboard and monitor is called a terminal. If the value of TERM is xterm, then indicate what xterm stands for. Do not give the answer as xterm.

11) The .profile file is in your login directory. It is a startup shell script file containing shell (UNIX) commands. The system executes the UNIX shell commands in this file each time you login to setup your session environment before shell displays the first shell prompt (which is $ by default). Display the content of .profile file

12) With echo command specify the list of predefined shell variables in the .profile file

0 0
Add a comment Improve this question Transcribed image text
Answer #1

# to display the processes for a particular user:
# ps -ef | grep <username>
echo 'Display processes of particular user:'
ps -ef | grep tom

# to display information about processes using long option
# ps -efl | grep <username>
# notice the l is the above command, it stands for extended listing
echo
echo 'Use the long option:'
ps -efl | grep tom

# display all the processes in the system and output using the grep command only the lines containing init
# a: select all processes
# u: select all processes even those of other users
# x: do not control ttys
echo
echo 'Display all processes in system then grep it to show only init:'
ps -aux | grep init

# display pid of init process
echo
echo 'Display pid of init using echo command:'
result="$(pidof init)"
echo "${result}"

---------------------------------------------

Output screenshot:

Display processes of particular user: 1 e 2433? 2 2433 ? 72 71 0 2433? 73 71 0 2433? 00:00:01 /bin/bash 00:00:00 bash test.sh

Add a comment
Know the answer?
Add Answer to:
Unix questions, i need help on Hint: Commands to study to answer this question: predefined shell...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Explain what the following UNIX command does: Is 'echo I.txt' Please type shell commands (for Windows....

    Explain what the following UNIX command does: Is 'echo I.txt' Please type shell commands (for Windows. UNIX, or any other system that you like) for: creating a directory called hello world list the contents of this directory create a file called iwashere.txt display the contents of the file iwashere.txt from the command-line Please write a simple program in C for accepting a string from the command-line, reversing and printing the reversed string to standard output.

  • UNIX File Permission help, please answer the questions in the green boxes. Thank you Lab 03...

    UNIX File Permission help, please answer the questions in the green boxes. Thank you Lab 03 File Permissions In this lab we will: learn about file permissions learn to create symbolic links and hard links Utilities that will be utilized in this Lab: us, cd, less, cat touch, chmod id umask, mkdir, In, echo and redirection Users and Groups Linux supports several methods of controlling access to files an directories. In this lab we are going to learn the traditional...

  • Revision Question 3 on Linux. Please explain the shell script commands in the context of post...

    Revision Question 3 on Linux. Please explain the shell script commands in the context of post execution. You have just logged in and have a directory called "novel" in your home directory containing the following files: chapter1.docx chapter2.docx chapter3.docx draft.pdf save where "save" is itself a directory and contains the files Attributes.txt draft.pdf.1 draft.pdf.2 draft.pdf.3 indexA.txt indexB.txt list1.txt list2.txt a) Describe the results you would expect when executing the following shell commands: i) ls novel/save/*A* ii) ls novel/*r[23]* iii) rmdir...

  • b. echo Your file has been processed c. echo l; d. cp file /tmp 36. You...

    b. echo Your file has been processed c. echo l; d. cp file /tmp 36. You can use the command to start a program with an environment variable setting that is not part of your current environment. c. use d. env a. export b. set 37. The command displays a list of all environment variables defined in your current environment. c. use d. env a. export b. set he environment variable contains a list of directories on the Linux system...

  • Objective : Write a C Shell script which copies all files(*.java and *.class) from your home dire...

    Objective : Write a C Shell script which copies all files(*.java and *.class) from your home directory to a new one, and Analyze the new directory information such as number of files, user permissions, and disk usage. Sample Output:                                                    << CS Directory Analysis >>      Date:   ============================================================ Current Directory: /home/tomss New Directory Created : /home/tomss/pgm01 File information Total Number of files : 22 files Directory files:   0 files Plain text files:   10 files File have read permissions: 3 files File have...

  • A filename con comprise multiple embedded dots (e.g., a.b.c.d.e). True False A device file is not...

    A filename con comprise multiple embedded dots (e.g., a.b.c.d.e). True False A device file is not really a stream of characters and doesn't contain anything at all. True False Relative pathnames begin with the root directory. True False Running the ls -a command uniquely identifies directories and binary executables. True False What is the result of running mkdir -p share/man/cat1 from the command line? a. It creates the directory share. b. It creates the directory share/man. c. It creates the...

  • Creating a Shell Interface Using Java This project consists of modifying a Java program so that...

    Creating a Shell Interface Using Java This project consists of modifying a Java program so that it serves as a shell interface that accepts user commands and then executes each command in a separate process external to the Java virtual machine. Overview A shell interface provides the user with a prompt, after which the user enters the next command. The example below illustrates the prompt jsh> and the user’s next command: cat Prog.java. This command displays the file Prog.java on...

  • COSC 3411 /ITAP 3411 Homework (UNIX Shell Commands) How would you ensure that all ordinary files...

    COSC 3411 /ITAP 3411 Homework (UNIX Shell Commands) How would you ensure that all ordinary files created by you have rw-rw---- as default permissions? How would you sort in the background a file called "bad.txt", and place the results in a file called "sort.txt"? Archive the contents of your home directory (including any subdirectories) using tar. Compress the tar archive with gzip. Now extract their contents. Use the “find” command to locate in /docs and /usr/docs all files that Begin...

  • Unix/Linux The purpose of this lab is to practice the commands to manage and organize files...

    Unix/Linux The purpose of this lab is to practice the commands to manage and organize files and directories: How would one go about this? Thanks. Task 1: Preliminaries: 1) If you have not already done so, create a directory called bin under your HOME directory. 2) If you have not already made a copy (using ftp) of the file called famous.dat from the Assignment#1, do that now. 3) Make bin the active/working directory. Task 2: Perform all of the following...

  • Login to Suse Linux as root. Complete the task working as the root user. 1. What...

    Login to Suse Linux as root. Complete the task working as the root user. 1. What is your current directory. What did you enter at the command prompt to determine your current working directory? 2. Change directories if needed to find your foods (or food) file. Use vi to make the file contain 10 food items. Save your file and quit. Use the cat command, and option, and the argument food to display the food file with numbered lines. Use...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT