2 Replies - 903 Views - Last Post: 08 September 2012 - 05:48 AM

#1 CoryMore  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 111
  • Joined: 26-June 12

Brand new to Linux and mighty confused.

Posted 06 September 2012 - 07:12 PM

I am taking a class in Linux, and we've been given a .bash_profile file to edit. I have no idea if I'm to do this in command prompt or the file itself, nor if I'm on the right track. I'll post the questions I have to do below, and where I'm at so far.

Quote

 Create a subdirectory named oldconfig in your home directory.
 Copy the files .bash_profile and .bashrc from your home directory into the oldconfig directory.
 When you are finished with the assignment (and you have saved your work somewhere), copy the old versions of .bash_profile and .bashrc back into your home directory.

Also in the assignment area your will find two starting files, named .bash_profile and .bashrc. Download copies of those files and copy them into your home directory. You will modify these files as you complete the assignment. Do not remove anything from the given files and be sure to fill in the comment fields for your name and StudentID in both files!
You may create additional shell variables if you find that useful. You might want to look up the back-quote character and command substitution to see what effect it has. Be warned that hardwiring values, such as strings, into your configuration files will generally not provide an adequate solution.
To see the effect of changes you make, execute the command source .bash_profile within your shell window. You should also consider backing up your current versions of these files (but not to oldconfig) occasionally as you work.
To see the effect of changes you make, execute the command source .bash_profile within your shell window. You should also consider backing up your current versions of these files (but not to oldconfig) occasionally as you work.
1. Modify .bash_profile so that the PATH includes the current directory and a subdirectory of your home directory named bin. This should be implemented so that it will work correctly, without modification, even if your home directory is changed.
2. Modify .bash_profile so that your default command prompt contains the machine name, the operating system name, and the operating system release number, formatted as shown below:

locust:Linux 2.6.18-238.12.1.el5>

Hint: check out the uname and hostname commands.
3. Modify .bashrc so that entering the command list will list all the files in the current directory so that:
 Files are listed one-per-line,
 Files are classified (i.e. flagged as directories, executable, etc.,
 File sizes are shown in blocks as well as bytes,
 Owner and group associations are not shown, and
 All files are listed.

4. Modify .bashrc so that each of the commands cptree will make a complete (deep) copy of a directory tree, but will not overwrite an existing file. The command should be invoked as cptree <srcdir> <destdir>.
5. Modify .bashrc to add a user-defined shell variable named DATE and set the variable to store the time at which the .bashrc file is executed in the format:
HH:MM:SS NameOfDay DD:MM:YYYY
There is a single space before and after the name of the day, and no other spaces. For example, executing the command echo $DATE should display something like this:
Friday 23:06:50 02:09:2012
6. Modify .bash_profile so that new files created in your account will deny all access to any one except owner. See the umask command to see how to do this.


So far, I have the following (it's not much, but if I'm on the wrong path, I don't want to go far).

Quote

# Get the aliases and functions from local config file:
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
#
# Set path here:
PATH="$Path:$HOME/bin:"
export PATH
#
# Set prompt here:
PS1= '\H'

# Set default file permissions here:

# end .bash_profile


Is This A Good Question/Topic? 0
  • +

Replies To: Brand new to Linux and mighty confused.

#2 Lemur  Icon User is offline

  • Pragmatism over Dogma
  • member icon


Reputation: 1359
  • View blog
  • Posts: 3,424
  • Joined: 28-November 09

Re: Brand new to Linux and mighty confused.

Posted 07 September 2012 - 07:25 AM

Man pages are your friend, live by them. You will need familiarity with the following to complete this:

VIM
makedir
cp
mv
sftp
ls
du
df
sed
grep

...as well as some tutorials on customizing your bashrc.
Was This Post Helpful? 0
  • +
  • -

#3 no2pencil  Icon User is offline

  • Toubabo Koomi
  • member icon

Reputation: 5191
  • View blog
  • Posts: 26,901
  • Joined: 10-May 07

Re: Brand new to Linux and mighty confused.

Posted 08 September 2012 - 05:48 AM

View PostLemur, on 07 September 2012 - 10:25 AM, said:

...as well as some tutorials on customizing your bashrc.

Like this one
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1