Bash is the Bourne Again SHell, the successor to the classic Unix sh (shell).
0
votes
1answer
36 views
Pipe tail output via elinks
Consider the following command:
elinks -dump file.html
It will print the file, formatted as plain text (without HTML tags).
The file.html is constantly updated (a new data is appended) and I want ...
0
votes
1answer
37 views
Review of a crontab script to add timestamps to minutely runs; any suggestions?
I've got a crontab job set to run minutely as such:
* * * * * /home/username/public_html/domain.tld/production/scripts/cron_runner.sh
My goal is to add some timestamps to output from cron so I can ...
25
votes
7answers
6k views
0
votes
1answer
72 views
> /dev/tty - What is the purpose of this command?
This is in one of the rc scripts in Red Hat and I want to understand the purpose of > /dev/tty[n]
last=0
for i in `LC_ALL=C grep '^[0-9].*respawn:/sbin/mingetty' /etc/inittab | sed 's/^.* ...
0
votes
2answers
83 views
chsh: PAM authentication failed
i want to change default shell env
and run chsh -s /bin/zsh as root user,
but a error message appeared: chsh: PAM authentication failed.
i find this thread ...
2
votes
0answers
40 views
Specify script to run with SSH at same time as login [migrated]
I would like to know if there is a way to specify what script to run (on the remote machine) at login. I'm logging into a Debian box with key-pair authentiation (no password needed). The script ...
1
vote
1answer
614 views
run several bash scripts with expect code and leave them running
I have a bunch of several bash scripts that will perform some actions that require user input, therefore I'm using expect with it.
However, I need one to keep running. But if I use expect, the expect ...
-1
votes
1answer
29 views
Can not seem to get expr substr to work
Can anyone tell me what I am doing wrong ?
[ /jlr/sub/libexec/vmr-staging ] $ expr substr "onetwothree" 1 4
expr: syntax error
I got the syntax from http://stackoverflow.com/a/220464/1150847
0
votes
1answer
42 views
Error when using Chef on OS X: “bash: chef-solo: command not found”
I have chef installed on my local machine: Mac OS X 10.8.3
I also have chef installed on a remote server: Ubuntu 12.10 x64 Server
On the local machine, when I try to execute a command using ssh ...
1
vote
2answers
52 views
bash: use outside variables when reading multiple lines into ssh
I apologize if the title doesn't quite describe what I'm looking for. Please edit if possible.
I have a bash script that does the following:
serveruser="root"
serverip=1.2.3.4
...
0
votes
0answers
19 views
Installing keys with .DEB packages silently fails
I'm trying to create a .DEB package which will install a number of certificates and keys onto a system.
To do this, i've gone through the standard package creation process, and thrown two files, ...
1
vote
2answers
33 views
I want to filter out two lines from the output of a program [closed]
I have a command that outputs a bunch of data, but I only want two lines. Grep doesn't work because the lines I want are not next to one another. I can't seem to figure out sed...
Help please. :)
...
2
votes
2answers
57 views
How do i use the {} operator in find execution inside exec
I tried this bash command:
find /var/www/ -path '*wp-admin/index.php' -exec mv {} $(dirname {})/index_disabled
But the second {} is not executed.
It results in just ./index_disabled instead.
How ...
0
votes
1answer
66 views
How do I rename all files index.php containing a certain folder in the path?
I want to rename all wordpress admin index files into index_disabled in the folder
/var/www/
I need a script like
find /var/www/ -path '*wp-admin/index.php' -exec mv {} $(dirname ...
-1
votes
1answer
33 views
Trimming characters of a command in bash
I am running command in a bash shell as follows:
/usr/bin/ntlm_auth --request-nt-key --domain=TEST.DOMAIN --username=Administrator --password=mypassword
Although I would like to trim the last 6 ...
0
votes
0answers
32 views
How can I block all wordpress admin access on a server?
I administer a server with lot of wordpress installations.
Is there a way to block all admin-accounts with one script, or to add an extra password in the global apache configuration?
I would like to ...
1
vote
1answer
35 views
Linux date translation to different time zone
The Linux server is hosted in EST timezone. But I want to translate the output of date command to IST(Indian Standard time +5:30 hrs) format and use it in a shell script. Is there any option available ...
20
votes
3answers
3k views
0
votes
1answer
121 views
smtp.gmail.com from bash gives “Error in certificate: Peer's certificate issuer is not recognized.”
I needed my script to email admin if there is a problem, and the company only uses Gmail. Following a few posts instructions I was able to set up mailx using a .mailrc file. there was first the error ...
0
votes
2answers
43 views
Executing a remote MySQL query over SSH
I am trying to execute a MySQL query over ssh using the following command:
ssh -p 2020 mysql@mysql1.local.mydomain.com "mysql --verbose --compress --secure-auth --database ops --execute \
'INSERT ...
0
votes
1answer
40 views
Deleting Files in a Zip Archive on Linux
I have a situation where I need to be able to run a script and delete specific files within a zip archive. Below is the general setup
/mnt/directory
/mnt/directory/Folder1
...
0
votes
1answer
26 views
Allow user to run script as root, but not the individual commands within the script
I don't have much experience with this type of task and realize I need to get more familiar with the sudoers file. I want a user to be able to connect via ssh and run a script that performs a bunch ...
0
votes
1answer
52 views
Running a remote SQL query over SSH
I am attempting to execute a MySQL query on a remote server over ssh. Here is the command I have:
ssh -p 2020 mysql@mysql1.local.mydomain.com 'mysql --compress --secure-auth --database operations ...
0
votes
1answer
41 views
Recursively delete empty folders with verbose output
This should be fairly simple, but I am not sure what i'm missing.
I'd like to recursively delete empty directories, and get an output for what's being deleted, this command works for sure, but I just ...
0
votes
3answers
465 views
bash script in unix - return full path and filename
I want to design bash script in unix and this bash return full path because I want to use this file in other places.
1
vote
2answers
76 views
Using 'source' command in bash scripts
I am writing a bash script to attempt to automate initial setup on Ubuntu, and I have run into an issue I do not understand. If I run the following code:
sudo apt-get -y update && sudo ...
0
votes
1answer
54 views
Is it possible to change BIOS settings from Linux?
I'm trying to write a script to enable IPMI on a ton of machines without having to hook up a KVM to them one by one. Is it possible to change the BIOS settings from Linux? OS is SL6.
I understand ...
1
vote
1answer
90 views
How do telnet-based programs report their terminal type to a socket server?
I've written a script called by tcpserver that heavily utilizes tput and similar commands. These commands need to know how to correctly write to the terminal and rely on the TERM variable to obtain ...
0
votes
2answers
29 views
get informations from x servers per ssh by bash script
I've server Master,SlaveA,SlaveB,SlaveC, and want to get eg. the space information from the server by executing one bash script on the master.
How can I do that?
--case--
192.168.1.1 - Master
...
5
votes
6answers
10k views
How should someone create an encrypted password for /etc/shadow?
I am setting up a new account on a Linux box for Subversion repository access, and can send the password to the new user. However, I think there was a command line utility for this new user to encrypt ...
0
votes
1answer
48 views
ftp server to restrict 'get' and 'ls'
I would like to configure ftp server in such a way that no client can use get and ls
command
Is it possible to do it ftp server configuration or can we go for round around method
pls guide me
I ...
1
vote
2answers
32 views
How to optimize SVN backup process in bash script?
I have a shell script running in AIX that will do the backup for each SVN repository every night. The execution is as follow:
Download the each repository save as a dump file:
svnrdump on repo_A
...
1
vote
2answers
68 views
ssh remote execution of multiple files
I've got two local files, one config.sh that contains variable definitions, another script.sh that contains a bash script.
Locally, I can do:
source config.sh; bash script.sh
I'm looking for the ...
11
votes
6answers
1k views
Can't log in via SSH to any accounts set to use /bin/bash as a default shell
I'm trying to install bash as the default shell on a ARM Linux running on an embedded device (Synology DS212+ NAS). But there's something really wrong, and I can't figure out what it is.
Symptoms:
...
0
votes
2answers
76 views
Start Linux GUI app in a VNC or RDP session for later access
Using a BASH script, I need to launch a GUI application at boot in such a way that I can later connect via RDP or VNC and see the application running. For example, the script will run at boot and ...
0
votes
1answer
151 views
Shell script to parse ip:port from a text file
I get daily a text file with ip:port, one per line, example:
11.22.33.44:80
22.33.44.55:8080
33.44.55.66:7777
I would like to parse the first ip and port in two different variables, then write them ...
-1
votes
1answer
24 views
untracked files 'git status -s' output changes ?? into rc when run in a subshell [closed]
I'm looking to get a single line listing of all the unchecked-in changes from a git repository (in this case, /etc being managed by etckeeper/git).
git status -s produces a nice short list of ...
-1
votes
1answer
32 views
Sanitise input for traceroute tracepath [closed]
Hi I'm after a way to sanitise input for traceroute/tracepath /well really any bash input.
For example:
root@meh:~# tracepath http://google.com/
gethostbyname2: Unknown host
I'll probably setup an ...
1
vote
2answers
270 views
Tail and wildcard characters
I want to get the last 10 lines of multiple files. I know they all end with "-access_log". So I tried:
tail -10 *-access_log
But this gives me an error, where as:
tail -10 file-*
Gives me the ...
0
votes
1answer
67 views
Bash: php comand not found when called from a script run with sudo
I have this weird problem. The php command is not found in one specific sitiation.
I try to call the command in three different ways. Only one of them fails:
Being user john I create a simple ...
1
vote
1answer
65 views
Linux RDesktop Lockups
I have a script I wrote to create RDP connections from Linux workstations to Windows servers. Everything is great when used on a machine plugged into an Ethernet jack but when used on a wireless ...
1
vote
2answers
49 views
xargs “too long argument list”
I want to do something like this:
cat 5.txt | xargs -0 openssl prime
but xargs is saying that argument list is too long
Edit:
cat 3.txt | xargs -n 1 openssl prime | wc -l
works, thanks
124
votes
39answers
22k views
What useful things can one add to one's .bashrc? [closed]
Is there anything that you can't live without and will make my life SO much easier? Here are some that I use ('diskspace' & 'folders' are particularly handy).
# some more ls aliases
alias ll='ls ...
1
vote
1answer
27 views
Is it safe to remove the Bash Shell startup files for Samba user accounts?
I'm in the process of setting up Samba shares for a SOHO network and would like to know whether or not it is safe/advisable to remove a Samba user's Bash Shell startup files (i.e. .bash_logout, ...
3
votes
2answers
69 views
How to filter out default system processes with ps?
Is there a way to get a list of running processes on a Linux system, minus the default ones running on every system (i.e. only the ones that were installed/executed after the fact).
Can this be ...
9
votes
3answers
3k views
Do background processes get a SIGHUP when logging off?
This is a followup to this question.
I've run some more tests; looks like it really doesn't matter if this is done at the physical console or via SSH, neither does this happen only with SCP; I also ...
-1
votes
1answer
52 views
run expect script from other shell [closed]
my target is to create the /var/tmp/add_user.bash script by /var/tmp/create_script_add_user.bash script
and run the expect script ( add_user.bash ) from create_script_add_user.bash script
the ...
29
votes
7answers
26k views
mysqldump to a tar.gz
Usually after dumping a MySQL database with mysqldump command I immediately tar/gzip the resultant file. I'm looking for a way to do this in one command:
So from this:
mysqldump dbname -u root -p ...
2
votes
2answers
112 views
Using 'which' command in cron job
I have a cron job that runs once a day on a Linux server and in the script it executes there is a test:
# Validate ffmpeg is installed
if [ $(which ffmpeg | grep -c "ffmpeg") -eq 0 ]; then
echo ...
1
vote
1answer
43 views
bash_history file and history command showing different entries
I am using the Terminal app on OS X to try and clear my command history. The entries within my $HOME/.bash_history file do not match what is returned by the history command. The echo $0 command tells ...




