Questions tagged [shell]

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 programming features such as variables, substitution, output redirection, and wildcards.

Filter by
Sorted by
Tagged with
0 votes
1 answer
8k 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 ...
Registered User's user avatar
0 votes
1 answer
1k views

Can't seem to create file in bash

I'm trying to use this (under the root account) code in debian 7. #!/bin/bash cat > /root/.ssh/github.id_rsa << EOF -----BEGIN RSA PRIVATE KEY----- XYZ... -----END RSA PRIVATE KEY----- EOF ...
Jimmy's user avatar
  • 269
0 votes
1 answer
2k views

Exploit PHP File Found in /tmp directory [duplicate]

I have been alerted to by our system that a PHP shell has been found in the /tmp directory. Firstly - I would like to know how it could have got here and why it would be here - is there any way PHP ...
Chris's user avatar
  • 1,289
0 votes
4 answers
7k views

Monit failed to start shell script

So I am having a problem with monit starting a process this is my code: check process program_1 matching "program_1" start program = "/home/user1/files/start.sh" stop program = "/home/user1/files/...
Zero's user avatar
  • 113
0 votes
2 answers
16k 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' - /usr/lib64/php/...
eisaacson's user avatar
  • 525
0 votes
1 answer
61 views

Trouble using ssh-key gen specifying location and password

This is my code: ssh-keygen -t rsa -C "$APP" This works perfectly. However it then asks me to specify location and password. I was hoping I can automate this all in one go, however this command ...
J.Zil's user avatar
  • 1,123
0 votes
1 answer
2k views

Display Power on hours of hard disk from shell

Is there a program which can display the power on hours of a hard disk from a *nix shell? I'm rewriting a server benchmark program, and this would be a useful value to compare.
Joel G Mathew's user avatar
0 votes
1 answer
87 views

Store pid of a forked process in a file

I have the following but I'm worried about $! being overwritten prior to the echo command taking place. How do you guys recommend going about this? sleep 100 & >/dev/null ; echo $! >sleep....
Abdo's user avatar
  • 103
0 votes
2 answers
3k 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 ssh-...
MultiformeIngegno's user avatar
0 votes
2 answers
881 views

xargs remove file name containing $

I am using xargs to remove files from remote server. xargs -a /var/log/del.log -i -exec ssh [email protected] 'rm -rf "{}"' del.log contains path of the files which are deleted on local server and I ...
user1993197's user avatar
0 votes
2 answers
480 views

Debian shell script to update server software

A lot of my server software is installed via apt-get and I was wondering if there is a small shell script I can get which will will update all of this software. Also do I need to restart my server ...
J.Zil's user avatar
  • 1,123
0 votes
3 answers
514 views

Sudo won't execute command as another user

I'm trying to get a unicorn server to start when the server boots. I've created a shell script which works if I log as the ubuntu user and run /etc/init.d/unicorn start Shell script #!/bin/sh ...
Todorus's user avatar
0 votes
1 answer
689 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 done....
Buttle Butkus's user avatar
0 votes
1 answer
5k views

How do I tell which users PHP and Apache are running as from a shell prompt?

I need to check what users php and apache are running as via SSH. I'm pretty inexperienced and can't figure out the correct command syntax to accomplish this. It seems like the grep command should ...
Nate's user avatar
  • 459
0 votes
1 answer
223 views

All shell scripts dropping back to command line

I'm probably doing something remarkably stupid, but I can't figure out what. Running Ubuntu Server 12.04 on a cloud host (Digital Ocean, if it matters). All shell scripts do absolutely nothing and ...
Greg's user avatar
  • 187
0 votes
1 answer
17k views

How do I download all the files in a directory with cURL?

I am using cURL to try to download all files in a certain directory. Here's what my list of files looks like: I have tried to do in bash script: iiumlabs.[].csv.pgp and iiumlabs* and I guess cURL is ...
Alex Gordon's user avatar
0 votes
2 answers
5k views

syntax error near unexpected token `then'

I created bash script wich works as Nagios plugin. Here is a part of it: 44 CURDUPLEX=`ethtool $IFACE|grep "Duplex"|cut -d ':' -f 2|xargs` 45 CURSPEED=`ethtool $IFACE|grep "Speed"|cut -d ':' -f 2|...
Evgenii Iablokov's user avatar
0 votes
1 answer
4k views

Both bashrc and bash_profile won't seemingly source? VirtualMin Clean install

I am not too familiar with this level of management on a nix server however I am unable to get either the bashrc or bash_profile to source at login. Details about the server: Centos 6.0 - Basic GUI ...
Mallow's user avatar
  • 144
0 votes
2 answers
1k views

Linux Terminal: Change cursor position after 'up arrow' key press

I just switched one of my systems from Gentoo to Ubuntu. There is one difference between the two setups that is driving me mad, and I cannot figure out how to fix it. When I use the 'up arrow' to go ...
Exodist's user avatar
  • 167
0 votes
2 answers
404 views

How do I delete a matching line, the lines above and those below in the section?

In nagios config define service{ use generic-service host_name xxx.xxx.com service_description xxx Status check_command ...
nitin's user avatar
  • 2,599
0 votes
1 answer
125 views

Assistance with a backup solution.

I am currently needing to create a backup of something on my server. I zip the entire folder and it's about 1.5gb big...it has to be backed up every hour.... Alright so the size of the backup is ...
Josip Gòdly Zirdum's user avatar
0 votes
2 answers
242 views

how to manage dates in shell

emphasized textI have a file containing 14000 dates . I wrote a script to find the last 5 days , 26/03/2002:11:52:25 27/03/2002:11:52:25 29/03/2002:11:30:41 30/03/2002:11:30:41 26/03/2002:11:30:41 ...
matarsak's user avatar
0 votes
2 answers
452 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 = "[/:]"; } \ { ...
matarsak's user avatar
0 votes
1 answer
297 views

Mac terminal unix questions. Trying to install showoff.io

I installed the gem according to the instructions at showoff.io, but when I try to run show 8888 it doesn't work and I get -bash: show: command not found In their faq, they mention running gem ...
dot's user avatar
  • 103
0 votes
2 answers
1k views

Run VMware player in shell mode?

Is there a way to run vmware player in shell mode? I'm accessing the PC remotely and only have access to the RHEL shell and not the GUI. Thank you. Regards, Rayne
Rayne's user avatar
  • 211
0 votes
1 answer
2k views

creating folder with date range linux shell or C

Hi i need to create a series of folder with a range of date for exmaple createdir 2010-02-02 2010-02-05 will create : 20100202/ 20100203/ 20100204/ 20100205/ What the best way to do this with ...
Necronet's user avatar
  • 283
0 votes
1 answer
139 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: command ...
yogsototh's user avatar
  • 103
0 votes
2 answers
262 views

Reset shell margins or output?

I have two problems, in both cases the problem usually occurs when I resize my terminal client xterm. When ssh'd into a server all the output from commands doesn't scroll. It doesn't happen right ...
frogstarr78's user avatar
0 votes
1 answer
192 views

Show command prompt on reboot

In one of my linux machines, when i give reboot command at the shell command prompt then press enter, i get another command prompt and then the system reboots. $reboot $ But in one of my office ...
LinuxPenseur's user avatar
0 votes
3 answers
215 views

Construct my bash command to save me pain

OK, brief background. I accidently rm -rf my usb external hard drive. Right now I am using Photorec to recover the files. (I accidently deleted 800GB. Its my personal files. Mostly it was media, but I ...
user avatar
0 votes
2 answers
7k views

How do I change folder timestamps recursively?

I was wondering if anyone knows how to change the timestamps of folders recursively based on the latest timestamp found of the files in that folder. So for example: jon@UbuntuPanther:/media/media/...
MonkeyWrench32's user avatar
0 votes
1 answer
83 views

HOw to enable shell login for particular user in one ip

I have blocked FTP 21 port on server. NOw every connection will be via SFTP via ssh. Initially i had /etc/hosts.deny -- sshd:all But i had to remove that otherwise sftp was not working. How can i ...
user avatar
0 votes
2 answers
3k views

How can you find out which linux distribution you are currently using, from the shell? [duplicate]

Possible Duplicate: How do I find out what version of Linux is running? This happens sometimes: I ssh into a machine but I forgot (or never knew) what linux distribution it's running. How can I ...
Fragsworth's user avatar
  • 1,201
0 votes
1 answer
362 views

How do I run a process remotely from inside a shell script?

What I am trying to do is to run the shell script 'ABCDE' on one machine, but use another machine to support it. ABCDE is an all-in-one ripper/encoder/tagger script for turning CD's into digital ...
user avatar
0 votes
1 answer
25 views

cd command not recognized by a systemd service script

Hi run Debian OS and I have a shell script that runs sphinx search. The script runs fine if I run it from terminal as below: sh /home/myuser/sphinx/run_sphinx.sh Here is the content of run_sphinx.sh #...
Dev Dev's user avatar
  • 11
0 votes
1 answer
61 views

Why executable files (mode x flagged) under a folder cannot run?

I thought that a script file under my /data folder cannot be executed is because it is not set 'x' permission , but after chmod +x, it still cannot run, even my handmade simple test script cannot if I ...
Michaelzh's user avatar
  • 113
0 votes
1 answer
183 views

Any way to see output of pv when run in subshell?

I'm creating a squashfs file using dd to create a pseudo file - like described here ("under Streaming Compression" heading): mkdir empty-dir mksquashfs empty-dir squash.img -p 'sda_backup....
localhost's user avatar
  • 101
0 votes
2 answers
188 views

Command that run fine... but give me an error when "piped" to grep, inside a docker RUN?

Sorry for the title, I really can't explain better. I'm learning shell programming. I'm trying to detect if Composer has a script named "post-install-cmd". To do that, one can call composer ...
gremo's user avatar
  • 349
0 votes
1 answer
131 views

Cleaning up WordPress thumbnails; trying to find all thumbnails and delete them on Ubuntu 22

So, I'm trying to clean up some backups I have, and they're getting bigger and bigger because of, mainly, the number of thumbnails generated by WordPress per image. I came close to finding a solution, ...
AJ Tatum's user avatar
  • 103
0 votes
2 answers
2k views

Reloading /etc/ld.so.preload without starting a new shell

I'm adding a preload library using /etc/ld.so.preload. My problem is, it doesn't take effect until a new shell is created. This also happens if I remove the preload library. I get error messages for ...
Laplie Anderson's user avatar
0 votes
1 answer
164 views

checking httpd syntax from within a shell script

couldn't find this anywhere including on this boards. seems strange that nobody has run into the same need ever before. this should have a very simple answer. trying to put the httpd -t output into a ...
pottyear's user avatar
0 votes
1 answer
272 views

export new env params without outputting to terminal

I'm trying to run a script and bash export is outputting text when I don't want it to because it's breaking up the output. I need to run a script which extracts some information and then inserts it ...
Christopher Thomas's user avatar
0 votes
1 answer
325 views

Automating GDB memory dumps [closed]

I'm trying to dump memory from a process on my Linux machine using GDB, but I'm trying to automate this using a script. So far I've been using the following commands (example): $ gdb --pid [pid] (gdb) ...
BungyStudios's user avatar
0 votes
2 answers
104 views

Default solutions for very limited remote linux shells

I have a user that needs to connect to a remote machine M (via ssh) and run one in a fixed set of commands (say N in total). These commands rely on python, libraries thereof, and privileged access to ...
Acorbe's user avatar
  • 103
0 votes
1 answer
427 views

Script executes perfectly in command line but failing in cron

I have created a script to know the successful attempts and failed attempts of users,usually everyday the /var/log/secure file goes to syslog and zipped like "secure-20200910.gz" but without ...
Naveen's user avatar
  • 1
0 votes
1 answer
183 views

left outer join 2 shell output on a common key column using bash

Is there a way I can do a "left outer join" for bash output from 2 different commands based on a common key column (ip address)? For various reasons, I would like to avoid saving the output ...
louis xie's user avatar
  • 125
0 votes
2 answers
661 views

saving sql dump error in a file

I want to save error if error comes, into a file. But error not redirecting into file. I get below error and its not redirecting into file. mysqldump: Couldn't execute 'SHOW FIELDS FROM `v_comloc`': ...
addi jeo's user avatar
0 votes
1 answer
1k views

Assign multiple home directories to same user during useradd

I am working on a project in which a junior developer needs to FTP files onto the server and work in two separate directories that are at the same level on the server. Is is possible to assign BOTH ...
Nikster2014's user avatar
0 votes
1 answer
2k views

How to separate variables using awk and append it to Text file using ansible

What I got as extra variable to ansible playbook is "CHOW_app/timmy_app1/johnn_app3/harper_app4/mona_app5". This is passed as single variable to the playbook. I have to separate it and save it in a ...
saffron's user avatar
  • 153
0 votes
1 answer
66 views

Wich Shebang should you use in a shell sript?

Sorry, this is maybe a stupid question, but I am new to shell scripts. I have a file called oem-device-name.sh. I need to execute an external check for Zabbix: https://www.zabbix.com/documentation/5....
Jarne's user avatar
  • 25

1
19 20
21
22 23
28