d2jsp
Log InRegister
d2jsp Forums > Off-Topic > General Chat > Homework Help > Bash Scripting
Add Reply New Topic New Poll
Member
Posts: 12,348
Joined: Jun 30 2007
Gold: 1,573.00
Trader: Trusted
Feb 25 2014 11:25am
wondering if anyone can help me with these would be greatly appreciated just need some instructions or somthing

Assignment 1

___________________________________________________________________________
Environment files

create a .bash_login that welcomes you to the system by name and tells you what day of the week it is

use the "echo" command to welcome you

use the USER variable for your name

use the command "date +%A" to get the weekday

Prompts

modify your prompt to have only the last component of your current working directory and a “$”

use "`basename $PWD`" to get the last component of your current working directory

Jobs

start 3 background jobs and show them in your jobs list, then bring the second one to the foreground and kill it with ^C, then show your jobs list again

use "sleep 30 &" to create a background job that lasts for 30 seconds

use the jobs command to show your jobs

use the command fg to bring the "sleep 30" job to the foreground

Signals

start 3 background jobs, then kill them using INT, QUIT, and KILL, then use "ls" to see what got left behind

use "kill -SIGWHATEVER %JOBNUMBER" to send signals to your jobs



Assignment 2
_______________________________________________________________________________________

Make a directory in your home directory named bin to hold your scripts.

use the command "mkdir ~/bin" to make your directory

Modify your command path in your .bash_login to include your personal bin directory.

use the command "export PATH=$PATH:~/bin" in your .bash_login file to modify your path

Copy some images to your Pictures directory.

change to your Downloads directory so we can retrieve some files to use

use the command "wget -p http://zonzorp.ca/glenn/cruise2001/athens/athens.html" to retrieve a web page with some images

use cd and ls to find the images under the newly created zonzorp.ca directory

use mv to move all the JPG files to your ~/Pictures directory

delete what is left of the zonzorp.ca directory created by the wget command

Copy some files to your Documents directory, then work with them.

use the command "apt-get install bash-doc" to install extended bash documentation and example scripts

copy the example scripts from /usr/share/doc/bash/examples to your ~/Documents directory

use the tar, gzip, and zip commands to create archives in your Documents directory of the examples directory and its contents

Which one is the biggest, which is the smallest?

Use the tar, gunzip, and unzip commands to get a listing of the files in the archives without extracting them

use the find command to find all the example scripts with file dates earlier than Jan 1, 2000

use the truncate and fallocate commands to create a 1GB file each, named bigfile.t and bigfile.f respectively

use ls -l and du to compare the size and disk space consumption of the two files

Use some of the text manipulation tools.

use the cat and more commands to view the contents of the ren script found in examples/scripts.v2

use the head and tail commands to get the first 5 lines, last 5 lines, and lines 20-29 of the ren script

use the wc command to see how many lines are in the scripts in the examples directories

use an editor to create a text file in your Documents directory named "numbers.txt" with a number on each line from 1 to 10

use sort to sort the numbers.txt file

use sort to numerically sort the numbers.txt file

use "cat numbers.txt numbers.txt >doublenumbers.txt" to create a file with some duplicate lines

view the file contents, then use "sort doublenumbers.txt" to view the sorted lines

use "sort doublenumbers.txt|uniq" to remove duplicates

copy numbers.txt to newnumbers.txt

edit newnumbers.txt to remove the lines numbered 5 to 8

use diff and comm to compare numbers.txt and newnumbers.txt

use grep to find the lines with "cd" or mv in them in the ren script found in the examples/scripts.v2 directory

Use some data manipulation commands on the files in your Pictures directory

use cmp on several pairs of JPG files

use sum and md5sum to generate checksums for the JPG files

use the "file" command to see what the file types are in /usr/share/doc/bash

use the strings command on some of the executable files in the /bin directory to see what strings are in them

Use the commands on the "Other Commands" slide

use each of the commands on the "Other Commands" slide at least once to view information they present

use apt-get to install the sl, fortune, cowsay, and cmatrix commands

add a line to the end of your .bash_login to run "fortune | cowsay", then log out and back in
_________________________________________________________________________________________


Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Feb 25 2014 06:16pm
it tells you the exact commands to use. what do you need help with?
Go Back To Homework Help Topic List
Add Reply New Topic New Poll