1
vote
1answer
49 views

.bashrc and .bash_profile not executed [on hold]

I'm running RHEL5. I added simple alias command into ~/.bashrc. When I start a new terminal, nothing happens but source ~/.bashrc works so I know the syntax is correct. I also ...
0
votes
0answers
35 views

bash script to verify rhel patching

we have several redhat servers which we patch from redhat satellite. To avoid confusion, I'll use the term "host" to denote the server which is being patched. We have a script, say, patch.sh, which ...
1
vote
2answers
40 views

profile.d on headless server

Is it a bad idea to put variables needed by a daemon program running at boot on a headless system in /etc/profile.d/? From my understanding profile.d doesn't get executed until someone logs into the ...
2
votes
3answers
113 views

Run a script on multiple shells?

I have two servers one AIX with default shell ksh, the other RHEL with default shell bash. I have a script that is mounted on both that will run similar commands but for either AIX or Linux. This ...
0
votes
1answer
82 views

Answer password prompt programmatically via shell script

I would like to programmatically answer a password prompt using only shell script when prompted. Is it possible to automate this task in this way? I want to avoid other tools entirely - so no expect ...
1
vote
2answers
243 views

Chown permission denied on owned dir

I have following directory (/usr/local) rwxr-xr-x. 43 root root 4096 Jul 25 14:19 . rwxr-xr-x. 14 root root 4096 Feb 21 10:27 .. rwxr-xr-x. 2 root root 4096 Jun 28 2011 bin [...] rwxr-xr-x 1 ...
1
vote
3answers
171 views

Create directories from a list of files with spaces in name

I have a directory with a list of files in it. All these files have spaces in their names. I would like to create a directory, for each file, with the name of the file except the extension (which is ...
0
votes
1answer
2k views

No package * available. cannot install git through yum

I am trying to install git on my Red Hat Enterprise Linux 6.5 server and have hit a brick wall. I can't find the package dependencies for git using yum. [root@FOOBAR mydir]# yum install ...
6
votes
3answers
575 views

How to stop Fork Bomb out of memory error - RHEL 6

I set up test VM to test the effect of fork bombs. So I edited the limits.conf as follows for root user: root hard nproc 512 Now I drop a fork bomb like so: :(){ :|:& };: After ...
2
votes
0answers
886 views

Script stops command in it with exit 0

When I write a bash script similar to this on RHEL 6, if [ "$2" = "" ] ; then echo vip.start: ERROR: no NIC specified echo vip.start: Need IP and base interface name exit 1 fi case "$1" ...
1
vote
0answers
31 views

why bash history overlap the prompt when scroll up in the history? [duplicate]

I customized my bash prompt, PS1 value. ~/.bashrc: Color_Off='\e[0m' # Text Reset BGreen='\e[1;32m' # Green BPurple='\e[1;35m' # Purple BWhite='\e[1;37m' # White ...
2
votes
2answers
862 views

How to automate connecting to multiple network devices, running a command and saving the output to a file?

I have to run a command on around 1000 network devices and save the output to a file. In a file I have a list of all the network device names that have to be connected to using SSH. I then have to run ...
1
vote
0answers
968 views

nscd uses 100% cpu

I'm working on a linux box and the output of top reveals that the command nscd (user nscd) is using 100% of CPU. I'm uploading a flat file to MySQL from this box, and it is taking a long time (albeit ...
6
votes
4answers
2k views

What's the difference between a hard links and copied files?

RHEL 6 My understanding is that hard links include a copy of the original file and that I could delete a hard-linked file in one directory, and it would still exist in the other directory. If ...
1
vote
4answers
206 views

Why would someone want to change the last access date of a file without making actual changes within the file itself?

CentOS 6 I'm studying RHEL / Centos and recently learned that the touch command can be used to change the last access date of a file. I'm struggling to understand a practical reason why anyone would ...
5
votes
2answers
4k views

Difference between >> and >\> operators?

RHEL 6 Is there a difference between the >> and >\> operators? I read the following blurb in a RHEL training book: "You can add standard output to the end of an existing file with a ...
3
votes
5answers
3k views

What is the easiest way to tell RHEL5 from RHEL6 in a bash script?

I work in an environment where we are slowly transitioning machines from Red Hat Enterprise Linux 5 to RHEL 6. I need some of my scripts to do something subtly different on RHEL6 machines to what is ...
8
votes
2answers
6k views

/dev/tcp listen instead of nc listen

With a netcat listener like: nc -l <port> < ~/.bashrc I can grab my .bashrc on a new machine (doesn't have nc or LDAP) with: cat < /dev/tcp/<ip>/<port> > ~/.bashrc My ...
16
votes
3answers
5k views

Piping from grep to awk not working

I am trying to grep the ongoing tail of file log and get the nth word from a line. Example file: $ cat > test.txt <<EOL Beam goes blah John goes hey Beam goes what? John goes forget it Beam ...
5
votes
1answer
479 views

Run script when specific users logout

I need to run my application in screen when specific users are logged out and kill the screen when someone from my user list logged in. So I am thinking about bash script, which will be called ...
0
votes
3answers
393 views

Prevent init daemon echoing on TTY

Below is an init script which starts/stops a daemon. The daemon is unfortunately printing the parsed packet data (from /home/nuthan/program/server), a socket server written in perl, listening to a ...
2
votes
2answers
829 views

su - username -c “./script.sh” -> no such file or directory

We have: a user nico. a folder /home/nico/script_home with some bash scripts: main.sh subscripta.sh sqlscripta.sh We connect as root and cd /home/nico/script_home/ Finally we run ./main.sh We ...
1
vote
1answer
2k 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. ...
4
votes
2answers
455 views

'man' page is too narrow (not taking advantage of terminal size)

I'm making my first 'man' page and I'm using groff to do it. However, when I "compile" it and view it, it only takes up a certain amount of columns in my terminal. I've tried viewing other man pages ...
6
votes
1answer
3k views

Why does redirection (>) not work sometimes but appending (>>) does?

While studying for the RHCE, I came across a situation where stdin redirection does not work in bash: # file /tmp/users.txt /tmp/users.txt: cannot open `/tmp/users.txt' (No such file or directory) ...
3
votes
5answers
1k views

Does $SHELL store the path to the default shell in Linux?

My administrator says that my default shell is set to bash, but $ echo $SHELL /bin/csh $ Is the default shell related to the SHELL variable at all? Is not, what is the variable used for?