Tagged Questions
2
votes
1answer
20 views
Using Bash to write to a device in /sys?
I have one of these:
Basically, it's a USB device with three LEDs (red, green, and blue).
The Linux kernel has supported this device through the usbled module for quite some time now. However, I ...
1
vote
1answer
332 views
Command/scripts to check the Reverse DNS Lookup time
I am working on a project in which one master communicates with numbers of slaves. For that it has to make connection with hosts in network. But sometimes it hangs.
I think that the reason behind is ...
0
votes
4answers
112 views
A shell script that never dies
I want to write a shell script that never dies
i.e,
Shell script will repeatedly check whether Database is alive or not for every five seconds.
The problem is At times the shell script stops ...
2
votes
2answers
73 views
How to put the following information in a CSV file?
I have a text file with the following type of content:
OPERATION_CONTEXT VMD1HTE1A71_ns:.oc.GJ_OAD2 alarm_object 1130
On director: VMD1HTE1A71_ns:.temip.VMD1HTE1A71_director
AT Fri 18 Oct 2013 ...
4
votes
1answer
59 views
returncode of command in a pipline [duplicate]
The following script runs on Solaris using /bin/ksh and on Linux using /bin/sh
cmd | tee -a cmd.log | tail
exit $?
The output of cmd is saved in a file cmd.log and the last lines are displayed on ...
0
votes
1answer
260 views
Deleting Non-empty Directory with smbclient
How can I remove a non-empty directory with smbclient?
I have tried the following:
1) rm
Result:
NT_STATUS_NO_SUCH_FILE listing [dir_path]
2) recurse;rm
Result:
No Error but also nothing ...
1
vote
1answer
64 views
Script to delete text files
I was trying to make a script that searches for all ASCII text files in the directory that you give and after that writes path of every file to a text file. After that it suppose to show head of each ...
1
vote
2answers
3k views
linux + add X days to date and get new virtual date
I have Linux ( RH 5.3) machine
I need to add/calculate 10 days plus date so then I will get new date (expiration date))
for example
# date
Sun Sep 11 07:59:16 IST 2012
So I need to get
...
-1
votes
2answers
57 views
Make a new sniffer [closed]
How can use the Linux-kernel to supervise what is going on, about the new connections, new ports, connected hosts? Like I will do a new sniffer.
Which files should I monitor to know what is going ...
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?
1
vote
3answers
71 views
Cannot add script to init.d
I have installed gerrit on a remote ubuntu server. Now I would like it to automatically start when the server reboots. I am trying to follow this:
...
2
votes
1answer
130 views
Send attachment to gmail id from shell script
I have a shell script that generates reports. Using crontab i run the scrip everyday at 1000 hrs.
I want to mail that report to my gmail id as an attachment.
I have tried using mutt but it doesnt ...
3
votes
1answer
58 views
How can I write a sed script to delete numbers from a line?
Sample File
a.b.gg3d 0000000001 0000000001 y
a.b.112a 0000000000 0000000001 y
a.b.gg3s 0000000001 0000000001 y
a.b.1111 0000000000 0000000001 m
I have a file that includes about three thousand ...
1
vote
1answer
104 views
To configure script to send email only when diff command gives a difference
I'm new to the world of scripting and and currently using a script to perform a health check on the san devices that I manage.
The script is simple and redirects output of commands to a current file ...
1
vote
3answers
113 views
Which cmd is the best for determining the OS' word size (32/64)-bit? [duplicate]
I need to find my OS (not hardware) is 32-bit / 64-bit. Which command is best?
uname -p
uname -i
uname -m
arch
All the above commands returns the same answer:
On 32 bit systems: i686/i386
On ...
2
votes
1answer
54 views
Linux: I need to create installer for my own application using shell script
Linux: I need to create installer for my own application using shell script.
I need to distribute my application as installer without GUI and also not as rpm's or any other packages.
My application ...
1
vote
2answers
68 views
Backing up a large file
I have a test running which crashes. I need to find out how far it reached before crashing. It will restart again after crashing and wipe the log file. This wiping takes 10 minutes though. So If I'm ...
2
votes
1answer
143 views
Start 4 programs on startup in Linux Mint via terminal
I'm working on a project and I hope you can help me solve a problem.
I have four programs that are written in C. They have been compiled using gcc and they work as they should. Because the four ...
2
votes
5answers
148 views
Is there a way to listen to process?
I want to know if there is a way to listen to a process in linux & unix - when it ends and what's the exit code of the process(script).
I dont want to write a script that will run X seconds and ...
1
vote
1answer
138 views
What is the pipe character “x|y)” in the case statement?
In a script /etc/network/if-up.d/avahi-autoipd in my system, I find statements like this:
case "$ADDRFAM" in
inet|NetworkManager) ;;
*) exit 0
esac
case "$METHOD" in
static|dhcp|NetworkManager) ...
1
vote
3answers
77 views
Confused on user and su in linux
How could I run a script as a specific user (non-root)? As this?
sudo su - john /usr/share/script.pl for user john?
0
votes
1answer
745 views
What does “sudo chown -R hadoop:hadoop hadoop” do?
I saw the following script, posted online, that was used during the hadoop installation process.
sudo tar xzf hadoop-0.20.2.tar.gz
sudo mv hadoop-0.20.2 hadoop
sudo chown -R hadoop:hadoop ...
1
vote
1answer
64 views
how to replace IP address on remote host using expect
I wrote the following expect script in order to replace the IP address on remote Linux machine
I use a perl one-liner for this task
I get errors about can't read "HOME": no such variable ,
Please ...
0
votes
1answer
520 views
scp stuck when trying to copy files from Linux to windows
I use the following scp syntax in order to transfer a lot of files from Linux red-hat 5 to windows machine (under Temp directory).
SSH server is already installed on windows machine. I use this line ...
18
votes
3answers
665 views
Which are the standard commands available in every Linux based distribution?
I would like to know which are the standard commands available in every Linux system.
For example if you get a debian/ubuntu/redhat/suse/arch/slackware etc, you will always find there commands like:
...
6
votes
5answers
2k views
Check if folder is a mounted remote filesystem
What is the best way (reliable, portable, etc.) to check if a given folder is on a mounted remote (nfs) filesystem within a shell script?
I am looking for a command that would look like:
...
2
votes
2answers
50 views
ksh + delete number from string
the string IP include some IP address numbers
as the following example
echo ${IP[*]}
192.9.200.1 192.9.200.2 192.9.200.3
is it possible to remove some IP address number from the list ( using ksh ...
2
votes
2answers
80 views
Is tty_nr referenced anywhere else in GNU/Linux procfs?
This is a problem I've been trying to solve on my own for some time without any luck. I'm trying to write a script that (amongst other things) can take an arbitrary PID and map it to TTY device's path ...
2
votes
3answers
334 views
What's the best way to backup files via network on Linux and Solaris machines?
I wonder what the best way to backup files VIA network
I have Solaris machines with Oracle 10i with VERITAS cluster, machines are connected to EMC storage
/data/oracle directory is mounted on the ...
1
vote
2answers
81 views
perl one liner + how to match IP address that located in the first/sec field of file
the following perl one liner syntax verify if IP address in "$IP" match the IP ADDRESS in file
perl -ne 'BEGIN{$IP=shift} print if /(^|\s)\Q$IP\E(\s|$)/;' $IP file
file have two fields
as the ...