.bashrc is the primary configuration file for the bash shell.
2
votes
0answers
61 views
.bashrc alias not working [closed]
I have set up a few aliases in my .bashrc file, like the following:
alias ras='rails server'
alias res='redis-server'
alias rc='rails console'
alias be='bundle exec'
# git alias's are as follows
...
1
vote
3answers
75 views
In bash, how can I erase an alias without logout? [duplicate]
I had an alias in my .bashrc and I really don't want it anymore. I erased the alias, but my bash already has this alias loaded.
Can I erase this alias from this bash without logging out?
3
votes
1answer
61 views
Keep two bash history files, one with ignoredups, one with everything
For the purposes of looking at which commands I am using the most, I'd like to keep a record of command I type in my bash history (even duplicates).
But, for sanity and ease of use, I still want to ...
1
vote
1answer
216 views
How to colorize “root” in red in CentOS?
This is the content of /etc/bashrc, I would like to modify it for show "root" as red but don't know where to add the color code.
# /etc/bashrc
# System wide functions and aliases
# Environment stuff ...
0
votes
1answer
52 views
Is it possible to change shell using bashrc when assigned a nologin default shell?
i have assigned a /sbin/nologin shell to a user while creating that user (specifying -s option in useradd), if this user logs in using SFTP and changes his .bashrc file, will he be able to change his ...
6
votes
1answer
364 views
How can I change screen's hardstatus color based on the logged in user?
I haven't edited/created a .screenrc file in a while, but this is what I'm currently using:
# Turn off the screen startup message
startup_message off
# Define format of bottom ...
0
votes
0answers
138 views
sftp gives an error: “Received message too long” and what is the reason?
I was able to do sftp yesterday to a RHEL 5.4 box (RedHat) and today I can't.
The message is "Received message too long 778199411", and after some investigation, it was due to my RHEL box's .bashrc ...
0
votes
3answers
169 views
What is the difference between '.' and 'source' in shells? [duplicate]
Possible Duplicate:
running script with “. ” and with “source ”
I have used both the dot command '.' and 'source' to reload a given rc file (typically to update my environment variables) ...
1
vote
1answer
141 views
execute bash script inside .bashrc
Hi I am curious if it is possible to execute a bash script inside bash rc. It would seem to create a infinite loop unless there was some way to tell it to not try and start a new shell.
Here is an ...
0
votes
1answer
226 views
Login script for bash not loading
I am very confused about the login script for bash. I have always used ~/.bash_profile to configure my bash shell. Now I am on a new system just as a user: I am not root. This system was originally ...
4
votes
1answer
76 views
View shell function's current definition
So I am editing bashrc constantly, and I have a terminal open with a working function definition, although bashrc has been updated with a wrong function definition. (Because the definition do not ...
2
votes
1answer
168 views
How to make a permanent variable
In terminal:
VAR="Extremely long and often used command"
echo $VAR
Output:
Extremely long and often used command
So far it works fine, but after restarting a terminal my variable doesn't ...
3
votes
2answers
189 views
Run ssh login command without modifying remote .bashrc
We have a bunch of servers set up with set -o vi in their ~/.bashrc.
It would be nice to be able to ssh into these boxes and automagically run set -o emacs as a timesave.
I've seen a solution ...
0
votes
1answer
118 views
Bash script for Angstrom
I have written a bash script to automate cross-compiling an OpenCV program:
echo "Compiling started for: $1"
if [[ $1 == *.c ]]
then
gcc -ggdb `pkg-config --cflags opencv` -o `basename $1 .c` $1 ...
2
votes
1answer
77 views
How to link different (incompatible) libraries at runtime depending on program?
I have a number of legacy codes that need to be compiled with specific (and often conflicting) libraries. To be specific I have a program which can only be compiled with g77 and another program which ...
2
votes
3answers
136 views
What is the difference between ./script and . ./script? [duplicate]
Possible Duplicate:
Using ‘.’ to execute files in bash
I was trying to figure out how to export my environmental via script instead of changing my .bashrc file.
I found this old useful ...
2
votes
3answers
289 views
Added bin directory to my path, can't execute commands in it with 'sudo command'
I made a bin directory in my home folder where I place all my scripts. Then in my .bashrc I added the following:
export PATH=$PATH:/home/myusername/bin
So I could access files I placed in there ...
9
votes
5answers
288 views
How to test for possible conflicts while using alias in bashrc?
Is there a simple way to list all the command conflicts that have occurred in the system due to the bashrc update involving alias commands?
For example, someone writes alias ...
1
vote
2answers
670 views
What is the difference between interactive shells, login shells, non-login shell and their use cases? [duplicate]
Possible Duplicate:
Difference between Login Shell and Non-Login Shell?
I have been looking at /etc/profile. bash.bashrc to see how they are run, and notice that some are executed by ...
0
votes
0answers
31 views
Loading my bashrc without sourcing it everytime [duplicate]
Possible Duplicate:
.bashrc doesn't get executed
I have my .bashrc file properly setup but for some reason, when I login into the server, it does not load the custom profile.
...
2
votes
2answers
684 views
Global bash_profile
I realize there are /etc/profile and /etc/bashrc files for setting global environment variables and maybe I'm just misunderstanding their purposes, but...
Is their a global bash_profile file?
This ...
3
votes
1answer
634 views
Problems with automatically starting screen on SSH login
I'm looking at http://taint.org/wk/RemoteLoginAutoScreen to setup my server so it autostarts a screen session when I login via SSH.
I have added the following to my .bashrc:
# Auto-screen ...
2
votes
2answers
93 views
Is there any way I can fit this into my ~/.bashrc as a function?
I just discovered this useful bit of code on this useful-looking website.
#!/bin/sh
exec tclsh "$0" ${1+"$@"}
proc main {} {
set lines [lrange [split [read stdin] \n] 0 end-1]
set count ...
1
vote
0answers
198 views
How to use history commands with readonly PROMPT_COMMAND?
I'm sometimes logged in on a host which I do not control and where PROMPT_COMMAND is readonly. Is there some way to work around this to run history commands anyway, for example using PS1? I've tried ...
4
votes
2answers
2k views
How do I get rid of Cygwin's /cygdrive prefix in all paths?
I'm switching to Cygwin from the bash shell that ships with Git for Windows, and encountering a strange problem. Someone thought it would be a good idea to add /cygdrive/ to all paths, while I think ...
2
votes
3answers
133 views
When the lines of a file or directory get too long, upgrade to ls list format?
Is there a way I can do this? For example if a gets a long name like:
i-have-names-that-are-too-long-to-describe/
i-have-names-that-are-too-long-to-describe-2/
...
0
votes
2answers
935 views
How to assign user root rights?
I have Suse Linux on my desktop. So I am root and "normal" user.
Frequently e.g. to start tomcat or install/remove a program I should use sudo or switch to super user. But I have defined many aliases ...
8
votes
2answers
2k views
What is the difference between ~/.profile, ~/.bashrc, ~/.bash_profile, ~/.gnomerc, /etc/bash_bashrc, /etc/screenrc …?
Answers to the questions on SO and askubuntu, along with poking through (and reading headers of) $HOME and /etc/, indicate a number of files that can be used to set environment variables, including:
...
2
votes
3answers
679 views
Issues with .bash_profile and terminal commands
I added some data to my .bash_profile to run two aliases ruby version 19 and the proper gems. As soon as I added the data I could not longer run any commands such as the MacPorts command port nor the ...
1
vote
1answer
102 views
What's the right way to reuse this one-liner?
I recently came up with the following one-liner:
for f in *.mp3; do sha1sum $f | sed -r 's/[a-z]//g' | cut -c1-2 | awk '{ print ($1 >= 255) ? $1 - $1 + (1/3)*$1 : $1 }' | xargs -i id3v2 -T {} $f; ...
7
votes
3answers
277 views
How can I find a rogue alias declaration?
I'm trying to find where a specific alias has been declared. I've searched all the usual places I know to look for aliases:
~/.bashrc
~/.bash_profile
/etc/bashrc
/etc/profile
With no luck.
I know ...
1
vote
2answers
1k views
Where is the system profile that gets sourced at login on CentOS 5.8?
In CentOS release 5.8 (Final), where is the bash system profile?
Is it /etc/profile ?
I've added the following to source my ~/.bashrc file but haven't had any luck as it fails. I know it fails ...
2
votes
1answer
178 views
Alias in .bashrc doesn't seem to accept an argument [duplicate]
Possible Duplicate:
In Bash, when to alias, when to script, and when to write a function?
I'm trying to setup an alias in my .bashrc file, but it's not working as expected.
I have this ...
10
votes
4answers
590 views
How can I source the bashrc file every time I 'clear'
This might be a bad idea. The more I think about it the more I come to the realization that I probably shouldn't do it... but I've been trying and failing so I REALLY want to know how to do it, even ...
7
votes
7answers
655 views
Doing simple math on the command line using bash functions: $1 divided by $2 (using bc perhaps)
Sometimes I need to divide one number by another. It would be great if I could just define a bash function for this. So far, I am forced to use expressions like
echo 'scale=25;65320/670' | bc
but ...
5
votes
1answer
547 views
How to detect when a shell is owned by a remote SSH session?
My question is similar to this one, but I'm looking for something slightly different. I have a notebook PC that I use to access Linux machines on a network in two different scenarios:
I have a ...
29
votes
4answers
37k views
How to correctly add a path to PATH?
I'm wondering where a new path has to be added to PATH environment variable. I know this is accomplished editing .bash_rc (for example), but it's not clear how to do this.
This way:
export ...
2
votes
0answers
214 views
Populate PS1 asynchronously
I have a few git svn related functions that see if I have to pull/push from/to the repository.
My problem is that the functions I've wrote to gather these informations are too slow, I'd like to make ...
14
votes
2answers
636 views
.bashrc overwritten but still sourced — how can it be recovered?
Usually when I find a command I want to alias, I echo it to my .bashrc like so:
[up button pressed to last command, then line edited so that it reads]
$echo "command-i-just-did" >> ~/.bashrc
...
0
votes
1answer
765 views
.bashrc doesn't get executed
I have a user (non-root) which has a ~/.bashrc file with some aliases in it.
But it doesn't look like the file is executed at log in time. If I do source ~/.bashrc then it does what it's supposed to. ...
5
votes
2answers
347 views
Can a home directory have both .cshrc and .bashrc files?
Or are they both not allowed at the same time?