Tagged Questions
0
votes
1answer
35 views
Unable to execute command in the Linux with an user
Two scenarios here.
Sudo rights are given for a particular group.
a. A new user is created and is assigned to the group. b. Using this user, when we execute commands via shell script it is unable to ...
0
votes
1answer
19 views
How to grep top most frequent error messages in a unix logfile
If I have a file example apache log file
How to extract the top most frequent error messages in a unix log file with no timestamps
the key is most frequent error message should come on top of the ...
0
votes
1answer
37 views
How to pass wildcards in command line [closed]
So this works:
foo -a -b -c "path/file.ext"
And this too if I want to pass all files from directory:
foo -a -b -c path/*
But if I add the quotes
foo -a -b -c "path/*"
It doesn't work anymore: ...
5
votes
2answers
106 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
2answers
66 views
Bash doesn't read .bashrc unless manually started
bash won't source .bashrc from an interactive terminal unless I manually run bash from a terminal:
$ bash
or manually source it:
$ source ./.bashrc
or running:
$ st -e bash
Here's some useful ...
0
votes
2answers
63 views
Shell, bash, linux : after variable declaration, why semi-colon and what does it do?
Here is the line.
variable=`ls -A $1 | grep '[abc]'; ls -1 $1`
I understand the line before the semi-colon but I do not understand how this line works after semi-colon. Does it
after the ...
1
vote
1answer
64 views
How to prevent users from renaming files while providing write permissions on Linux [closed]
For some special purpose, I want to prevent non-root users of the Linux Server from changing or renaming the filenames. However, they can modify and write to the contents of the file. How to do this ...
7
votes
4answers
126 views
How to achieve portability with sed -i (in-place editing)?
I'm writing shell scripts for my server, which is a shared hosting running FreeBSD. I also want to be able to test them locally, on my PC running Linux. Hence, I'm trying to write them in a portable ...
0
votes
0answers
40 views
Do all Debian-based distributions come with the same default .bashrc?
I ask this out of curiosity because while I have kept my system configuration files under version control for some time now, they've only ever been for OS X. Recently, though, I've been developing ...
0
votes
2answers
116 views
Monitor servers
I want to monitor three server pages. These three pages contain a simple text (for example it says it's "working fine"). I want to be notified when anything other than this message is displayed, e.g. ...
2
votes
3answers
135 views
Wrong root shell in /etc/passwd
I wanted to change the standard shell for my root user to bash but I got the path wrong. i typed /bin/bash instead of /opt/bin/bash. Now my /etc/passwd looks like this:
...
1
vote
1answer
56 views
Access time is not being updated when i run ` ls a ` and then ` stat a`
On CentOS Linux desktop let's create a folder named a.
mkdir a
Then let's access it
ls a
and then let's get it's statistics
stat a
File: `a'
Size: 4096 Blocks: 8 IO Block: ...
1
vote
1answer
146 views
The command ` ls -ltu ` fails to list folders/files based on last accessed time
First on your linux desktop create 2 folders.
a
b
Now run this in the terminal
ls -ltu
the result is
drwxr-xr-x 2 root root 4096 Aug 30 20:33 b
drwxr-xr-x 2 root root 4096 Aug 30 20:33 a
...
-1
votes
1answer
111 views
How to create a GUI in shell script without any third party libs just like setup command [closed]
How to create a GUI in shell script without any third party libs (like setup command)
0
votes
3answers
66 views
how to check OS and version using Linux commmand [duplicate]
what is the Linux command to check the server OS and its version?
Connected the server using shell.
14
votes
4answers
572 views
What happens if you edit a script during execution?
I have a general question, which might be a result of misunderstanding of how processes are handled in Linux.
For my purposes I am going to define a 'script' as a snippet of bash code saved to a text ...
3
votes
4answers
119 views
Capture output of a bash command, parse it and store into different bash variables
Explanation:
I have a small bash script which simply runs any Linux command (e.g. say ifconfig)
The typical output of ifconfig is something like this:
eth0 Link encap:Ethernet HWaddr ...
4
votes
1answer
133 views
Send stdin to console and compressed file
I'm running a propietary program which generates text output. Kind of like a logger.
logger
I'd like to both view this output on the terminal to watch the server breathe, and send it to a text ...
2
votes
0answers
41 views
Linux child processes not being culled [closed]
This is causing significant problems for script portability between BSD and Linux.
I am on a CentOS 6.4 where this happens.
I have a nice compact test case:
bash -c "inotifywait -mcr . | sed ...
0
votes
2answers
113 views
how to add line in a /etc/sudoers file with the help of shell script (50servers)?
Anyone can help me with shell script, I want to know script which can edit /etc/sudoers file and let me add {{{{{userid ALL=(root) ALL}}}} to 50 server I have on same network?
0
votes
4answers
160 views
How to create custom commands in Unix/Linux? [closed]
I'm a newbie in Unix/Linux environment. Can anyone guide me to create custom commands in Unix/Linux. Thanks in advance
0
votes
1answer
92 views
Execute remote programs and completely detaching it
I need to execute a remote application (named ConnectionManager), which uses the ncurses library, on the remote server launching it from a local pc.
ConnectionManager is a program wich use ncurses ...
0
votes
1answer
120 views
Using a file input as stdin for a shell script does not work
I have the following script code:
test.sh
echo "BEGIN"
while read CMD <&1; do
[ -z "$CMD" ] && continue
case "$CMD" in
start)
echo "get_start"
;;
...
1
vote
1answer
159 views
Gnome + Linux: GUI apps don't inherit PATH from parent console apps
In Gnome, don't GUI applications inherit the PATH of the shell process that launches them? Apparently, GUI applications see only the PATH specified in ~/.profile. No issues with console applications, ...
1
vote
1answer
114 views
How to filter an array of strings in ksh
Please advise what's wrong in my ksh code. I want to remove the IP's as defined in "bb" array from "aa" array so the IP's 255.0.0.0 and 255.255.255.0 will be removed from the list in aa array.
When ...
5
votes
3answers
62 views
How can I remove a file called “--help” with bash command line? [duplicate]
I've somehow managed to create a file with the name "--help". If I try to remove the file using "rm" funny stuff happens. Please help
here's a printout of the dir listing:
[pavel@localhost test]$ ls ...
4
votes
3answers
145 views
Reading a binary file as an array of bytes or 16 or 32 bits using shell script
I am working on ARM-based modem Linux host machine and I need to read a bin file as an 8-,16- or 32- bits array. I basically need to encrypt the file in question and was thinking of just XOR-ing the ...
0
votes
2answers
61 views
Why are there empty lines in the output of my command?: find ~/x/y/ | shuf > ~/Desktop/z.txt
As it turns out the reason for this problem was one filename with several newlines. (No idea how that happened.)
find ~/x/y/ | shuf > ~/Desktop/z.txt
This command works pretty much as expected ...
2
votes
1answer
103 views
How can I convert this bash function to the fish shell
I'm trying out the fish shell 2.0 to replace bash. I'm trying to convert the following bash function to a fish function, but its giving me hell. I have a several similar functions so if someone ...
4
votes
2answers
174 views
How can I background a shell script during a Kickstart?
I have a Red Hat Kickstart process which reports its progress at key points via a POST request to a status server.
This is fine during %pre and %post, but when the actual build is taking place ...