2
votes
3answers
102 views

How do i change the global login shell on a unix system?

I want to set the login shell (the shell they get when they log in) of all existing and future users. The correct way to change the login shell seems to be chsh. But this only allows me to change the ...
1
vote
2answers
128 views

How do I iterate bash arrays and make an SCP command efficiently?

I need to scp the files from machineB and machineC to machineA. I am running my below shell script from machineA. I have setup the ssh keys properly. If the files are not there in machineB, then it ...
1
vote
1answer
54 views

cp/rsync command with destination as symlink to a directory

I am working on a cPanel backup solution at the moment. We are now informed about this exploit. Exploit : Full ROOT ACCESS to server 1.) create malicious file from, normal user account: mkdir root ...
1
vote
1answer
117 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/renaming the filenames. However, they can modify and write to the contents of the file. How to do this from ...
2
votes
2answers
564 views

Shell script command output in if condition comparison fails to compare to same value string

I'm incorporating a script snippet which determines Android version via: adb shell getprop ro.build.version.release which returns: 4.1.2 or 4.0.4 The snippet currently looks like this: if [ "$(adb ...
1
vote
2answers
91 views

If I know the PID number of a process can I know its name?

If I have the PID number for a process (on a UNIX machine), how can I know the name of its associated process? What do I have to do?
5
votes
1answer
470 views

Are ulimits inherited by the shell, by the user, or a combination?

When a process spawns a subshell, how is the ulimit inherited? Is it by user, by shell, or a combination? Specifically, this was found in the context of HP Server Automation jobs failing on some ...
-1
votes
2answers
1k views

Shell script :: Reading a column from file & store it in array [closed]

I am working on shell script where i want to store O/P of the command in array. I have a file containing rows & columns from where i want to extract 3rd column & store all values in a array. ...
0
votes
1answer
201 views

automatically start and and selectively stop multiple instances of couchdb on osx

I have successfully installed couchdb via homebrew: % brew install couchdb ...and invoked mutiple instances as directed here: % OLD=/usr/local % NEW=/tmp/couchdb % mkdir -p $NEW/etc/couchdb/ % ...
2
votes
1answer
1k views

Linux- Permission denied?

I'm installing Neo4j server as a linux service, but when I install it, I get the following message: /sbin/insserv: Permission denied What is this? What should I do? I'm running everything with ...
-1
votes
1answer
562 views

Automate git-pull, stuck with keychain

I'd like to create a cronjob to automatically run a git-pull every minute. The problem is that my repo is private, I had to create keys on my system (Ubuntu Server 12.04). I installed keychain and ...
0
votes
1answer
282 views

dsh (dancer's shell): is it possible to specify ports in config file?

Using dsh you can define the list of machines in ~/.dsh/machines.list in the form: <user>@<host> I'd like to have multiple hosts with different ssh ports, like this (I tried): ...
1
vote
4answers
73 views

Howto: command/tool ability check

When developing a shell script that should run on various unix/linux derivates, i sometimes have the problem that some tools have to be called in a different way compared to other systems. For example ...
4
votes
3answers
204 views

How to execute a command on multiple hosts using IPv6 only?

First of all there is pdsh which is essentially a parallel distributed shell which may execute commands on a list of given hosts. However, I find myself in an IPv6 only problem setting. It seems that ...
2
votes
2answers
1k views

While loop read multiple lines from a grep

I'm writing a script in AIX 5.3 that will loop through the output of a df and check each volume against another config file. If the volume appears in the config file, it will set a flag which is ...
0
votes
1answer
130 views

Execute command in background and get notified when done, with time of execution

How do I make sure I get notified when the job is done? Here is what I'm running: $ time find -exec chmod o-r '{}' \+& I would like to know how long the job took and be notified when it is ...
2
votes
1answer
521 views

How to add new path to $PATH variable in a post-installation script of RPM?

I want to automatically add a new path to the $PATH variable each time when my RPM package is installed. I tried to use a post-installation script in the my RPM. Here is the part of RPM spec file ...
0
votes
4answers
273 views

Calculate disk space occupied by many .png files

I have 357 .png files located in different sub dirs of the current dir: settings# find . -name \*.png |wc -l 357 settings# find . -name \*.png | head ./assets/authenticationIcons/audio.png ...
2
votes
2answers
157 views

Redirect STDERR separately for the shell and the program

I'm doing some audit automation, this example describes checking the version of Java, even though other programs do the same thing. The output of "java -version" goes to STDERR, which is easily ...
3
votes
1answer
1k views

Encoding to base32 from the shell

I'm looking to encode an input string to base32 encoding directly from the shell. I'm looking to do this in ubuntu, but I imagine flavor doesn't particularly matter here. Are there any existing ...
3
votes
2answers
249 views

How to Update Text in File within Unix Shell Script

I'm creating a shell script that needs to update the sudoers file. So basically I want to be able to append ":/usr/local/bin/" to the following text in /etc/sudoers: secure_path = ...
4
votes
2answers
472 views

Shell background processes: what do characters in termination message mean?

I had three background processes, and here's what I've got: [1] Done zcat jan.txt.gz > j [2]- Done zcat feb.txt.gz > f [3]+ Done ...
1
vote
2answers
282 views

Unix to run commands repeatedly on shell without using crontab

Say if I need to run a command checkstatus --jobnumber 12345 to check the job status. The command prints out the info to standard output. Is there any way to run this command on shell repeatedly every ...
0
votes
1answer
80 views

Directory replication in New server

Scenario is to replicate all the directories,sub-directories,files,symbolic links present in Linux development Server to Linux QA Server. Lot of unix users also to be created. Consider an unix ...
1
vote
1answer
243 views

How to issue an rsh command in the background?

How to issue an rsh command to run in the background? Example: within a batch file i call rsh 10.1.1.2 -lroot /etc/rtcinst/myscript.ksh which runs on a remote unix machine. This script takes a ...
-2
votes
4answers
207 views

Need to get server bandwidth usage up to the moment (in bytes)

I am writing a CRON/PHP script that will check the server stats every 5 minutes (CPU/RAM/SSD) and log the info to the database. This way I will be able to see server usage over different periods of ...
0
votes
2answers
328 views

Issues with echo commands?

I run this script as quanta suggest me #!/bin/bash EDATE=$(tail -1 a | awk '{ print substr($4, 2, length($4)) }') EEPOCH=$(date -d "$(echo "$EDATE" | awk 'BEGIN { FS = "[/:]"; } \ { ...
0
votes
3answers
78 views

problem with loop in shell

I have a problem with loop , I used while in my script as below : while read LINE do { } done but the problem is each time I should press enter while running the script, and it supposed to do this ...
0
votes
2answers
386 views

extract information from a log file

I wrote a bash script to extract a few Items like the IP addresses that makes the most number of connection attempts, now I want to limit all of this within a time range , lets say the last 5 ...
-1
votes
3answers
140 views

Determine all users on the Linux machine [duplicate]

Possible Duplicate: How to list all users and groups on linux? How to determine all the users on a Linux machine (not only the ones who are logged in)? I searched and found the following ...
0
votes
1answer
133 views

Debian terminal caching executable paths?

It appears that Debian 6.0.2.1 terminal caches path of executables, which is avoiding fresh executables to be run on the same terminal. I would like to know if this is a feature and if so, how to ...
0
votes
2answers
440 views

Cron process not starting

I have an ec2 image created with cron jobs. These jobs fail to run; I discovered the cron process in itself has not started. So, I included /usr/sbin/cron in /etc/rc.d/rc.local and created another ...
2
votes
5answers
1k views

How can I track growing directories?

I have a system that continually runs out of disk space. Im going to write a script that cleans up directories that grow larger. Usually these are log directories. Given the nature of the machine, i ...
3
votes
2answers
2k views

“No space left on device” with FreeBSD

When I login with root, and run "mkdir test", the system says "No space left on device". But if I login with other user, it goes well. [/root]df -h Filesystem Size Used Avail Capacity ...
0
votes
1answer
116 views

Declare my own script to execute file

I have two files, the first is 'ax': #!/usr/bin/env zsh print "Params: $*" cat $* And another one 'tst': #! /home/me/ax A B C When I am in sh/csh/bash shell: > ./tst ./tst: line 2: A: ...
1
vote
5answers
384 views

Web-based *nix shell

is there any solution like LogmeIn consisting on a small client to install upon a *nix machine and hence being able to use its shell from the browser bypassing proxies because it all will work on :80? ...
3
votes
3answers
709 views

sh script to remove just txt files using find and exec rm warns me of missing argument to exec

find /full/path/dir -name '*.txt' -exec /bin/rm {} \; Fine in a shell, but pop it in a sh script along with some similar lines, to get it to run nightly from a cronjob, and it reports: find: ...
0
votes
1answer
500 views

How can i acess a shell of a jail on FreeBSD?

I have access to a a previously set up FreeBSD box with a number of jails on it. One of the jails is an SQL server and does not have ssh enabled on it. How can i gain access to a shell on that sql ...
2
votes
6answers
3k views

Most effective way to change Linux command prompt for all users?

I have several machines and the hostnames are really long.. i.e. companyname-ux-staging-web1.companyname.com. So my prompt looks something like [root@mycompany-ux-staging-web1 ~]# I'd like to ...
1
vote
6answers
230 views

Teaching total beginners who prior worked with Windows only bash?

I'm supposed to give an introduction to using the shell (i.e. bash) to total beginners. Which is the most basic/useful stuff I can teach someone within 1 1/2 hours without demanding too much? Here ...
1
vote
2answers
121 views

same shell environment in all accounts

What would be the best way to get the same shell environment (paths excluded) on all my accounts automatically? What I want is something that transfers the aliases, coloring, and other cool shiznit I ...
1
vote
5answers
524 views

Ubuntu server: manually changed /etc/passwd shell for my user, now can't login

I attempted to change shell from bash to tcsh via editing /etc/passwd file directly. Yeah, dumb move. I guess I've learned my lesson. Now I can't SSH into the remote server. Any way to fix this? PS. ...
0
votes
2answers
354 views

See which directory takes space without considering other mountpoints

I often find myself having to clean up some directories because they are too full. Let's take /var as an example, as it is a common one, for obvious reasons. In order to see which sub-directories ...
1
vote
1answer
315 views

Picking a single line from a text file by its line number

In a Unix shell, how can I pick a single line from a text file by its line number? Say I want whatever is at line 3 in animals.txt to be written to stdout (bat bat bat). monkey monkey monkey cat cat ...
0
votes
2answers
3k views

How to tell wget to use the name of the target file behind the HTTP redirect?

Let's a consider link such as htttp://www.mysite.net/download.php?id=267 that redirects to htttp://www.mysite.net/downloads/myfile.tar.gz If I execute 'wget ...
4
votes
2answers
3k views

Unix separate multiple commands which has '&' (execute in background) in the end

To separate regular commands in Unix is to put semicolon in the end like this: cd /path/to/file;./someExecutable; But it seems not working for commands like this: ./myProgram1 > /dev/null & ...
2
votes
3answers
22k views

Most simple way of extracting substring in Unix shell?

What's the most simple way to extract substring on Unix shell (with regex)? Simple means: less feature less options less study Update I realized regex itself is conflicting with simplicity, and ...
1
vote
1answer
1k views

use SED recursively in linux?

I want to implement the following command recursively sed -i 's/href=\"1\//href=\"\/1\//g' ./* so that it replaces all href="1 with href="/1 in all sub-directories. Is there a flag I can add to ...
6
votes
7answers
9k views

Unix shell: easy way to get IP from hostname

What is the easiest way to get the IP from a hostname? I was thinking about trying a ping and parse it from the output. However, that doesn't seem very nice and will probably not work the same way on ...
2
votes
2answers
127 views

Safely deleting all files of a given name

On Mac OS X, .DS_Store files seem to contain custom view settings for the directory when it is viewed in Finder (file manager GUI). I want every directory to use my default view settings. Is this ...