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

2
votes
1answer
1k views

How can I start a shell inside 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 jail ...
0
votes
0answers
2 views

$PATH variable on Fish Shell OS X [migrated]

I have somehow screwed up my path variables with Fish shell on OS X. Is this the proper $PATH variable in the config.fish? Thanks! user@host ~> more ~/.config/fish/config.fish set -g -x PATH ...
1
vote
0answers
26 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
28 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
42 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 > ...
1
vote
2answers
57 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 ...
25
votes
8answers
29k views

How to add a timestamp to bash script log?

I have a constantly running script that I output to a log file: script.sh >> /var/log/logfile I'd like to add a timestamp before each line that is appended to the log. Like: Sat Sep 10 ...
4
votes
1answer
106 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 ...
0
votes
1answer
43 views

different interactive and non-interactive shells

A user account has it's shell defined in passwd file as bash. I would like to change this user account's shell to tcsh for non-interactive jobs (like ssh ), but keep interactive shell to bash. Is ...
3
votes
4answers
945 views

How to add a line to the end of a file which I can access via sudo?

I have tried: sudo "some string" >> test.txt But I am getting permission denied warning. Can anyone help?
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 ...
0
votes
2answers
30 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
28 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
39 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 ...
1
vote
1answer
22 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 ...
3
votes
4answers
7k views

Shell = Check if variable begins with #

i would be thankfull if you could help me how to figure out, how to determine if a variable's content starts with the hash sign: #!bin/sh myvar="#comment asfasfasdf" if [ myvar = #* ] this ...
4
votes
4answers
234 views

How do you differentiate between a local and remote terminal? [closed]

It's not a common scenario, but I find myself accidentally inserting commands into the wrong terminal. I haven't damaged anything important yet; So before I do, what are some of the best ways to ...
0
votes
2answers
49 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
1
vote
1answer
1k views

exchange 2007 mail contact export / import

Is there a shell command in Exchange 2007 to export the mail contacts located in Recipient Configuration > Mail Contact. we have recently started an AD forest migration and now it's time to do email ...
0
votes
1answer
106 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 * * * * ...
0
votes
1answer
96 views

How can the mutt shell-escape feature be disabled?

We are thinking of offering mutt for our member's email client. The user's shell is instead the mutt application launched on their Maildir folder. It works great so far but one huge problem is the ...
1
vote
0answers
25 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 ...
1
vote
1answer
202 views

Update version of network manager

In shell on sever I see following error after launching several commands: Error: nmcli (1.0.0) and NetworkManager (0.9.9.1) versions don't match. Force execution using --nocheck, but the results are ...
2
votes
5answers
160 views

How to make desktop notifications from long-running shell commands? [closed]

I'm currently trying to configure sphinxsearch. The indexing takes around 7 minutes. Too long to wait so I usually start doing some other tasks before testing the results. But I would like to be ...
0
votes
2answers
46 views

Add a user from root with ssh key

Perhaps a strange question, but I'm not a shell script expert. I'm provisioning an Ubuntu server starting out as root. I'd like to non-interactively setup a new user account, remove root login and ...
3
votes
6answers
12k views

How do I exclude directories when listing files?

How do I exclude directories when listing files in the current directory? ls . ^ will include directories in the listing.
0
votes
1answer
75 views

Nagios bash syntax error

I want to refer with this question to the following post where I got the Skript: Post with Script I'm using Bash 4.1.2(1) and when I try to execute the script, I get following error messages: ...
0
votes
2answers
1k views

Unable to load dynamic library '/usr/lib64/php/modules/ssh2.so' [closed]

When I try to run any php script with my user within shell, I get the following warning: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/ssh2.so' - ...
2
votes
4answers
412 views

Use logger in shell script

How can I use logger in a shell script? If I run ntpd -qnp pool.ntp.org 2> >(logger) in console, it works as expected. If I put it into a shell script #!/bin/sh ntpd -qnp pool.ntp.org ...
22
votes
12answers
13k views

How to pass alias through sudo

I have an alias that passes in some parameters to a tool that I use often. Sometimes I run as myself, sometimes under sudo. Unfortunately, of course, sudo doesn't recognise the alias. Does anyone ...
3
votes
7answers
11k views

How can I prevent explorer starting as a shell in a kiosk setting?

I'm using an alternative shell (a simple program that restarts a kiosk application if it dies) for a project I'm working on. I've set it via the Shell value in the registry, and I'm not using ...
2
votes
1answer
3k views

Setting up multiple FTP accounts on domain in Plesk 8.6 CentOS [closed]

Plesk 8.6 currently does not allow creating more than one FTP account per domain. You can setup 'web users' via the plesk interface but this sandboxes the FTP accounts outside of the web accessible ...
0
votes
1answer
36 views

Crontab is delayed by 2 hours [duplicate]

I have got a problem with two crontabs that execute some operations on my website: the first one run a command every 3 minutes and the second one at 5am in this way: m h dom mon dow command 0 ...
25
votes
24answers
41k views

Finding the Public IP address in a shell script

I can find my IP address using ifconfig or hostname -i command. But how do I find my Public IP? (I have a static public IP but I want to find it out using unix command)
3
votes
1answer
2k views

How to automatically reconcile /etc/group and /etc/gshadow

Running grpck to check the groups, I see these errors: 'twinky' is a member of the 'foo' group in /etc/group but not in /etc/gshadow 'dipsy' is a member of the 'foo' group in /etc/group but not in ...
5
votes
4answers
4k views

From a shell script, how can I check whether a table in MySQL database exists or not?

I am trying to write a script which allows a user to select the what manipulation he needs to do on a table. I want to check if the table exists or not. If it exists I will continue the other things ...
3
votes
4answers
4k views

How can I display the IP address of an interface?

If I want to display the IP address that is assigned to eth1, how can I do this in Bash?
0
votes
2answers
151 views

Installing PHP extensions to the correct PHP version

We have two versions of PHP on our Linux CentOS6 machine, 5.3.3 and 5.6.7, and wanted to install PHP extensions, memcache and imagick, to 5.6.7. Logged in as root, using yum, we installed both of ...
0
votes
2answers
50 views

Cron job ignores part of trigger url

I created a cron job to trigger a url at set times, which in turn starts a product import script. But for some reason part of the trigger url with parameters is stripped away. I set the cron job like ...
9
votes
2answers
4k views

find command default sorting order

what is the default sorting order for entries returned by the linux find command? For example, if I issue find . -type f -name '*mp3' and the output consists of multiple files across multiple ...
0
votes
0answers
34 views

Suhosin - Disable shell_exec default, allow from one directory

I have in php ini this function, which blocks shell_exec default. php.ini suhosin.executor.func.blacklist = shell_exec Its works well. When I want to allow shell_exec, so I use in httpd.conf ...
0
votes
1answer
86 views

How to scp file to remote servers' root directory and run sudo commands?

NOTE: The servers does not share the same password but I will setup no-password login at first. Here's the use case, I need to do these below step by step in my deploy.sh: scp files to remote ...
1
vote
2answers
2k views

Sending email after successful mysqldump

I've a script which will take backup of mysql db through mysqldump. I'd like add another option in this script to send an automatic email if the dump is successful or failure. Here's the script: ...
0
votes
2answers
59 views

Can I get an array as an option argument in bash script

I am writing a shell script and wants to pass multiple options in an argument. Is it possible to do that like using getopts? Requirement example: ./shell.sh -d db1 db2 should pass the values db1 ...
0
votes
1answer
24 views

Check if user is logged in VSFTPD (from the server)

I need to solve a task with a script. I moving files from a user home directory to another storage regularly (in every 5 minutes and so). How can I detect if this user is logged in (via VSFTPd ...
4
votes
3answers
3k views

How to delete empty source directories when moving folders with rsync?

rsync can be coaxed into moving folders very similarly and superiorly to traditional mv with the following options: rsync -axvvES --remove-source-files source_directory /destination/ However one ...
2
votes
4answers
2k views

Get maximum memory usage of linux executable

I need a shell script which will retrieve the maximum memory consumption of a linux executable. The executable may spawn child processes using significant amounts of RAM which should be included in ...
10
votes
3answers
4k views

How to split a PEM file

Note : This is not really a question because I already found the answer but since I didn't find it easily here I will post it so that it can benefit others. Question : How to read a concatenated PEM ...
4
votes
5answers
11k views

Timeout ssh sessions after inactivity?

PCI-DSS 3.0 requirement 8.1.8 states: "If a session has been idle for more than 15 minutes, require the user to re-authenticate to re-activate the terminal or session." Same was in PCI-DSS 2.0 ...
6
votes
4answers
3k views

Can I disable interactive shell access while tunneling web traffic through SSH?

I am looking into implementing SSH tunneling as a cheap VPN solution for outside users to access Intranet-only facing web applications. I currently am using Ubuntu Server 10.04.1 64 bit with OpenSSH ...