Questions tagged [unix-shell]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
209 views

Scheduling job on crontab with custom timing

Can anyone help me scheduling a job on crontab that will run on 12th of each month and if 12th falls on weekends it should run on the next Monday. I found something from Internet but it's not working ...
Kunal's user avatar
  • 11
0 votes
0 answers
151 views

Add mac address in rsyslog template

I am trying to add system/device mac address in syslog. No solution is working for me. Following command gives me mac address, just wanted to use in rsyslog template. mac_addr=$(ifconfig en0 | awk '/...
sandip karanjekar's user avatar
0 votes
1 answer
44 views

Change Ubuntu server password every 7 days and do autologin

am working on a scenario where i need to Change Ubuntu server password every 7 days and do autologin. i tried with breaking the problem: command to create user with password: useradd -p $(openssl ...
user9990's user avatar
2 votes
0 answers
175 views

How to enable logging of commands run through shell script in ESXi Hypervisor?

On ESXi Hypervisor, If I run a command on the terminal via SSH, the commands are logged in the shell.log file, i.e if i run this command [root@esxi04:~] ls -la then I can see this command in shell.log ...
Cool Guy's user avatar
1 vote
2 answers
1k views

how to make a shell execute with suid

I'm trying to suid a shell and it's not working. I need help understanding why, and how to fix it... I'm following these steps (as root) cp /usr/bin/bash /usr/bin/bash-emergency chmod 4755 /usr/bin/...
mikem's user avatar
  • 460
2 votes
2 answers
153 views

Make a gzip-compressed tar archive of files and directories that have a specific letter

I want ONLY directories and files that contain the letter. I've been able to recreate it from a previous question. But the tar is not a gzip. And when trying to make it a gzip it...doesn't remove ...
Zweks's user avatar
  • 23
1 vote
1 answer
112 views

rush config errors: not an absolute directory name

Migrating from rssh to rush... I can't figure out what it means by not an absolute directory name. see logs below: Aug 31 14:07:24 secmgrprd04 systemd: pam_unix(systemd-user:session): session opened ...
Russell Fulton's user avatar
2 votes
2 answers
2k views

Skeleton files /etc/skel/ automatic syncing of changes to all users

Linux distributions place some important scripts and config files in the skeleton, from where they are copied to each new user's home directory. Ideally system-wide files would be used instead of ...
Tronic's user avatar
  • 121
0 votes
1 answer
321 views

Taking input on remote vm

below is my use case , I have to take a input from a user for a specific command which need to run on a remote machine.But my problem is I am not able to access that machine directly so what I am ...
Mohan's user avatar
  • 1
1 vote
1 answer
405 views

How to reliably & portably serialize binary information into POSIX shell

Problem context I am trying to implement a job orchestrator whose agent/worker programs, connect to machines via an SSH session/shell. I would like to transfer (potentially binary) files to these ...
Daniel Gray's user avatar
0 votes
1 answer
384 views

My Server is sending malicious SSH requests [duplicate]

I am facing weird issue on my server (Unix). There are couple vendors reported me that my server is sending malicious requests to their server by using SSH Protocol. I have already checked the system ...
sumit vedi's user avatar
1 vote
3 answers
468 views

Avoid to write clear password in a sh script

I'm writing shell script on my custom board. In this script I use openssl to encode file at runtime using this command: openssl des3 -salt -in file.txt -out my_file.des3 -k my_password Is there a ...
init's user avatar
  • 13
0 votes
2 answers
91 views

What if I want to delete files that are not accessed for a few days in unix?

What if I want to delete files/folders that are not accessed for a few days in Unix? Say there are some files that were last accessed 5 days ago in a particular location. I want to delete those. What ...
Nikhil Vijayan's user avatar
0 votes
1 answer
173 views

While schedule below script through crontab receive incorrect output date format is going wrong

PFB script dd=$(perl -e 'use POSIX;print strftime "%Y%m%d",localtime time-172800;') Date=$(perl -e 'use POSIX;print strftime "%d%m%Y",localtime time-172800;') for i in `cat /path/Path_CDR.txt` do cd ...
Bhushan's user avatar
0 votes
0 answers
45 views

cron job not working in unix but works when executed manually [duplicate]

I am running a cron job everyday at 21:00 UTC which downloads few csv files from sftp server, renames the downloaded files and then loads the files in database(mysql) and updates the time in database (...
Roy's user avatar
  • 1
1 vote
3 answers
104 views

text processing linux using grep awk or anything else

I want to replace in this string Wed Apr 10 06:44:10 UTC 2019 all whitespaces with comma and along with that trim off UTC part. What I have tried : var1="Wed Apr 10 06:44:10 UTC 2019" echo ${var// /,...
Alex's user avatar
  • 182
0 votes
2 answers
743 views

AWK, cut or ced...double parsing mail log to get authentication failures

I would like to parse mail log files, which originally look like this: 2018-10-23 23:27:51,026 INFO [ImapServer-4] [ip=10.10.11.50;oip=168.232.24.2;via=10.10.11.50(nginx/1.7.1);ua=Zimbra/8.8....
Labsy's user avatar
  • 53
0 votes
2 answers
577 views

How to print true if condition in shell script

I'm writing a script to change few setting according to location and to do this i selected hostname as a benchmark. My aim is, if my hostname condition comes true then do this. For this i'm writing a ...
root's user avatar
  • 39
1 vote
1 answer
3k views

Convert a raw email message to plain text in linux

I'm in the cur folder of a maildir store. I want to cat a message .. pipe it to a command .. and have the body of the message spit out. Simple. Example: If its a mime message .. and there is a ...
DHW's user avatar
  • 53
-3 votes
1 answer
2k views

Solaris - How to tell whether machine is running SPARC or Intel Chip [closed]

What command can I run to tell whether SunOS 5.10 is running a SPARC or Intel chip?
Kellen Stuart's user avatar
4 votes
2 answers
6k views

How to identify ancient KornShell version?

We had a guy retire on us, and the documentation left behind is a little on the light side. Need a little help identifying and using part an older client-server system. The server itself is ...
JonathanDavidArndt's user avatar
0 votes
1 answer
211 views

getting multiple issues while creating a scrip to update hostnames in /etc/hosts file?

I'm completely new to the scripts and hence need help to fix this. We've around 3000 VMs & 450 Physical servers which are Linux based servers (few of then ubuntu starting from 9.x & few of ...
Hrish's user avatar
  • 87
-2 votes
1 answer
2k views

How to hide the 'dn:' value in Ldap unix shell commands?

I got a problem to solve. How do i hide the 'dn:' part ? dn: uid=trebbouh,ou=2017_paris,ou=2017,ou=paris,ou=people,dc=42,dc=fr This is the command I used : ldapsearch -x -LLL uid=$USER -W
Muska's user avatar
  • 1
1 vote
1 answer
2k views

Pass parameter from Local to Sudo user [closed]

Ok if subject is not clear i will explain my doubt.I have a shell script kept at my local user called (executeAdM.sh), and when i execute this script i am connecting to SUDO user by taking commands ...
Tushar Sharma's user avatar
0 votes
1 answer
122 views

FreeBSD script - different result to manual execution (tcsh)

This question has been asked previously in https://joomla.stackexchange.com/questions/20697/securing-a-joomla-installation-on-apache-mod-php but it may belong here better since it is not Joomla ...
ExternalUse's user avatar
1 vote
1 answer
128 views

Linux Free Disk Space per Device

In my system, df -hT outputs something like this: > df -hT Sist. Arq. Tipo Tam. Usado Disp. Uso% Montado em devtmpfs devtmpfs 1,9G 8,0K 1,9G 1% /dev tmpfs tmpfs 1,...
j4x's user avatar
  • 105
0 votes
2 answers
1k views

LD_LIBRARY_PATH Configuration Setup Issues

I am facing a weird but a sensible issue, I have 2 ORACLE_HOMEs, 1st one points to ORACLE Database Software and 2nd one points to ORACLE Client Software. Why I am forced to do this - reason is: In my ...
Gaurav Bhaskar's user avatar
0 votes
1 answer
215 views

Continuously save tail of standard input

I have a program that generates large logs on the standard output. Actually I don't care about the log, but I do want to know the last 1000 lines or so if the program finishes or crashes. I want ...
steve00's user avatar
-1 votes
2 answers
2k views

bash script to detect when a file is added to folder and command exec

I am trying to write a script to detect whenever a file is added to a specific folder and run a command using the last file added name. What I am specifically trying to do is to create a QR code for ...
BashN00b's user avatar
0 votes
1 answer
151 views

How to repeat a command, like a backreference, at the cli? [closed]

What I'd like to do is run the same command twice while hitting enter once, with minimum typing. This would be the long version for example: # sudo puppet agent -tv --server foo.bar && sudo ...
spoovy's user avatar
  • 354
0 votes
2 answers
171 views

Unix: How to find the name of the ethernet interface through which I'm logged in

We have multihomed servers. And to simplify things, I would like to know the dns of the interface trough which I'm logged in. (e.g. to set PS1 thus it can be used in scp commands) My solution for ...
Thomas SV's user avatar
1 vote
1 answer
170 views

Can't get PID from backgrounded java job

The PID file for this statement is created but it is always empty. When running the shell with -x I see that $! empty, yet at the end the java job is left running in the background as desired. Why is ...
Neil H Watson's user avatar
0 votes
1 answer
350 views

remote script execution from local script linux doesn't stop for remote script prompts

script abc.sh is on machine M1 and xyz.sh is on machine M2 script abc.sh: #!/bin/bash ssh -l user1 host.com ./xyz.sh -b1 arg1 -b2 arg2 script xyz has certain user prompts like pwd etc When I ...
S.Singh's user avatar
1 vote
1 answer
1k views

Why is my awk sub command failing?

When I run df -hl | grep '/dev/disk1' | awk '{sub(/%/, \"\");print $5}' I'm getting the following error: awk: syntax error at source line 1 context is {sub(/%/, >>> \ <<< "\"...
KinsDotNet's user avatar
0 votes
2 answers
176 views

Moving files between hosts using intermediate storage area [closed]

Is there any good existing solution for moving files from host A to host C, using host B a an passive intermediate storage area. A -> B -> C Limitations Host A and host C are on separate networks ...
error's user avatar
  • 117
3 votes
1 answer
145 views

Editing the PATH in PASE

I am doing a some PHP development on an IBMi running ZendServer6. I have to call PHP by its full path of /usr/local/zendsvr6/bin/php-cli. Is there a dotfile I can edit in my home directory or some ...
Justin Dearing's user avatar
14 votes
2 answers
20k views

cp -p will preserve times for some files but not all?

I have a source directory on a machine with a bunch of files, all with the same permissions, that I want to copy to another directory, that is mounted via SMB. [tmark@dexter JR09141045 ...
tmark's user avatar
  • 141
0 votes
1 answer
917 views

Executing command remotely on another linux server from a shell script

I have a shell-script which extract details from a log file between two dates and executes a command on the output to generate some report.The log files are on different server and scripts are ...
anand's user avatar
  • 152
14 votes
5 answers
2k views

Copy file permissions, but not files in Unix

(From : https://stackoverflow.com/questions/15245144/copy-file-permissions-but-not-files, closed because off-topic) I have two copies of the same directory tree. They almost have the same files in ...
Mariano Paniga's user avatar
-2 votes
2 answers
617 views

Create symlink if source exists

I'm trying to make a symlink to a directory if it exists only and cannot figure out how. I tried various ideas I found and none worked. Most notable idea that i thought would do the job was to use ln ...
transilvlad's user avatar
5 votes
2 answers
40k views

Kill all currently running cron jobs

For some reason my cron job scripts aren't exiting cleanly and they're backing up my server. There are currently a couple hundred processes running for one of my users. I can use the following command ...
I wrestled a bear once.'s user avatar
0 votes
1 answer
2k views

unable to run the script in linux using plink

I'm unable to run a script in linux using plink.exe. I'm using my user x to login and script is under y user, which I need to sudo to y and run it. I was able to at command prompt manually but not ...
sagar's user avatar
  • 1
2 votes
1 answer
215 views

How to improve the efficiency of gnu parallel to read from a compressed stream?

Is another question extended from the previous one [1] I have a compressed file and stream them to feed into a python program, e.g. bzcat data.bz2 | parallel --no-notice -j16 --pipe python parse.py ...
Ryan's user avatar
  • 5,981
1 vote
1 answer
858 views

curl is giving wrong result via ssh

Curl is working fine on the node itself: [ec2-user@smokebase1 ~]$ curl -s -I --retry 3 --header 'Host: smoke-base.dev-test.com' localhost:8080/test/api/search?where=where%20%2Fxml%2Fitem%2Fcategory%...
A_01's user avatar
  • 133
2 votes
3 answers
2k views

No shell and launch application on login

I am working on migrating an application from OpenVMS to RedHat Linux 6. The application is a green screen terminal application. The users will log into Linux via SSH and the application should ...
greyfox's user avatar
  • 267
0 votes
1 answer
798 views

Fix Solaris 11 GNU tools location for RVM

I am trying to install RVM on a Solaris 11 system, the curl -sSL https://get.rvm.io | bash -s stable went through, but when I actually try to use rvm, it simply stats "ERROR: Missing GNU tools: grep ...
Metaphox's user avatar
  • 101
0 votes
2 answers
178 views

redirect command executed along with output shell

I would like to redirect the command executed along with the output to a file. for example: #ls >ls_out.txt ls_out.txt should be something like : ls file1 fil2 Thanks!
kumar's user avatar
  • 443
0 votes
1 answer
1k views

Check processor status- check processor/cpu status and failed/off status

I want to Check processor status- check processor/cpu status and failed/off status so for that I used command prtdiag and want to fetch the cpu status only from that. how can i do that?
user2189689's user avatar
2 votes
2 answers
298 views

Rotatelogs rotating log files mid log entry

I have a c++ tool that outputs to STDOUT via printf i.e. printf ("%s\n", logline); I then pipe that to rotatelogs i.e. tool | rotatelogs /tmp/logs/log_%s 60 Everything works great, but ...
Brian Haines's user avatar
1 vote
1 answer
86 views

Sent command-line output as an arguments to other command

1) Here is the command to install special package (for example system/header) #pkg install system/header 2) ALso we can install several packages #pkg install system/header network/ssh package/rpm ...
pavelartlover's user avatar