Solved

Can't rename .bashrc file

Posted on 2002-07-03
7
681 Views
Last Modified: 2013-12-15
I log in as root and copy my .bashrc file from my user directory to the /etc/profile.d directory using the cp command.  I then try to rename the .bashrc file and it simply doesn't work.  It doesn't say it can't find the file, in fact the rename command doesn't say anything it just returns back to the bash prompt.
"rename .bashrc java.sh"
I can see that .bashrc exists in the /etc/profile.d directory but I just can't rename it!  Am I calling the rename function correctly?  What am I doing wrong?
0
Comment
Question by:wgilster
  • 3
  • 2
  • 2
7 Comments
 
LVL 51

Accepted Solution

by:
ahoffmann earned 50 total points
ID: 7128011
try following:
  cd /etc/profile.d && mv .bashrc java.sh

0
 
LVL 20

Expert Comment

by:Gns
ID: 7129557
Ahoffmann's suggestion is correct wgilster.

You see, rename isn't what you think.
mv is the tool to move files from one name to another, rename on the other hand will rename a bunch of file from one "pattern" to another. syntax is something like: rename <old pattern> <new pettern> <files to apply rename to>.
If you had written
rename .bashrc java.sh .bashrc
it would have renamed .bashrc to java.sh

Read the relevant man pages:
man mv rename
(and perhaps an introduction to Unix/Linux;).

-- Glenn
0
 
LVL 1

Author Comment

by:wgilster
ID: 7129835
Of course that worked.
I knew that rename could do mass renaming through wildcards and parsing, but I must not have got the syntax down correctly.  It must be something like:
rename "sourcefiles" "expressiontoreplacewith" "expressiontofind"

Thanks,
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 51

Expert Comment

by:ahoffmann
ID: 7129855
rename .bashrc java.sh .bashrc
# as Glenn said.
0
 
LVL 20

Expert Comment

by:Gns
ID: 7129994
Close wgilster.
rename "expressiontofind" "expressiontoreplacewith" "sourcefiles"

Man don't bite;-)

-- Glenn
0
 
LVL 1

Author Comment

by:wgilster
ID: 7137730
I realize Man is always there for me, but when you don't know what command to use, Man doesn't help.  I just used rename because I thought it was a simple rename-a-file-command.  I guess I didn't think about the mv command.  Thanks all.
0
 
LVL 20

Expert Comment

by:Gns
ID: 7138712
man -k
apropos (which usually is an alias (or similar) for man -k)
Is there to help;-)

-- Glenn
PS. I didn't mean to be rude, it's just that these commands (mv, cp, cd, mkdir etc etc) are often mentioned (and "trained") very early in any ol' Unix/Linux introdutory book. Get one & read it, you'll have it easier afterwards. DS
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
AWS RDS 3 84
How to get maximum transfer speed over LAN 4 83
Centos 7 User to Start Apache, MariaDB, LDAP 5 40
Run Secure WMI query from CentOS 5 32
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question