Tagged Questions
0
votes
1answer
31 views
Identify Tasks/Process which are 7 days old in linux
How can I identify the processes running since 7 days in Linux?
0
votes
0answers
45 views
unexpected bash behaviour after console login (openSUSE)
I'm trying to install a Linux OS on the computer I use as a home server, because I liked "Raspbian" so much on my Raspberry Pi. I created a custom linux using openSUSE Studio, that's just text based ...
3
votes
0answers
57 views
Fork vs. thread system time [closed]
I got the following logs:
Program 1:
Taken from a program executed 64 fork calls:
real 0m0.023s
user 0m0.068s
sys 0m0.008s
Program 2:
Taken from a program executed 64 thread calls:
real 0m0.613s
...
2
votes
1answer
59 views
How to write a script to read wifi SSID and password from USB drive at boot up and auto logon to wifi network
I have an embedded system that is running Debian. I want to be able to provide wifi network SSID and password information via a USB thumb drive. That way I can easily deploy it to any wifi network.
...
0
votes
2answers
77 views
How to create as many variables as needed from shell script(bash)?
I'm making a script for monitoring some user processes with Upstart but, since its for the company I work for, they asked me to do it generic...how's so?
Well, the number of processes being monitored ...
0
votes
1answer
57 views
When running a terminal, I get the default bash prompt
Whenever I run a terminal in Linux (Centos), my console line starts with:
bash-4.1$
During the Centos installation, I created a user 'mark'. Later on that day, I needed to change the name to 'john' ...
3
votes
2answers
64 views
Setuid bit seems to have no effect on bash
I was experimenting with the security of my system and noticed something strange: setting the setuid bit on a copy of bash located at /usr/bin/bash-test seemed to have no effect. When I ran an ...
2
votes
3answers
68 views
Colorize Bash Console Color
I need to be able to set my CentOS 6.4 bash prompt color to yellow.
I've managed to find where to set this (.bashrc) and the ANSI color for yellow (\e[0;33m).
I've setup my prompt as follows:
...
1
vote
3answers
77 views
string and number comparsion in bash in test statements?
I am not sure about this comparison i am doing:
if [ "$exit_status" -eq 0 ];then
#some statements
fi
is this correct way of comparing numbers or quotes make the variable exit_status a ...
0
votes
1answer
89 views
Multiple option arguments using getopts in bash
I am trying to process command line arguments using getopts in bash. One of the requirements is for the processing of an arbitrary number of option arguments (without the use of quotes).
1st example ...
8
votes
0answers
192 views
how to get exit status from the command before the last [duplicate]
I have solaris machine ( solaris 10 )
please Look on the following simple commands (haconf -makerw | grep -iq "Cluster already writable")
# haconf -makerw
VCS WARNING V-16-1-10364 Cluster ...
0
votes
0answers
32 views
How to mimic bash tab completion behavior on OS X when using Linux
I'm an OS X user who's used to ssh'ing into various Linux machines. Recently, I installed Ubuntu on one of our servers and have noticed very different tab completion behavior in bash. Among other ...
1
vote
2answers
44 views
What does the -c option of sg do?
What does the -c option of sg do? At least on my machine, the man page fails to explain this option.
-4
votes
1answer
116 views
zsh: Is it worth the switch from bash? Is it the time? [closed]
I have been a bash user for years now. However, I find that zsh is increasingly gaining momentum. I came up with the following questions:
Is zsh really becoming that popular? Will it compete with ...
0
votes
1answer
42 views
Display ONLY IP addresses of currently logged users
I want to get a list of the currently logged users and their respective IP addresses.
I tried the following command line:
w -s
However, the TTY, IDLE and WHAT columns are also displayed. I don't ...
0
votes
1answer
107 views
Run expect script from other shell
My target is to create the /var/tmp/add_user.bash script from /var/tmp/create_script_add_user.bash script
and run the expect script (add_user.bash) from create_script_add_user.bash script.
The ...
0
votes
3answers
130 views
Regular Expression for finding double characters in Bash
I am looking for a regular expression that finds all occurences of double characters in a text, a listing, etc. on the command line (Bash).
Main Question: Is there a simple way to look for sequences ...
1
vote
3answers
91 views
Sort with unequal whitespace in first column
I need to sort this list by name, high temp and low temp:
Kuala Lumpur 78 56
Seoul 85 66
Karachi 95 75
Tokyo 85 60
Lahore 85 75
Manila 90 85
I figured since whitespace is the delimiter for a column ...
1
vote
2answers
140 views
Regular expression problem(s) in Bash: [^negate] doesn't seem to work
When I execute ls /directory | grep '[^term]' in Bash I get a regular listing, as if the grep command is ignored somehow. I tried the same thing with egrep, I tried to use it with double and single ...
0
votes
1answer
89 views
Must parse ls -Al output and get file or directory name [duplicate]
I must parse ls -Al output and get file or directory name
ls -Al output :
drwxr-xr-x 12 s162103 studs 12 march 28 2012 personal domain
drwxr-xr-x 2 s162103 studs 3 march 28 ...
0
votes
3answers
87 views
output only file names(with spaces) in ls -Al
I should echo only names of files or directories with this construction:
ls -Al | while read string
do
...
done
ls -Al output :
drwxr-xr-x 12 s162103 studs 12 march 28 12:49 personal ...
1
vote
1answer
123 views
How to put value of echo pipe netcat commands into variable [duplicate]
I have this command succession:
echo -ne "/dev/shm/test.sh" | netcat 89.196.167.2 4567
and let's say it return a string like, for example "Hello...bla".
(on the 89.196.167.2 i have made a server ...
2
votes
1answer
84 views
Mystifying command not found at login
I've just set up Arch Linux (not my first time). Everything installed correctly but when I login (X isn't installed yet) I see:
Arch Linux 3.8.4-1-ARCH (tty1)
mgoszcz2 login: root
Password:
Last ...
7
votes
2answers
165 views
Cleaner way to delete files on Linux which include a datestamp as part of file name
I have a new requirement to purge MySQL dump files that are older than 30 days. The files use a naming convention of "all-mysql-YYYYMMDD-HHMM.dump". The files are located on SAN mounted file system, ...
0
votes
0answers
71 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 ...
-1
votes
2answers
43 views
Why rsh not opens and reads PAM modules and limits.conf?
I am working on a project, that uses rsh utility for remote connection.
But my project needs some extra features for that, so I add that features.
Till now, all the things are going fine. But when I ...
1
vote
2answers
88 views
Help with assigning output of grep to a variable
I hope someone can help me here. I'm trying to assign the output of a grep command to a variable in a bash script and the variable comes up empty. When I run the following:
el_value=$(grep ...
0
votes
1answer
59 views
How given script makes executables in /usr/local/bin/
While doing project , I found a script that is bounced over my head. Can you help me to understand this script . Please explain this script step by step.
SCRIPT
if ! [ -f /usr/local/bin/XXX -a -f ...
3
votes
3answers
199 views
Command to trace rsh server to check behaviour of particular system call
I am working with rsh. I want to check the whole process from beginning to end. For that I used strace.
Os name is CentOS. I am working on single machine, server and client are on same machine.
My ...
2
votes
1answer
102 views
What's those underscore commands?
When I tab tab _ in terminal, Bash suggests 206 posibilities. I tried to run one of them _git_rm but nothing happend, what are they?
Here is a screenshot:
0
votes
1answer
290 views
rsh shows “poll: protocol failure in circuit setup”, why?
In the starting rsh worked properly, but after making some changes it shows some error [changes are shown in the end of this question, see that], I am sharing the same.
Command
$ /usr/bin/rsh ...
2
votes
1answer
61 views
How to print apparently hidden environment variables?
Environment variables can be shown with env; but, some are not shown. For example...
echo $EUID might produce as result of 1000 yet
env | grep EUID produces no result.
What is this type of variable? ...
6
votes
4answers
101 views
Linux: Can I build a shortcut for a complex cd command without resorting to a shell script?
On a server I work on, I always have to work in a directory, let's call it /foo/bar. In that directory is a list of site directories. Inside each of those directories is a directory for each ...
12
votes
1answer
180 views
Bash No Longer Changes Directory
My bash shell will no longer change directory with cd. I noticed it earlier when working and found that any new shells I opened (terminal or xterm etc) would be stuck in the home directory and could ...
1
vote
3answers
137 views
Best tool for monitoring server usage
I was just wondering what the best tools for retracing logs and what logs I should be checking to work out what's going wrong with a server, or what the client has executed to get the server into it's ...
1
vote
2answers
281 views
How to display open file descriptors but not using lsof command
Hi I have read Here that lsof is not an accurate way of getting the number of File Descriptors that are currently open. He recommended to use this command instead
cat /proc/sys/fs/file-nr
While ...
3
votes
1answer
168 views
Confused about Debian error message from su
On Raspbian, the Debian distro aimed at RPi, I end up getting the following error:
$ sudo su -l root -c /bin/bash
bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no ...
2
votes
1answer
197 views
How to execute a shellscript when I plug-in a USB-device
I want to execute a script when I plug in a device in my Linux machine. For example, run xinput on mouse or a backupscript on a certain drive.
I have seen a lot of articles on this, most recently ...
3
votes
2answers
266 views
Bash script wait for processes and get return code
I am trying to create a script which will start many background command.
For each background command I need to get the return code.
I have been trying the following script :
#!/bin/bash
set -x
...
0
votes
0answers
105 views
Partitioning for Citrix Xenserver 6.1
How should look the partitioning of a 1TB hard drive for a dedicated server running Citrix Xenserver 6.1 ?
mount: / ext4 ?size?
swap swap ?size?
2
votes
1answer
111 views
bash scripting add arguments
I have created a script which takes parameters and arguments. I want to insert the --help argument.
I already know how to parse normal arguments with -, but I don't know how to parse the -- ones.
to ...
2
votes
1answer
183 views
Is there a way to temporarily change the terminal colour?
I use the gnome-terminal and most of my editors with a white on black theme as I find its easier on the eyes. One of my labs requires screenshots of the terminal (with the process) to be submitted ...
4
votes
2answers
480 views
What do the scripts in /etc/profile.d do?
I am reading about basic shell scripting from Linux Command Line and Shell Scripting Bible.
It says that the /etc/profile file sets the environment variables at startup of the Bash shell. The ...
0
votes
1answer
58 views
Browse Bash files for a distribution
With my current OS, my LANG value is set by
/etc/profile.d/lang.sh
I am curious of the code for another distribution, Linux Mint for example. How could I browse this code online, or perhaps ...
1
vote
3answers
104 views
Print files with file size less than 100 bytes
Basically this script is just supposed to print out the file size and the name of all files in a directory that are under 100 bytes. This script I wrote works perfectly on my Ubuntu, but wont work on ...
0
votes
1answer
104 views
Bash config files being read in contradiction to `man bash`
While trying to determine the differences between .bashrc and .bash_profile I notice that .bashrc is never read, and that .bash_profile is only read from SSH, but not from PHP. This seems to ...
1
vote
1answer
190 views
Identify text/ascii files in Linux/Solaris
I have a little project to build bash script that search in the OS ( Linux/Solaris ) the current IP address from files and replace them with other IP address.
The problem is that IP address could be ...
1
vote
1answer
296 views
Can I use pmap to find out Memory utilization?
I want to measure memory utilization of my Apache Server. Can I use the pmap command and pass all the process IDs of httpd and take that as total utilization?
pmap PID1 PID2 ....
It seems that pmap ...
2
votes
2answers
408 views
How to change the output redirection of a running process?
I know how to redirect output and how to suppress them in bash. Now, suppose I accidentally forgot to append the output redirection part to the command (e.g. 2>&1 or > /tmp/mystdout) and my ...
0
votes
1answer
228 views
linux + perl + replace any WORD in file with special characters with condition
Example1 work fine when I want to replace OLD_TEXT with NEW_TEXT ( its replace also all special characters as $@^%)(_+`:; etc ..)
example1
export OLD_TEXT='$$OLD_WORD$$'
export ...

