A shell is terminology for a command-line interpreter most commonly used with Unix-like operating systems, but also used to interact with GUI-based operating systems in a more granular fashion. Not only does it allows the user to run programs from a text interface, but frequently offers basic ...

learn more… | top users | synonyms

0
votes
1answer
110 views

How to edit /proc/partitions file in linux

I know /proc is a VFS and cannot be updated by user from shell prompt. this is my understanding from the beginning. Now , I am writing one code and where I am taking care of corrupted /proc/partitions ...
0
votes
1answer
15 views

List files that will be overwritten by tar extraction

Say I have a tarball ~/foo.tar containing foo/ foo/bar.txt foo/baz.txt foo/qux/ foo/qux/corge.txt foo/qux/grauply.txt And in my home directory ~ I have an existing foo directory and the existing ...
-1
votes
1answer
106 views

Using rsync with StrictHostKeyChecking and find files older than 5 minutes from remote

I would like to use rsync to sync my files from remote to a local directory. Therefor I use StrictHostKeyChecking so that there's no need to enter a password. Now I would like to only sync files ...
0
votes
2answers
299 views

How do I change my default shell on a domain account

I use a samba4 domain account to log in on my laptop. I wanted to try zsh out, but since my user doesn't reside in /etc/passwd I found that chsh can't find my user. Can anyone advise how I can change ...
1
vote
1answer
67 views

How to pipe a file being written to?

I have a binary file that is being written to continuously. I need to read the full content of that file to a pipe (either to nc or to a FIFO) and keep reading it while its is written (i.e. the ...
3
votes
1answer
232 views

bash if statment unexpected behavior in crontab job

Here is the script bash --version | head -n1 if [ "$1" == "now" ] then echo if now execut job else echo else "_"$1"_" # make sure we are not picking any spaces if [ condition ] ...
0
votes
1answer
523 views

PHP script error 'exec(): Unable to fork…' on Ubuntu 14.04.3 LTS

I'm running unittest scripts and for test case setup I need to run shell command from time to time. As a result shell command is run around 50 times during unittest execution. It works ok on CentOS ...
1
vote
0answers
36 views

Monitor disk occupancy

The problem should be simple, but not so obvious to me. I have a process that creates temporaries in a specified directory, under MacOS X. I need to find the disk occupancy of the process, if ...
2
votes
1answer
121 views

I need a command to create a unique fingerprint from unix machine

I need to create a serial number for my application in a Unix machine. The generated serial number should be unique Do not change over time (Only changes after hard drive or mother board changes) Do ...
2
votes
1answer
370 views

lxc-attach command with redirection

I'm setting up for a Proxmox 4 server a script that migrates OpenVZ dumps from a Proxmox 3.4. The scripts scp the backups, restores them and so on. At a time of the process, I'd like to wipe /etc/...
1
vote
2answers
32 views

Echo Variable - Same way, different output

I wrote a shell script with the following content: #!/bin/bash value=`cat test.txt` echo "Output: $value" >> currentOutput.txt By executing this script in shell, it writes correctly the ...
0
votes
0answers
23 views

SSH client - prompt editable as Windows control

Is there a way to configure PuTTY (or some other SSH client) to be aware of what's currently typed into the prompt and make it editable via the mouse (like in an input box / textfield that shows at ...
0
votes
1answer
111 views

Prevent accidental execution of commands in Linux if pasting text containing one or more return characters

Sometimes if text that is on the clipboard is pasted into shell and it contains a return character it will execute even though that wasn't the intention. Sometimes even multiple lines may be pasted ...
1
vote
1answer
157 views

Bash: How do I pass “command not found” text into my trap function?

I have the following: test.sh . Foo.sh Foo.bar Foo.baz Foo.blah and Foo.sh function Foo.bar() { echo 'I am a bar!' } function Foo.baz() { echo 'But, I am a baz!' } function Foo.error()...
1
vote
0answers
48 views

restart apache instances using cgi shell script [closed]

I'm trying to restart my apache instances in the server from my browser. For this I'm using shell script with cgi. Below is my code snippet. echo '<FORM METHOD="GET" ACTION="">' ...
0
votes
2answers
274 views

Changed /bin/sh to /bin/busybox for root, broke SSH access. How to fix it?

I made a silly mistake... I was playing around with busybox and used chsh to switch the root shell from /bin/sh to /bin/busybox which seems to have broken the SSH access. When I do: root@dev:~$ ssh ...
1
vote
1answer
20 views

SFTP script gets different destination response when run from different directories

I'm baffled by an SFTP shell script and any help would be greatly appreciated. I wrote an sftp script to connect to and upload ACH information to a banking site. The script uses 'expect' to wait for ...
0
votes
0answers
55 views

why a user account with /bin/false shell in directory server is asking for membership in groups?

Firstly, we use ldap for user authentication. I have accidentally deleted a person account(his loginShell is /bin/false)from our directory server(sun DS7) running on red hat enterprise linux, although ...
0
votes
0answers
349 views

Restart ffmpeg process streaming rtmp video if it fails using shell script

We use ffmpeg to forward streams live. Often due to unknown reasons or due to the stream stopping temporarily the command stops running in the background. What's the best way to monitor and continue ...
1
vote
1answer
53 views

Running “find” and piping the output to “wc”/“sort”, inside an outer “find -exec”

I've a folder used by imapsync to store its own cache. Such a folder contains a subfolder for each of the mailbox I'm syncing, and nothing more: [dv@monitor] find * -maxdepth 0 -type d | wc -l 126 [...
0
votes
0answers
32 views

Why upstart starts my processes in an inconsistent way

I'm debugging a strange issue with upstart managed jobs. I have a ruby web application which is started using passenger and I generate upstart configuration files using foreman The problematic ...
29
votes
5answers
4k views

Why does it take tens of seconds to get a shell prompt?

It's a sort of regular occurrence that, after SSHing to a server (or even opening a terminal on my Mac), the login banner prints immediately but it takes ~10 seconds to a minute for the shell prompt ...
1
vote
2answers
140 views

Shutting down host from within jail

I've created a jail with ssh using Finch-Freebsd on a NAS4FREE and added a local non super user to access the jail via ssh. I want to be able to grant this user limited shell access specifically to ...
0
votes
1answer
28 views

Cannot change default shell in solaris 8

I have a situation. We have Solaris 8 machines. For every users we have to change the shell from /bin/sh to .../sdshell. So far we have been doing it by editing the /etc/passwd file manually. Is ...
1
vote
1answer
62 views

Python script crashes when run via Cron

I have a python script that completes exactly as expected when run manually as the root user. When I put the script into cron.daily it crashes 100% of the time. The error is a timeout error, but ...
0
votes
1answer
79 views

sudo (-E) doesn't preserve path, even when configured appropriately

I have circus installed in a python virtualenv using virtualenvwrapper, and I want to run it with sudo. Sounds simple, right? Unfortunately even after reading man sudo and man sudoers, I don't ...
1
vote
2answers
95 views

How to prevent rsync from chown'ing remote users files

I'm doing rsync /local/path/to/src user1@remote:/path/to/dest. dest belongs to user2@remote. How do I keep rsync from chown'ing dest to user1 after syncing? Please note that I have already tried ...
0
votes
2answers
27 views

Move all ls output and symlink

I want to move some of my files in directory to another drive and create symlink for each of them in the old directory that will point to the new directory. For example, [root@localhost olddir]# ls ...
0
votes
2answers
166 views

How can I redirect logfile output to a network socket?

I am using a commercial Java app which writes it's logfiles using log4j. I'd like to get those logfile entries into Syslog where we have specific filters setup to trigger on system events. Log4j ...
-1
votes
0answers
28 views

bash scripting and comparing 2 directories - Beginner [duplicate]

My problem is that i have to check what files are included in the $directory, then i have to make a new file with name specified by me and compare if the name doesn't already exist in this directory ( ...
3
votes
2answers
2k views

Shell script for docker ps -a | grep to find number of certain containers running

I want to write a script that is executed by my development build server that will remove any 'similar' docker containers before building and running a new container. Below is pseudo code for the ...
1
vote
2answers
47 views

Dangers of closing file descriptors

In the Stack Overflow question Check if a program exists from a bash script the accepted answer notes that closing stderr is dangerous: (minor side-note: some will suggest 2>&- is the same 2>/...
2
votes
3answers
76 views

Execute Shell loop in parallel, but only N workers

We have more than 100 git repos, and sometimes I want to grep over all. To update the repos I use this: for repo in *; do (cd $repo; git checkout master; git pull); done This is quite slow. How ...
1
vote
1answer
265 views

Does whitespace matter in nginx conf files?

I have an nginx conf file that due to using environment variables, I have a shell script echo, this file I refer to as nginx.conf.template, then I place the echoed result into the actual nginx.conf, ...
-6
votes
1answer
34 views

How to enable ssh access without public/private keys [closed]

I want to access my server via terminal like this: ssh username@host.com Password: (enters password) ... I have access to cpanel for this server. There is a section called "SSH access" where I can ...
0
votes
1answer
98 views

Change shell prompt based on container name?

I have been doing a lot of work using Linux containers, and I keep forgetting which of the terminals on my screen is running inside which container, particularly when I leave them open overnight. How ...
2
votes
1answer
488 views

unexpected end of file error in script file

#!/bin/sh # Host = ############### Port = #### email_id="##################" email_sub="######" # if ping -q -c 5 $Host >/dev/null then result_host="Successful" else result_host="Not ...
2
votes
2answers
88 views

Why is the cron ENV different from the user's ENV?

On a new Ubuntu install, a user's PATH is: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games But in that same user's cron environment, it is: /usr/bin:/bin ...
2
votes
1answer
103 views

Echo each shell script command with a timestamp

set -x or set -v prints every executed command. How do I get the command printed with the time when the command started executing?
0
votes
1answer
3k views

run PHP file from shell script

I have never added a cron job and am not much use with shell either... My chosen cron directory is /etc/cron.daily/ all I need my script to do is run a php file daily. I would be nice if it ran at ...
0
votes
3answers
147 views

Doing a backup with mysqldump and drop it on another server (Bash)

I'm using a cron job to do backups hourly and now, I want to drop those backups on another server by default. My script is the following: mysqldump -u db_user -p db_password db_name| gzip > /...
5
votes
1answer
378 views

Running detached screen session but without termination in the same bash

Here are already many questions like this, but every one recommends (a variant of) the following solution: screen -dmS somename bash -c "/path/to/script; bash -l" e.g. when the script ends, run an ...
2
votes
3answers
398 views

What is making /tmp/info-html*.tmp files and how do I stop it?

What is making /tmp/info-html*.tmp files and how do I stop it or configure it to clean these up and/or make these somewhere else? For example, # ll /tmp/info-html* -rw-r--r-- 1 user user 0 Oct 30 ...
0
votes
1answer
898 views

sftp: get file by mtime

Objective: Connect to sftp server with very simple script using -b option, cd to directory and get file with the latest modified time or created time. I can connect and download *.csv but that may ...
1
vote
2answers
730 views

Why can't I capture AWS EC2 CLI Output in Bash?

I am trying to capture the output of an aws ec2 delete-snapshot in a Bash script command but I cannot get anything to capture the output. I have tried result=$(command), result=`command` etc. but when ...
4
votes
2answers
1k views

How to generate gpg key without user interaction?

I found in https://www.gnupg.org/documentation/manuals/gnupg/Unattended-GPG-key-generation.html#Unattended-GPG-key-generation method to generate gpg keys without user interaction, but it doesn't seem ...
1
vote
1answer
135 views

Trouble installing ZSH

I did the following: yum install zsh Then chsh eduar New shell [/bin/bash]: /bin/zsh When I type: curl -L http://install.ohmyz.sh | sh I got this: You already have Oh My Zsh ...
0
votes
2answers
2k views

Shell Script to connect to Database and execute query [closed]

#!bin/bash Query="update table_name set colume ='i' where column_name is NOT NUll" mysql -u username -p password mysql <<EOF $query; EOF The above script is not working
2
votes
1answer
4k views

Add cronjob with bash script - No crontab for root [duplicate]

I have a deployment script and in it I'm trying to add a cron job. This is the code I am using which I found on stackoverflow. I'm running debian 8. # ADD CRON crontab -l > mycron echo "10 * * * * ...
1
vote
0answers
101 views

mail send format issue in different linux servers

I have created a send mail script which will run on couple of my client servers. The mail was sent correctly in couple of servers but in some servers the format we receive is not what what we expected....