Tagged Questions
0
votes
0answers
7 views
ImageMagick Script Error: ': No such file or directory @ error/blob.c/OpenBlob/2644
I am trying to run the following script in terminal:
mogrify -resize 900x10000 *.JPG
mogrify -resize 900x10000 *.jpg
for f in *.JPG
do
echo "<tr><td><img ...
1
vote
2answers
41 views
Unix moving/removing files from subdirectories
if there are several subdirectories in the current working directory, i would like to move only specific filetypes or possibly all the contents of those directories, to the working directory. and ...
0
votes
1answer
40 views
What does the default /etc/profile on Mac OS X 10.8 look like?
Some idiot altered my /etc/profile file, and I want to revert it to the system default, because I have now realized that I would rather override whatever needs to be overriden using files in my home ...
0
votes
2answers
36 views
Issue with find: invalid predicate '-delete'
I try to run (unix-shell, win7):
find . -maxdepth 1 -name "*.jpg" -size -50k -delete
and get the error:
find: invalid predicate '-delete'
any hints?
3
votes
2answers
36 views
Wait until SSH succeeds creating a port forwarding
I am calling ssh (OpenSSH) from a OSX/Linux-C++-Application via fork/exec to create a dynamic port forwarding. This is done using batch mode (-o BatchMode=yes) and a private key which is supplied to ...
0
votes
0answers
15 views
Can not delete folder with svn control files created by other user
this problem happened on a SunOS
I (not root user) want to delete a folder "def"(contains sub folder and files) created by other user, I have the full control of "def"'s parent folder(say "abc"), but ...
0
votes
3answers
33 views
How to tar/zip a parent directory exculding a child direcory
I want tar a direcory which contains a number of child directories. But here my requirement is to tar the entire parent direcory excuding one child directory.
Is there any command or procedure for ...
10
votes
2answers
125 views
How to move folder in unix using mv, only when target is on the same drive
I need to move a folder using unix mv command, but only if the target is in the same drive or the same filesystem. What would be the best approach?
1
vote
2answers
19 views
^S in terminal does not get sent to Vim
I'd like to overload both Ctrl+S and Cmd+S to save a file if I happen to be editing something in Vim.
After some head-scratching I think I've discovered that ^S in a terminal is perhaps being caught ...
3
votes
4answers
141 views
Why do I need a “./” before executing some scripts? [duplicate]
For instance, I have installed java and can just run java ... but if I create a shell script for instance, I have to run ./script.sh.
Why is this? What does the ./ signify?
1
vote
3answers
73 views
What's the best way to get a random(ish) sequence of printable/alphanumeric characters?
I know I can get random (well, pseudo-random) characters, unconstrained, from '/dev/random' (or /dev/urandom). But what if I need these characters to generate a filename? I need to somehow have a ...
0
votes
1answer
65 views
Using find with -exec gzip and grep
I have a bunch of zipped up log files and I want to search them all for a string. I tried this but it's not working:
find ./ -name "*.log.zip" -exec gzip -dc {} | grep ERROR \;
It's giving me:
...
2
votes
2answers
42 views
How to look at the past directory history the shell was in?
Sometimes I like to look back in the command history to figure out what I was doing. Sometimes it would help to know what the cwd was for each command.
So, I'm wondering if there's some way to track ...
1
vote
0answers
40 views
repeat command until process start or timeout unix
Is there anyway to check the number of file in a directory, if the number of files is correct, say 5 files, zip the files with zip -r total.zip. If the number of files is wrong, wait 3 seconds, and ...
1
vote
2answers
35 views
unix command zip everything except file ending with _fpartxx
I was wondering, if I have a folder structure like this:
/var/www/testing/file1.iso_fpart0
/var/www/testing/file1.iso_fpart1
/var/www/testing/file1.iso_fpart2
/var/www/testing/file1.iso
...
1
vote
2answers
124 views
Unix Date command not working for few servers
I am trying to execute date command in unix server for yesterday. The commands tried are :
date --date="1 day ago"
date --date="1 days ago"
date --date="yesterday"
date --date="-1 day"
These ...
1
vote
2answers
52 views
Delete users who havent logged in for x days
got the simple code below
USERS=`cat /etc/passwd`
for USER in $USERS
do
echo "---------- $USER --------------"
last -n 4 $USER
done
I want to ideally remove all users who haven't logged in ...
1
vote
2answers
57 views
Redirecting shell command outputs to another konsole shell
I am writing a shell script and I would like to write commands in the script but redirect the output to other konsole sessions. (using kde)
0
votes
2answers
22 views
How to automatically remember the last path where I was? [*nix]
Is there any scripts or tools that can automatically remember and write down the path I am?
I asked because, when I was remote accessing my campus cluster via ssh last night, they will log me out ...
0
votes
1answer
57 views
How to execute a script saved in the local system from a remote server?
I want to execute a script saved on the local system from a remote Unix server to help me automate a deployment process. The script contains some commands to rename an existing file on the remote Unix ...
2
votes
3answers
172 views
What does kill 0 do actually?
In the man page, it says:
0 All processes in the current process group are signaled
And I tried like this:
$ man kill &
[1] 15247
$
[1]+ Stopped man kill
$ kill ...
1
vote
1answer
55 views
Subtract files from one another recursively between two similar directories
I'm trying to concoct a way to grab two (nearly identical) directories and show me the difference between all files in the two directories.
Looking for two different things:
1- List all files ...
5
votes
2answers
88 views
How to connect to a SSH session that was backgrounded with -f -N?
I'm doing some work where I need to pivot off a machine using proxychains so I'm connecting to a system and binding a local port like so...
ssh -f -N -D 9000 user@host.com
… which returns me back ...
0
votes
1answer
91 views
Grep issue (match two strings on same line)
Here I have some grep command which is not working correctly:
cat file1.txt:
apples
Date: Sun, 24 Feb 2013 8:14:06 -0800
peaches melons
cherry sky cloud
green purple
yellow
cat file2.txt:
apples
...
1
vote
2answers
55 views
Copy a line of text to a file and numbering it
I want to make several copies of a line of text, following a numeric order.
exampleline:
exampleline1
exampleline2
exampleline3
etc..
What's the basic way to get the desired number of copied lines ...
1
vote
1answer
62 views
Remove path until slash when typing in terminal
For instance, when I type a path in terminal
cd project/example/one
I can press Ctrl+W and remove the entire "word" project/example/one.
Sometimes it's not very useful.
Are there any shortcuts for ...
4
votes
4answers
403 views
How can I find the oldest file in a directory tree
I'm looking for a shell one-liner to find the oldest file in a directory tree.
0
votes
1answer
17 views
Cannot start a script
#!/bin/bash
value=$(<man.txt)
echo "$value"
if [ "$value" == "true" ]; then
echo "startedif_manthan"
ps -ef|grep sym |awk '{ print $2 }'|sudo xargs kill -9;
sleep 30;
sudo sh ...
0
votes
0answers
23 views
Different behavior from ubuntu server and ubuntu client on windows
#!/bin/bash
# Reading
cat /home/radiare/Desktop/first.txt | while read LINE
do
echo $LINE
if [ "$LINE" == "false" ]; then
echo "Inside first loop"
break
fi
done
echo "second file read started"
cat ...
4
votes
1answer
155 views
What file is used during login on UNIX?
When you log in to a shell on a unix system there are usually some files that are run in your home directory. You'd use these to for example set up aliases and additions to your $PATH.
But, how do I ...
1
vote
2answers
80 views
Extract a number from a column with Bash
I need to extract only bash script_c.sh process' number, from this output:
11545 pts/3 S+ 0:00 bash script_c.sh
11625 pts/3 S+ 0:00 grep script_c.sh
in this case it will be: 11545
I ...
2
votes
1answer
145 views
What are commands to find shell keywords, built in functions and user defined functions?
I was discussing with my friend on how the commands are parsed in the shell, and he told me that bash searches the command in following order
List of aliases
List of shell keywords
List of user ...
1
vote
2answers
104 views
Using paste command to join with multiple character delimiter
I have a file which gets generated based on the arguments and it has the following contents.
2012-12-31
2012-12-30
2012-12-29
Now, these are actually date partitions for hive query. So, I want to ...
0
votes
1answer
87 views
why .profile under home directory does not work when log in
I am a newbie to UNIX. I am using mac OS X 10.8. I created .profile under home directory. However, it does not work when login. I always have to force it to work using the command $ . ~/.profile. Can ...
1
vote
3answers
61 views
Can a user belong to a hidden group in Linux?
Is it possible for a user to belong to a group in Linux but that the group name is not listed in the group file in /etc directory. If so, what are some examples?
2
votes
2answers
99 views
How to delete all folders that have the same name as their parent folder?
Somehow I got a copy of every folder inside itself.
What is the shell command I could run to delete all folders that are inside folders of the same name?
For example in the above, running the ...
0
votes
3answers
33 views
Perform shell operation through secure shell
Is it possible to perform a shell operation from a bash script through a secure shell.
Here is an example of why you may want to do this. Lets say you have a simple unix operating system that you ...
0
votes
0answers
196 views
Automation script to SCP from UNIX to Window Server
I'm new to server/Unix trying to transfer file between AIX to Windows
I'm trying to create SCP or SFTP script that will run on cron and transfer text file on /usr/apps/11.111.1.11.log file to window ...
1
vote
1answer
69 views
unix move cursor after last character
After I use my arrow key to move my cursor left, I am unable to move it back to the end of the line. For instance:
If I type:
$ echo hello wordl_
Then if I move the cursor left to fix typo
$ ...
0
votes
1answer
80 views
tar -rvf not working
I am trying to append a .txt file to my already created .tar archive file. But the following error is showing up:
tar -rvf kits.tar example.txt
tar: This does not look like a tar archive
...
0
votes
2answers
228 views
How come the ls command prints in multiple columns on tty but only one column everywhere else?
Even after using Unix-like OSes for a couple years, this behaviour still baffles me.
When I use the ls command in a directory that has lots of files, the output is usually nicely formatted into ...
2
votes
2answers
131 views
Why there is difference between output of linux command du and ls?
I have a file in linux machine whose size is 3404494030 upon doing "ls -l". When I do "ls -lh" it shows 3.2 GB which is correct when converted from bytes to Gigabytes. But when I do "du -h" for the ...
0
votes
3answers
68 views
execute sub command within xargs
I want to make soft link of all the binary files of folder A to folder B
like,
find /home/A/bin/* -print | xargs -I {} ln -sf {} /tmp/B/$(basename {})
the problem is that I cant execute ...
1
vote
1answer
180 views
/usr/bin/mail equivalant for | sendmail -t
been searching for few hours, and came to no solution.
Is there an equal expression for the bash command
myfile | sendmail -t
where my information needed for sending mails is stored in the ...
1
vote
2answers
138 views
Suspended processes in Unix
beginner's Unix question:
I'm a bit confused about the purpose of suspended (Ctr+Z) commands in a unix shell. From what I gather a suspended process/command is neither in the background nor ...
0
votes
1answer
159 views
Unix shell script - cp -R doesn't copy contents behind symbolic links
I've got this ./image folder full of symbolic links to "real" folders. These "real" folder contain a series of images.
./image/stones -> somefolder/stones
./images/grass -> ...
3
votes
4answers
267 views
Shell command to remove a folder contents recursively excluding hidden files?
I want to remove a folder contents and it's sub-folder contents without removing hidden files in folder and sub-folders. How can i do it by using shell script??
I have tried rm -rf foldername but it ...
3
votes
1answer
64 views
Can't terminate a nohup process
I would like to send a SIGTERM signal to a nohup process, but this signal is completely ignored, only SIGKILL works, which is considered a bad choice to terminate a shell script. Do I have any options ...
-1
votes
2answers
173 views
Command to test if system is Windows or Unix [closed]
I'm looking for a shell command in unix that has a non zero output that is uniform across all unix platforms (for example will allways return 1 on a unix system) and also has no (or zero value) output ...
1
vote
1answer
73 views
Tail -f with pagination
I am trying to tail file with pagination
tail -f foo.txt | more
This works fine until file gets lets say 200 lines injected, when this happens nature of tail command is to go to end of file, at that ...
