Questions tagged [unix-shell]
124 questions
2
votes
1 answer
Find all the sym links that point to a particular file
I know that ls -l will give you the "number of links" but I'm looking for a command or combination of commands that will give me a list of all the symbolic links that point to a particular file.
![](../../users/profiles/23003.webp)
Ollie Saunders
- 121
- 2
2
votes
3 answers
Get results from grep in the order they appear?
I'm trying to grep a log file to only show lines that match a certain session ID. Thus far, it works great. However, when I get the results of my grep command, I'm not getting the entries in the order they appear.
If the log file in the directory…
![](../../users/profiles/17462.webp)
IVR Avenger
- 325
- 1
- 5
- 15
2
votes
1 answer
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 > result.txt
The parse.py can read from stdin…
![](../../users/profiles/50774.webp)
Ryan
- 5,341
- 21
- 71
- 87
2
votes
3 answers
Unix Linux directory compare
I have a known good directory structure that I'd like to compare owner/group and permissions against another server and flag any files/folders that need to be changed. Since I wont have access to both servers at once, I'd like to script out the…
RXWatcher
2
votes
3 answers
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 automatically start but they should never have access…
![](../../users/profiles/204656.webp)
greyfox
- 257
- 1
- 2
- 9
2
votes
2 answers
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 rotatelogs will rotate mid line so log file 1 has this…
![](../../users/profiles/201324.webp)
Brian Haines
- 41
- 2
2
votes
1 answer
How to pipe and echo the result that is being processed?
I'd like to execute this command:
find /apps/ -type f -print0 | grep -z log$ | xargs -0 grep 'this->aForm'
And in parallel, I'd like to see which files are being processed.
How to to this?
![](../../users/profiles/6467.webp)
Olivier Pons
- 612
- 1
- 5
- 21
2
votes
1 answer
'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 list 20 sub directories.
Here is some background…
![](../../users/profiles/89389.webp)
Kan
- 29
- 1
- 4
2
votes
1 answer
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: grep my_string * -r and it works at all, but if…
![](../../users/profiles/97833.webp)
Cyclone
- 250
- 1
- 6
- 20
2
votes
3 answers
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 archive or mysql backup). Is there a way to execute a…
![](../../users/profiles/84898.webp)
Eugeny89
- 131
- 1
- 5
2
votes
5 answers
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 above, that would be 5.
![](../../users/profiles/604.webp)
An̲̳̳drew
- 1,265
- 2
- 14
- 19
2
votes
4 answers
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 data/time inserted in front of each line?
![](../../users/profiles/57861.webp)
James Dean
- 761
- 1
- 6
- 5
2
votes
1 answer
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 cat
bat bat bat
horse horse horse
Is there a…
![](../../users/profiles/921.webp)
xyz
- 501
- 1
- 7
- 13
2
votes
3 answers
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 script accepts a few parameters that determine which…
![](../../users/profiles/52175.webp)
Lukman
- 178
- 5
2
votes
2 answers
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 anything automatically copied to home but this is not…
![](../../users/profiles/347872.webp)
Tronic
- 121
- 2