The unix-shell tag has no wiki summary.
2
votes
1answer
76 views
'ls' taking a long time to list 20 subdirectories
I have a directory (my_dir) which has 20 sub directories. Every time I run 'ls' or try to autocomplete a file name in this directory my IO usage goes to 100% and it takes very long time (10 mins) to ...
1
vote
3answers
133 views
Getting different values of particular variable from a file in UNIX
I have a file which I'd like to parse to extract certain values from it. I don't know what command and syntax I should use (maybe sed?).
Below are 2 sample lines which I might expect to find in the ...
1
vote
2answers
61 views
Solaris 8 - directories gone missing; is this housecleaning script the culprit?
Our outsourced IT service provider runs the following script via cron to clean up Oracle core and trace files. It clearly is not a well-written script, but my question for the Serverfault crowd is ...
0
votes
1answer
79 views
How to find a file that contains the specified string in FreeBSD?
I'm searching for the way to find a file that contains specified string text.
It should be fast as possible but its not that important.
I was reading the manual, and I've build something like that: ...
0
votes
2answers
225 views
How to secure svn+ssh checkout users?
All our SVN repositories are hosted on a dedicated machine on which all the developers have access. Every now and then we need to checkout a repository on a machine we don't own or operate ourselves. ...
0
votes
2answers
134 views
Is it possible to pass a shell variable from linux to windows via winexe?
I want to pass a shell variable called $test to windows from linux via winexe.
For example:
winexe -W WORKGROUP -U user%password //192.160.13.13 'cmd.exe /C move D:\restore_db\$test D:\Restore\'
Is ...
2
votes
3answers
357 views
grep - recognize carriage return as new line
I want to search a webserver running unix for php-files containing a specific string. Usually I use these commands to accomplish this:
find . -name "*.php" -print0 | xargs -0 grep -H -i "the string ...
1
vote
0answers
32 views
DreamHost: Run each site under a different user, with one Webmaster account that can access all the files
As a measure to combat the problem of hitting DreamHost's "soft" (undisclosed) RAM limit on shared hosting, I'd like to try running each domain/subdomain under a different UNIX user.
I would also ...
0
votes
3answers
57 views
portable unix way to join strings with separator
Is there a portable unix shellscripting way of joining a number of strings together with a given separator, like so:
$ strjoin --- foo bar baz quux
foo---bar---baz---quux
Sure I could use a ...
0
votes
4answers
69 views
Chars referenced by octal values in *NIX shell scripts — getting them to be parsed?
I have a script which absolutely 100% _has_ to be done in this ridiculous fashion:
echo $'\150\151\073\145\143\150\157' $'\171\141\171'
(unencoded: echo hi;echo yay)
The problem is that everything ...
0
votes
1answer
63 views
Check if drive has enough space before writing
I am looking to make a backup to a remote drive, but I want to do a check prior to doing so.
Is it possible to snatch only the "Available" space from the df output, rather than all of the details, to ...
2
votes
3answers
127 views
putty aborts process while shutting down
I'm newby so the question is simple. After I connected to server via putty I want to execute some command. Suppose that command will be performed for long time (e.g. extracting files from large ...
1
vote
1answer
65 views
Java command not going to background with &
I'm running a java command:
java weblogic.Admin -adminurl t3://URL:POST -username username -password password START $SERVER &
on an Aix machine.
The problem is that the shell still halts ...
0
votes
1answer
62 views
Shell command to find and file the last modified file in a certain directory
I want to create an alias that displays the latest log in a certain directory - something like:
ls -lat *log* | tail -1 | less
The above command does not work as the output of the ls -lat command ...
0
votes
4answers
285 views
Counting number of items in a single-row CSV file?
I have a file containing a long comma-delimited list of numbers, like this:
2,8,42,75,101
What's the simplest command (from a Unix shell) to get the count of numbers in this file? In the example ...
0
votes
1answer
113 views
Sending a message to a remote terminal
Is there a way to send a message to a remote terminal similar to using the wall command for other users on the local system? In this scenario I want to specify a username@hostname and have a message ...
0
votes
3answers
153 views
how to find the weblogic server start time in unix box
how to find the weblogic server start time in unix.
i have give ps -f | grep port number
but it is showing my current system time.
how to find this
0
votes
2answers
213 views
What are best practices writing parallel startup scripts in Unix shell (ksh,bash)?
I have a piece of software with different components running on the same Unix machine (web server, DBMS, middleware, different daemons). Startup of the few components depends on the success of the ...
0
votes
3answers
172 views
how to compare the files data in 2 different unix boxes
i have one file which exists in 2 different unix machines.
how i can compare the data with in the file
0
votes
3answers
101 views
install mysql on freebsd
How to install Mysql on freebsd , i have tried a lot but after i am getting lot many error so i have removed it , but now i want to reinstall it so , can anyone suggest me the link / commands to ...
0
votes
2answers
265 views
Vim how to change the cursor from char block to pre pipe/line
Not sure what the terminology is for it but on Vim the 'cursor' is always like an insert/replace cursor instead of the blinking line cursor I'm used to in other gui editors. Is there any way to change ...
0
votes
5answers
338 views
direct file transfer via ftp to ftp
Hi i want to transfer few file (which is very big in size ) from A server to B server via
ftp.
I have credentials of Server A's ftp and Server B's ftp - server B is my own server running
unix.
so ...
1
vote
5answers
384 views
Is there any browser utility I can use in SSH for Linux
Is there a text-based browser available for Linux (CentsOS) which I can use when I SSH to my server.
I use CentOS release 5.5. My server do not have graphic interface.
It would be nice if it ...
1
vote
3answers
168 views
'cd' switch back and forth to previous and current directory
I found cd - can switch back and forth between previous and current directory which is a very handy feature. Also found cd -- works too, but not sure what exactly that's for. Is there any reference ...
1
vote
4answers
295 views
Is there an easy way to insert data/time in front of a log file with just shell scripting?
Say I want to monitor memory usage on a java process overnight.
I can do something like
top | grep java > out.log
I will get a log file with a whole bunch of lines.
Is there an easy way to get a ...
1
vote
2answers
503 views
How to encode the rdesktop password parameter in a shell script?
I can connect with this script from linux to a windows RDP session:
#!/bin/bash
/usr/bin/rdesktop -N -x m -u Administrator -p secret123 -d DOMAIN1 127.0.0.1:33891
(The rdp port of the remote ...
0
votes
3answers
138 views
Bash as default shell for Netware user
I am connecting to the Novell Netware (OES) server via ssh. It shows me default novell console. I want it to start bash automatically when I connect. How can I do this?
0
votes
1answer
27 views
Turn off colors in Netware console?
I'm looking for a method of changing colors in default Novell Netware (OES) console
-1
votes
1answer
226 views
Wow, there is no way this is wrong. What is wrong? [closed]
I am going to put this out there first, this is my shell script homework. However, I am finished with my work. It is just not running properly for some reason. I already asked 2 game developer ...
0
votes
2answers
678 views
How to concatenate environment variable paths in a cleaner way in bash?
In order to modify my paths (like LD_LIBRARY_PATH or PYTHONPATH), I first check is the variable exists. If so, I'm concatenating my old value with the new one (separated with a semicolon), else I'm ...
1
vote
1answer
140 views
Picking a single line from a text file by its line number
In a Unix shell, how can I pick a single line from a text file by its line number?
Say I want whatever is at line 3 in animals.txt to be written to stdout (bat bat bat).
monkey monkey monkey
cat cat ...
2
votes
3answers
75 views
Will uploading modified version of a KSH script affect processes that are currently running the script?
Let say I have a KSH script my_script.ksh that performs complex operations including but not limited to invoking SQLPLUS to manipulate large number (millions) of records in an Oracle database. The ...
1
vote
4answers
277 views
Append an echo to file?
In linux, how do I do something like
echo 'hello world' > log.txt
but instead of overwriting the contents of log.txt, it appends to the end of of log.txt?
3
votes
2answers
166 views
How do I prevent bash $ substitution?
I'm trying to preserve $if below and
would like the following to output
$if
bash is getting in the way by doing
$ substitution
$ sed -e 's:\\$:\\$:g' <<ENDOFFILE
> $if
> ...
1
vote
1answer
310 views
Using a shell script to check if rsync made any changes
I've got a bash script that rsync's two directories. Sometimes there's a change, odds are there's nothing.
I want to run a command only if rsync actually made a change (add/update a file). ...
3
votes
2answers
260 views
Shell scripting and regex: Which one is better to match numbers, [[:digit:]] or [0-9]?
As the title suggests, which one is better to match numbers, [[:digit:]] or [0-9]?
I'm using the bash shell
Thanks :)
1
vote
2answers
144 views
Unix/Linux command to view available servers
Situation: I'm inspired to work from home this evening. So I download some source from work's svn repo. Unfortunately, I find some lib files are missing. Not a problem, I'll remote in to my desktop at ...
0
votes
2answers
135 views
How do I traverse the filesystem looking for a regex match?
I know this is teeball for veteran sysadmins, but I'm looking to search a directory tree for file contents that match a regex (here, the word "Keyword"). I've gotten that far, but now I'm having ...
-2
votes
2answers
393 views
Run bash script with command line arguments
I want to do
/usr/bin/bash myscript.sh -args
which, as it stands, runs the script but doesn't pass the args to it. I realize that the conventional syntax is simply
./myscript.sh -args
but I'm ...
0
votes
1answer
468 views
how to set the font with mailx?
Solaris Korn Shell
I am writing sql reports to an oracle database, spooling them to a file and emailing them with mailx. I use the syntax below. The reports do not format properly, unless I use the ...
1
vote
1answer
263 views
How to batch edit a list of files?
I have a list of files where I need to remove some lines that have been added yesterday by a spambot. The section I want to remove looks like this:
^M
<script>[...] bunch of malware code ...
1
vote
3answers
204 views
tcsh : path of sourced file
I am sourcing a file under tcsh. This file could be anywhere on the filesystem. How can I retrieve the path of my sourced file ?
$0 won't work : I don't execute the file, I source it.
Many thanks !
3
votes
3answers
275 views
Faking the date for a specific shell session
I'm certainly trying to achieve something weird here, but I want to fake the date locally for a shell session on GNU/Linux.
I need to black-box test how a program behaves at different dates, and ...
1
vote
5answers
362 views
selective backup script in bash
I've been using this simple command (that's all I can do :) to backup the whole tree from my user data in NAS server for a year.
cp -r /STORAGE /BACKUP-STORAGE/YYYY-MM-DD
Unfortunately, after a ...
3
votes
4answers
110 views
Is there a way to prevent output from backgrounded tasks from covering the command line in a shell?
I would like to be able to run task(s) in the background of a shell and not have their output to stdout or stderr cover the command line at the bottom. Frequently I need to run other commands to ...
0
votes
1answer
70 views
What file is in every unix login? [closed]
I was asked that question and to be honest not sure if I understood that. I would say shell but instead of shell we can run any other program so ...
any idea by unix gurus?
3
votes
3answers
1k views
how does cd command work? (unix)
could anybody explain to me how cd - command work? man cd tells me that An argument of - is equivalent to $OLDPWD. Then I found on the net that $OLDPWD is the previous working directory as set by the ...
1
vote
2answers
690 views
How to change VGA mode after boot and login with ubuntu?
Is there a way to change the screen resolution of the console after the system has been booted? I've seen plenty on setting the vga= line in the boot and in the grub config but I'd like to be able to ...
1
vote
1answer
125 views
force unix program output redirect
I'm new to shell-scripting and I guess this should be something quite easy. Anyway I don't know how to force redirect a program's output to the input of another program. I know about the pipe, where ...
2
votes
6answers
322 views
Last command issued on a GNU/Linux box
Someone asked at the mailing list of my local LUG if there is any way of learning the last command issued on a GNU/Linux system.
We're talking last command in a system-wide fashion I guess. After ...