Question

1. Explain the difference between the /etc/profile and the ~/.bash_profile file. Which one is executed first?...

1. Explain the difference between the /etc/profile and the ~/.bash_profile file. Which one is executed first?

2. Edit your .bash_profile file as follows:

1. Welcome the user

2. Add your home directory to the path if it is not there

3. Set erase to the Backspace key using stty.

4. Type source .bash_profile. What is the function of the source command?

3. What is the default primary prompt?

1. Change the prompt to include the time of day and your home directory.

2. What is the default secondary prompt? What is its function?

4. What is the difference between a program and a process? What is a job?

5. What command brings a background job into the foreground?

6. How do you list all running jobs? All stopped jobs?

7. Make a directory called wildcards. Cd to that directory and type at the prompt:

touch ab abc a1 a2 a3 all a12 ba ba.1 ba.2 filex filey AbC ABC ABc3 abc

Write and test the command that will do the following:

a. List all files starting with a.

b. List all files ending in at least one digit.

c. List all files starting with a or A

d. List all files ending in a period, followed by a digit.

e. List files ending in x or y

f. List all files ending in a digit, an uppercase letter, or a lowercase letter.

8. What command would you use to do the following:

1. Redirect the output of the ls command to a file called lsfile?

2. Redirect and append the output of the date command to lsfile?

3. Redirect the output of the who command to lsfile? What happened?

9. Use the find command to find all files, starting from the parent directory, of type directory. Save the standard output in a file called found and any errors in a file called found.errs.

10. What is a positional parameter? Type at the command line:

set dogs cats birds fish

1. How do you list all of the positional parameters?

2. Which positional parameter is assigned birds?

3. How do you print the number of positional parameters?

4. How do you remove all the positional parameters from the shell’s memory?

11. What is an environment variable? What is the command used to list them? Create an environment variable called CITY and assign it the value of your hometown. How do you export it?

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

1)These two profile files are used to set environmental variables.The difference is that these two files are executed by depend on the type of login.That means,in Linux we have Interactive login Shells and Non-Interactive login Shells.By using interactive shell user can interact while by using a non-Interactive shell an user cannot interact.The /etc/profile is executed only for interactive shells and the /etc/bashrc is executed for both shells. etc/profile file starts first and calls the /etc/bashrc directly.

3)In linux we can customize bash command prompt like color,information. Bash can be customized by changing bash PS1, PS2, PS3, PS4 variables.PS1 is a primary prompt variable. It holds \u@\h:\w\$ special bash characters and this is default structure of the bash prompt.PS2 variable is a secondary prompt and it is displayed when it waits for a user input like, passwords.


4) program:
Program is nothing but set of instructions to perform certain task or function where as the process is an operation that takes the given instructions and performs as per the code and also called as execution.Process is dependent of program.


5)fg %number. Here number is job number.

6) By using ps aux | less we cann see all running jobs.

7) Ans: f) List all files ending in a digit,uppercase letter or a lower case letter.

8) 1) ls -lrt >> lsfile.
   2) date > lsfile
   3) who > lsfile

11) Environment variables are used to set values dynamically whhich affects the way of running processes.
We can create enviroonment vcariables by using setenv. ex: setenv city vijayawada

Add a comment
Know the answer?
Add Answer to:
1. Explain the difference between the /etc/profile and the ~/.bash_profile file. Which one is executed first?...
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
  • 2. At the command prompt, type ls –l /dev/log and press Enter. What is the file type? Which daemo...

    2. At the command prompt, type ls –l /dev/log and press Enter. What is the file type? Which daemon on Ubuntu Server Linux uses this file and what is its purpose? 3. At the command prompt, type less /etc/rsyslog.conf and press Enter to view the configuration file for the System Log Daemon. Are there any entries that specify facilities, priorities, or log file locations? What does the last line of the file specify? Press q when finished to quit the...

  • 1. Navigate to your home directory by typing cd. Now type ls and notice that there...

    1. Navigate to your home directory by typing cd. Now type ls and notice that there is a subdirectory called Downloads. Now navigate to the root of the file system by typing cd /. From here, which single command would you use to navigate directly to the Downloads folder that is located in your home directory? The output of the command would be as follows: 2. From the Downloads directory which single command would you use to navigate back up...

  • do numbers 4-8 4. Given any directory, use the Is command to display: • all files...

    do numbers 4-8 4. Given any directory, use the Is command to display: • all files and sub-directories starting with the letter "D" (note do not list anything in any sub-directory) • its immediate sub-directories (sub-directories only, and no other ordinary files) its immediate hidden sub-directories only - take a screenshot (#3-3) that clearly shows the command and the result. 5. Assume that the following files are in the working directory: $ ls intro notesb ref2 section 1 section3 section4b...

  • Project 4-4 In this hands-on project, you make and view links to files and directories. Switch to...

    Project 4-4 In this hands-on project, you make and view links to files and directories.Switch to a command-line terminal (tty2) by pressing Ctrl+Alt+F2 and log in to the terminal using the user name of root and the password of secret.At the command prompt, type cd samples and press Enter. Next, type ls -F at the command prompt and press Enter. What files do you see? Next, type ls -l at the command prompt and press Enter. What is the link...

  • 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...

  • 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...

  • QUESTION 1 From YOUR home directory, execute a find command string that will locate the file...

    QUESTION 1 From YOUR home directory, execute a find command string that will locate the file called resolv.conf. Include the -exec flag in the find command to cat the file to the screen. Begin your find search from the letc directory Select the correct find command string below that will accomplish this. find /etc-name 'resolv.conf -cat D find /etc-name 'resolv.conf -exec cat 0 find. -name 'resolv.conf -exec cat 0\ find /-name 'resolv.conf' -exec cat 0 QUESTION 2 What find command...

  • Question: Hands-On Project 3-3 Use a Batch File A file with a bat file extension is...

    Question: Hands-On Project 3-3 Use a Batch File A file with a bat file extension is called a batch file. Yo... Use a Batch File A file with a .bat file extension is called a batch file. You can use a batch file to execute a group of commands, sometimes called a script, from a command prompt. Do the following to learn to use a batch file: 1. Using a command prompt window, copy the files in your Documents folder...

  • 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...

  • QUESTION 1 What will be the output of following Unix command: find / -name ‘*’ A....

    QUESTION 1 What will be the output of following Unix command: find / -name ‘*’ A. List all files and directories recursively starting from / B. List a file names * in / C. List all files in / directory D. List all files and directories in / directory QUESTION 2 Which command is used to extract a column/field from a text file / input. A. paste B. get C. cut D. tar QUESTION 3 Which command creates an empty...

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
Active Questions
ADVERTISEMENT