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

6
votes
5answers
2k views

Run a script from anywhere

I have a script: #!/bin/bash echo "$(dirname $(readlink -e $1))/$(basename $1)" that sits here: /home/myuser/bin/abspath.sh which has execute permissions. If I run echo $PATH I get the following: ...
0
votes
0answers
15 views

Why wont my service run after reboot?

I have created the following service in the directory /etc/init.d of my Debian 7.2 Wheezy machine: #!/bin/sh ### BEGIN INIT INFO # Provides: myService # Required-Start: $all # ...
-2
votes
0answers
29 views

Remove same php code from all php files [closed]

I need to remove everything between following tags in all php files using ssh <?php $rfghoh = $rfghoh=$yuoopi-1; ?> Thanks
0
votes
1answer
22 views

Unable to SSH with shell into NAS: “error: openpty: Invalid argument”

I have a WD MyBook WorldEdition II (White Light) NAS here. This essentially is a ARM926EJ-S with two SATA drives attached. For quite some time, I was running Debian 6.0 Squeeze on it. Now I recently ...
1
vote
0answers
12 views

OOM using CRON but not using SHELL

When I start a java program by shell, everything is working well. However if I start the same program with the same command and same user by CRON, I get a java.lang.OutOfMemoryError just after a few ...
0
votes
0answers
6 views

sed use to replace string 2 lines after matching pattern in AIX 6.1 [migrated]

I try to replace a character, 2 lines after matching pattern. For this, I'm using this code: sed '/some_pattern/{N;N;s/word1/word2/}' /etc/filesystems > /etc/filesystems.tmp && mv -f ...
1
vote
1answer
44 views

error while playing ansible playbook

I just installed ansible on a server in aws and then created a playbook to run the same but while running i am getting error as below : ERROR! 'copy' is not a valid attribute for a Play The error ...
0
votes
0answers
10 views

MRTG Target field

Can I use OID and Shell Script in the MRTG Target field at the same time? For example Target[myrouter]: check_connection.sh&1.3.6.1.4.1.999.1:public@mydevice Please advise. Thanks
1
vote
1answer
57 views

How to create chroot'ed SFTP access on an Archlinux Server?

I've followed this instructions on the ArchWiki and GeekStuff to setup an user which can only access the server via SFTP (SSH) but without Shell (/bin/false) in a chrooted environment of his home dir. ...
0
votes
0answers
35 views

Terminal line wrapping issues only with Docker/Kubernetes

I'm on OS-X and running either iTerm or the standard OS-X terminal. In either case if I start a Debian docker container like docker run --rm -ti mycontainer:latest I get a command line prompt and line ...
2
votes
2answers
53 views

printing user of subshell obtaining root via su -

Can I print the username which is obtaining root access via su - on the root console upon obtaining root? user1$ su - password: obtained root via user1 #
0
votes
2answers
142 views

how to put files in ram

I have a server with 30 Gb ram and i have a script that put a (.ts) file (10mb) in /var/www/html/tv and script replace (.ts) file every 2 mintues. so my question is: can i mount this folder ...
1
vote
1answer
53 views

Unix move folders with pattern

How can I move subfolders with a pattern to the new location? Example list of sources: /data/aaa/_old/ /data/bbb/_old/ The destinations should be: /archive/aaa/_old/ /archive/bbb/_old/ Is ...
1
vote
1answer
43 views

nginx - How often was accessed to specific file or path? [closed]

I'm looking for a command/line to get the information how often was a specific file/path accessed from the web-server. (source: default access-log from nignx) It should check all logs (current and ...
0
votes
1answer
53 views

Looking for IPs by page visited in apache log (awk?)

I have a bunch of apache access log files and I want to know which IP addresses visited my /contacts folder. How can I collect them from all log files with shell command?
0
votes
2answers
65 views

Powershell equivalent of Ctrl+R?

In bash I can do Ctrl+R and start typing a command to have it search my history. How do I do that in powershell? Is there a way to bind a key to something like function GH($str) {get-history | ...
0
votes
0answers
18 views

Run a script if another process was spotted

I have CentOS 7 and looking for a sollution about a small issue. I want to have a sudo script to be run but only if the system executed a specific command remotely. For example: I've put my command ...
2
votes
1answer
241 views

How can I prevent shell access on a user account but show a custom message instead (on linux)?

For various reasons, I need to enable telnet access (over the private network), and when someone tries to log in with a specific user account (lets say CheckStatus), instead of giving the user a shell ...
-3
votes
1answer
26 views

How to cut a string after a number of characters in unix? [closed]

How to delete all characters in one line after point with with sed? I have a file with multiple lines like this: 123456789 3483 98765432 56345 985745634 3469 67495735 87654 Now I want to delete ...
0
votes
1answer
53 views

httpd reload as second command in bash fails

I am trying to run a command that carries out one action, to renew a certificate, and then reloads Apache. To do this I am running the following: sudo /home/ec2-user/letsencrypt/letsencrypt-auto ...
3
votes
2answers
52 views

Compare string on shell script

I'm creating a script to check the requirements about VM in one of my customer. The first part of the script is check if the OS is virtual or not. To achieve this goal I create the following script. ...
1
vote
1answer
23 views

Restrict user from executing shell commands using PHP

Let's say that i have shared hosting and i want to secure that place, from executing shell commands. I'v installed suphp, so that users can execute PHP separately. I also did some other things in ...
-1
votes
1answer
49 views

bash scripts work fine when I run it from command line but not from cron [duplicate]

I have this bash script in runtests.sh file #!/bin/bash cd /Library/WebServer/Documents/protractor_clipboards protractor testscript.js When I do this on terminal ./runtests.sh But when I try to ...
-3
votes
1answer
52 views

Run Windows Explorer on remote system from its cygwin shell through SSH [closed]

Please consider my problem :) 1) I Have a Windows 7 - x64 system with cygwin installed and SSHD running. 2) From another Windows machine , from futty, SSH to the above machine. 3) Command "TaskKill ...
-1
votes
1answer
52 views

How to use the awk,sed Modify the text?

As follows, some text 16G 16G 1.9G 40G 4G 4G 952M 60G 16G 16G 1.6G 40G 5G 780M 5G 80G I want to change all the unit from 'M' to 'G', like this 16G 16G ...
0
votes
0answers
7 views

App started as a service gets very low memory limit

I have created a service to manage an application, the Slurm resource manager. I however keep having problems with the resource availability. This is the service configuration file [Unit] ...
0
votes
1answer
135 views

Linux(redhat);Crontab; bash - script working from shell but not in Crontab - assigning command to variable fails

I know that my question was asked several times, but there is no solution for my problem. In my Company there is an Application running on a RedHat Mashine. Users connect a text Based GUI via ssh to ...
-1
votes
1answer
31 views

Folder migration ideas

I've got to the point where it impossible to load a folder on the server because there are so many sub-folders within it, getting close to 100,000. I currently store user's images in a filing system ...
0
votes
1answer
13 views

Different shell for SSH login on specific machines

I have Active Directory users with no local accounts, so they cannot use chsh. They can login to multiple different types of server and most of the time /bin/bash is the correct shell, or at least for ...
-1
votes
2answers
77 views

shell script to open many terminals from a parent terminal and execute different cmds

I want to open 5 terminals from a parent terminal and place these terminals on the screen properly so that each terminal can be viewed properly at the same time. Also, i want to execute differnet ...
0
votes
0answers
14 views

(Git-) Process not ending properly [duplicate]

I use a cronjob to call a git pull every minute: MAILTO="" */1 * * * * /home/pull.sh script: cd /home/webdir git pull origin release | grep -v "Already up-to-date" >>/home/git.txt This ...
0
votes
0answers
45 views

Not able to find root disk using prtconf in solaris

I am working on Solaris 5.10 server. I have a shell script for backup purpose. It uses the prtconf command & then searches for the root disk to create the backup. It runs the below commands. ...
2
votes
1answer
32 views

How properly handle deletion of pid.file in service script

I'm trying to write service script for application. So I can control it like this: ./myscript.sh start|stop|status On startup pid.file with process id creates, and based on it I can check status ...
0
votes
1answer
28 views

give www-data the permission to write into /home and others root directories

I have a big problem since few days with permissions on my Symfony2 application. The background : I write a PHP app with symfony2 which gives an overview of many Moodle instances on each servers ...
0
votes
2answers
58 views

How to ensure that the script and its command get killed once terminal is closed

I have written a script and it is working fine . It do some tail and grep operations. When I am closing my terminal and the greping the PID of my script , I can find the script is still present in ...
0
votes
1answer
94 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
90 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
166 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
52 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
185 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
282 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
77 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
275 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 ...
1
vote
2answers
31 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
20 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
90 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
128 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 ...
1
vote
0answers
42 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="">' ...